瀏覽代碼

add HBase work log

ZhenQin 12 年之前
父節點
當前提交
22f92cd03b
共有 2 個文件被更改,包括 97 次插入5 次删除
  1. 8 5
      hbase/hbase.md
  2. 89 0
      mongo-cluster/mongos.md

+ 8 - 5
hbase/hbase.md

@@ -1,8 +1,8 @@
 ##HBase Region
 
-key: ndtable,285852-3118393-120913-9079899,1379829871492.c1ebff2db71bcbfe1895e978fb4b8c4b. = 108151
-key: ndtable,285852-3118393-120927-10816259,1379829926332.cb304286645e868a4e99d00b405888a1. = 26990
-key: ndtable,285852-3118393-120920-10569041,1379829910397.f98e219da7df855f534f2c29abfb28c5. = 107929
+    key: ndtable,285852-3118393-120913-9079899,1379829871492.c1ebff2db71bcbfe1895e978fb4b8c4b. = 108151
+    key: ndtable,285852-3118393-120927-10816259,1379829926332.cb304286645e868a4e99d00b405888a1. = 26990
+    key: ndtable,285852-3118393-120920-10569041,1379829910397.f98e219da7df855f534f2c29abfb28c5. = 107929
 
 ##HBase Split Region
 
@@ -10,8 +10,11 @@ key: ndtable,285852-3118393-120920-10569041,1379829910397.f98e219da7df855f534f2c
 
 ##HBase 合并Region
 	
-hbase org.apache.hadoop.hbase.util.Merge ndtable ndtable,285852-3118393-121002-10940568,1379829971526.94ff06dba9417d6f8007845de09ad21f.  ndtable,285852-3118393-120929-10896460,1379829951758.a57c234f45671315dd1f275723519183.
+    hbase org.apache.hadoop.hbase.util.Merge ndtable ndtable,285852-3118393-121002-10940568,1379829971526.94ff06dba9417d6f8007845de09ad21f.  ndtable,285852-3118393-120929-10896460,1379829951758.a57c234f45671315dd1f275723519183.
 
-hbase org.apache.hadoop.hbase.util.Merge ndtable ndtable,285852-3118393-121007-11069221,1379831024597.d5c592f5fed2be11365885317770b0ff.  ndtable,285852-3118393-120927-10816259,1379829926332.cb304286645e868a4e99d00b405888a1.
+    hbase org.apache.hadoop.hbase.util.Merge ndtable ndtable,285852-3118393-121007-11069221,1379831024597.d5c592f5fed2be11365885317770b0ff.  ndtable,285852-3118393-120927-10816259,1379829926332.cb304286645e868a4e99d00b405888a1.
 
+HFile导入到HBase
+
+    bin/hadoop jar lib/hbase-0.94.11.jar completebulkload /user/hadoop/poststore posttable
 

+ 89 - 0
mongo-cluster/mongos.md

@@ -0,0 +1,89 @@
+
+##MongoDB 备份数据库
+
+    bin/mongodump -h 192.168.1.107:40000 -d nsmongo -c postStore -q {"createdAt" : {"$gte": new Date(2013,4,1,0,0,0), "$lt" : new Date(2013, 5, 1, 0, 0, 0)}} -o /data/back/
+
+---    
+
+    bin/mongodump --help
+    --help                                produce help message
+    -v [ --verbose ]                      be more verbose (include multiple times
+                                        for more verbosity e.g. -vvvvv)
+    --version                             print the program's version and exit
+    -h [ --host ] arg                     mongo host to connect to ( <set 
+                                        name>/s1,s2 for sets)
+    --port arg                            server port. Can also use --host 
+                                        hostname:port
+    --ipv6                                enable IPv6 support (disabled by 
+                                        default)
+    -u [ --username ] arg                 username
+    -p [ --password ] arg                 password
+    --authenticationDatabase arg          user source (defaults to dbname)
+    --authenticationMechanism arg (=MONGODB-CR)
+                                        authentication mechanism
+    --dbpath arg                          directly access mongod database files 
+                                        in the given path, instead of 
+                                        connecting to a mongod  server - needs 
+                                        to lock the data directory, so cannot 
+                                        be used if a mongod is currently 
+                                        accessing the same path
+    --directoryperdb                      each db is in a separate directly 
+                                        (relevant only if dbpath specified)
+    --journal                             enable journaling (relevant only if 
+                                        dbpath specified)
+    -d [ --db ] arg                       database to use
+    -c [ --collection ] arg               collection to use (some commands)
+    -o [ --out ] arg (=dump)              output directory or "-" for stdout
+    -q [ --query ] arg                    json query
+    --oplog                               Use oplog for point-in-time 
+                                        snapshotting
+    --repair                              try to recover a crashed database
+    --forceTableScan                      force a table scan (do not use 
+                                        $snapshot)
+
+---
+
+    mongodump -h dbhost -d dbname -o dbdirectory
+
+ - -h:MongDB所在服务器地址,例如:127.0.0.1,当然也可以指定端口号:127.0.0.1:27017
+ - -d:需要备份的数据库实例,例如:test
+ - -o:备份的数据存放位置,例如:c:\data\dump,当然该目录需要提前建立,在备份完成后,系统自动在dump目录下建立一个test目录,这个目录里面存放该数据库实例的备份数据。
+
+
+##MongoDB 恢复数据库
+
+    mongorestore -h 192.168.1.107 -p 40000 --d nsmongo -c postStore --directoryperdb /data/back/nsmongo
+
+---
+
+    bin/mongorestore --help
+    -h [ --host ] arg                     mongo host to connect to ( <set name>/s1,s2 for sets)
+    --port arg                            server port. Can also use --host hostname:port
+    --ipv6                                enable IPv6 support (disabled by default)
+    -u [ --username ] arg                 username
+    -p [ --password ] arg                 password
+    --authenticationDatabase arg          user source (defaults to dbname)
+    --authenticationMechanism arg (=MONGODB-CR) authentication mechanism
+    --dbpath arg                          directly access mongod database files 
+                                        in the given path, instead of 
+                                        connecting to a mongod  server - needs 
+                                        to lock the data directory, so cannot 
+                                        be used if a mongod is currently 
+                                        accessing the same path
+    --directoryperdb                      each db is in a separate directly (relevant only if dbpath specified)
+    --journal                             enable journaling (relevant only if dbpath specified)
+    -d [ --db ] arg                       database to use
+    -c [ --collection ] arg               collection to use (some commands)
+    --objcheck                            validate object before inserting (default)
+    --noobjcheck                          don't validate object before inserting
+    --filter arg                          filter to apply before inserting
+    --drop
+
+---
+
+    mongorestore -h dbhost -d dbname --directoryperdb dbdirectory
+
+ - -h:MongoDB所在服务器地址
+ - -d:需要恢复的数据库实例,例如:test,当然这个名称也可以和备份时候的不一样,比如test2
+ - --directoryperdb:备份数据所在位置,例如:c:\data\dump\test,这里为什么要多加一个test,而不是备份时候的dump,读者自己查看提示吧!
+ - --drop:恢复的时候,先删除当前数据,然后恢复备份的数据。就是说,恢复后,备份后添加修改的数据都会被删除,慎用