转自:http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=23916356&id=3321832

最近因为生产环境hbase中某张表的数据要导出到测试环境(数据不多,大概200W条左右),如果用程序掉接口导入的话太慢,所以考虑直接用
hbase的功能来导入导出。因为此次是实验,所以我在正式环境建了一张小表,只有两条数据,目的是将它导入到一张新表中(空表,但是表结构一样)

hbase(main):004:0> scan 'xyz'
ROW                  
COLUMN+CELL

10000               
column=cf1:val, timestamp=1345598242644,
value=china

20000               
column=cf1:val, timestamp=1345598283332, value=zengzhunzhu
                     
n

2 row(s) in 0.0350 seconds

开始导出:
[hadoop@master ~]$ hbase/bin/hbase
org.apache.hadoop.hbase.mapreduce.Driver expo
rt xyz file:///home/hadoop/xyz
12/08/22 10:12:07 INFO mapreduce.Export: verisons=1, starttime=0,
endtime=9223372036854775807
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:12:08 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/home/hadoop/hbase/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in
[jar:file:/home/hadoop/hadoop/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for
an explanation.
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012
10:48 GMT
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:host.name=master
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:java.version=1.6.0_14
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:java.vendor=Sun Microsystems Inc.
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:java.home=/usr/java/jdk1.6.0_14/jre
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:java.class.path=/home/hadoop/hbase/bin/../conf:/usr/java/jdk1.6.0_14/lib/tools.jar:/home/hadoop/hbase:/home/hadoop/hbase/hbase-0.92.1.jar:/home/hadoop/hbase/hbase-0.92.1-tests.jar:/home/hadoop/hbase/lib/activation-1.1.jar:/home/hadoop/hbase/lib/asm-3.1.jar:/home/hadoop/hbase/lib/avro-1.5.3.jar:/home/hadoop/hbase/lib/avro-ipc-1.5.3.jar:/home/hadoop/hbase/lib/commons-beanutils-1.7.0.jar:/home/hadoop/hbase/lib/commons-beanutils-core-1.8.0.jar:/home/hadoop/hbase/lib/commons-cli-1.2.jar:/home/hadoop/hbase/lib/commons-codec-1.4.jar:/home/hadoop/hbase/lib/commons-collections-3.2.1.jar:/home/hadoop/hbase/lib/commons-configuration-1.6.jar:/home/hadoop/hbase/lib/commons-digester-1.8.jar:/home/hadoop/hbase/lib/commons-el-1.0.jar:/home/hadoop/hbase/lib/commons-httpclient-3.1.jar:/home/hadoop/hbase/lib/commons-lang-2.5.jar:/home/hadoop/hbase/lib/commons-logging-1.1.1.jar:/home/hadoop/hbase/lib/commons-math-2.1.jar:/home/hadoop/hbase/lib/commons-net-1.4.1.jar:/home/hadoop/hbase/lib/core-3.1.1.jar:/home/hadoop/hbase/lib/guava-r09.jar:/home/hadoop/hbase/lib/hadoop-core-1.0.0.jar:/home/hadoop/hbase/lib/high-scale-lib-1.1.1.jar:/home/hadoop/hbase/lib/httpclient-4.0.1.jar:/home/hadoop/hbase/lib/httpcore-4.0.1.jar:/home/hadoop/hbase/lib/jackson-core-asl-1.5.5.jar:/home/hadoop/hbase/lib/jackson-jaxrs-1.5.5.jar:/home/hadoop/hbase/lib/jackson-mapper-asl-1.5.5.jar:/home/hadoop/hbase/lib/jackson-xc-1.5.5.jar:/home/hadoop/hbase/lib/jamon-runtime-2.3.1.jar:/home/hadoop/hbase/lib/jasper-compiler-5.5.23.jar:/home/hadoop/hbase/lib/jasper-runtime-5.5.23.jar:/home/hadoop/hbase/lib/jaxb-api-2.1.jar:/home/hadoop/hbase/lib/jaxb-impl-2.1.12.jar:/home/hadoop/hbase/lib/jersey-core-1.4.jar:/home/hadoop/hbase/lib/jersey-json-1.4.jar:/home/hadoop/hbase/lib/jersey-server-1.4.jar:/home/hadoop/hbase/lib/jettison-1.1.jar:/home/hadoop/hbase/lib/jetty-6.1.26.jar:/home/hadoop/hbase/lib/jetty-util-6.1.26.jar:/home/hadoop/hbase/lib/jruby-complete-1.6.5.jar:/home/hadoop/hbase/lib/jsp-2.1-6.1.14.jar:/home/hadoop/hbase/lib/jsp-api-2.1-6.1.14.jar:/home/hadoop/hbase/lib/libthrift-0.7.0.jar:/home/hadoop/hbase/lib/log4j-1.2.16.jar:/home/hadoop/hbase/lib/netty-3.2.4.Final.jar:/home/hadoop/hbase/lib/protobuf-java-2.4.0a.jar:/home/hadoop/hbase/lib/servlet-api-2.5-6.1.14.jar:/home/hadoop/hbase/lib/servlet-api-2.5.jar:/home/hadoop/hbase/lib/slf4j-api-1.5.8.jar:/home/hadoop/hbase/lib/slf4j-log4j12-1.5.8.jar:/home/hadoop/hbase/lib/snappy-java-1.0.3.2.jar:/home/hadoop/hbase/lib/stax-api-1.0.1.jar:/home/hadoop/hbase/lib/velocity-1.7.jar:/home/hadoop/hbase/lib/xmlenc-0.52.jar:/home/hadoop/hbase/lib/zookeeper-3.4.3.jar:/home/hadoop/hadoop/libexec/../conf:/usr/java/jdk1.6.0_14/lib/tools.jar:/home/hadoop/hadoop/libexec/..:/home/hadoop/hadoop/libexec/../hadoop-core-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/asm-3.2.jar:/home/hadoop/hadoop/libexec/../lib/aspectjrt-1.6.5.jar:/home/hadoop/hadoop/libexec/../lib/aspectjtools-1.6.5.jar:/home/hadoop/hadoop/libexec/../lib/commons-beanutils-1.7.0.jar:/home/hadoop/hadoop/libexec/../lib/commons-beanutils-core-1.8.0.jar:/home/hadoop/hadoop/libexec/../lib/commons-cli-1.2.jar:/home/hadoop/hadoop/libexec/../lib/commons-codec-1.4.jar:/home/hadoop/hadoop/libexec/../lib/commons-collections-3.2.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-configuration-1.6.jar:/home/hadoop/hadoop/libexec/../lib/commons-daemon-1.0.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-digester-1.8.jar:/home/hadoop/hadoop/libexec/../lib/commons-el-1.0.jar:/home/hadoop/hadoop/libexec/../lib/commons-httpclient-3.0.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-io-2.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-lang-2.4.jar:/home/hadoop/hadoop/libexec/../lib/commons-logging-1.1.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-logging-api-1.0.4.jar:/home/hadoop/hadoop/libexec/../lib/commons-math-2.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-net-1.4.1.jar:/home/hadoop/hadoop/libexec/../lib/core-3.1.1.jar:/home/hadoop/hadoop/libexec/../lib/hadoop-capacity-scheduler-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/hadoop-fairscheduler-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/hadoop-thriftfs-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/hbase-0.92.1.jar:/home/hadoop/hadoop/libexec/../lib/hsqldb-1.8.0.10.jar:/home/hadoop/hadoop/libexec/../lib/jackson-core-asl-1.8.8.jar:/home/hadoop/hadoop/libexec/../lib/jackson-mapper-asl-1.8.8.jar:/home/hadoop/hadoop/libexec/../lib/jasper-compiler-5.5.12.jar:/home/hadoop/hadoop/libexec/../lib/jasper-runtime-5.5.12.jar:/home/hadoop/hadoop/libexec/../lib/jdeb-0.8.jar:/home/hadoop/hadoop/libexec/../lib/jersey-core-1.8.jar:/home/hadoop/hadoop/libexec/../lib/jersey-json-1.8.jar:/home/hadoop/hadoop/libexec/../lib/jersey-server-1.8.jar:/home/hadoop/hadoop/libexec/../lib/jets3t-0.6.1.jar:/home/hadoop/hadoop/libexec/../lib/jetty-6.1.26.jar:/home/hadoop/hadoop/libexec/../lib/jetty-util-6.1.26.jar:/home/hadoop/hadoop/libexec/../lib/jsch-0.1.42.jar:/home/hadoop/hadoop/libexec/../lib/junit-4.5.jar:/home/hadoop/hadoop/libexec/../lib/kfs-0.2.2.jar:/home/hadoop/hadoop/libexec/../lib/log4j-1.2.15.jar:/home/hadoop/hadoop/libexec/../lib/mockito-all-1.8.5.jar:/home/hadoop/hadoop/libexec/../lib/oro-2.0.8.jar:/home/hadoop/hadoop/libexec/../lib/servlet-api-2.5-20081211.jar:/home/hadoop/hadoop/libexec/../lib/slf4j-api-1.4.3.jar:/home/hadoop/hadoop/libexec/../lib/slf4j-log4j12-1.4.3.jar:/home/hadoop/hadoop/libexec/../lib/xmlenc-0.52.jar:/home/hadoop/hadoop/libexec/../lib/jsp-2.1/jsp-2.1.jar:/home/hadoop/hadoop/libexec/../lib/jsp-2.1/jsp-api-2.1.jar

12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:java.library.path=/home/hadoop/hadoop/libexec/../lib/native/Linux-amd64-64:/home/hadoop/hbase/lib/native/Linux-amd64-64

12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:java.io.tmpdir=/tmp
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:java.compiler=
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:os.name=Linux
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:os.arch=amd64
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:os.version=2.6.9-89.ELsmp
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:user.name=hadoop
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:user.home=/home/hadoop
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Client
environment:user.dir=/home/hadoop
12/08/22 10:12:09 INFO zookeeper.ZooKeeper: Initiating client
connection, connectString=slave2:2222,slave1:2222,slave3:2222
sessionTimeout=180000 watcher=hconnection
12/08/22 10:12:09 INFO zookeeper.ClientCnxn: Opening socket
connection to server /192.168.15.132:2222
12/08/22 10:12:09 INFO zookeeper.RecoverableZooKeeper: The
identifier of this process is 23606@master
12/08/22 10:12:09 WARN client.ZooKeeperSaslClient:
SecurityException: java.lang.SecurityException: 无法定位登录配置 occurred
when trying to find JAAS configuration.
12/08/22 10:12:09 INFO client.ZooKeeperSaslClient: Client will not
SASL-authenticate because the default JAAS configuration section
'Client' could not be found. If you are not using SASL, you may
ignore this. On the other hand, if you expected SASL to work,
please fix your JAAS configuration.
12/08/22 10:12:09 INFO zookeeper.ClientCnxn: Socket connection
established to slave3/192.168.15.132:2222, initiating session
12/08/22 10:12:09 WARN zookeeper.ClientCnxnSocket: Connected to an
old server; r-o mode will be unavailable
12/08/22 10:12:09 INFO zookeeper.ClientCnxn: Session establishment
complete on server slave3/192.168.15.132:2222, sessionid =
0x33943bafeb90005, negotiated timeout = 40000
12/08/22 10:12:09 DEBUG
client.HConnectionManager$HConnectionImplementation: Lookedup root
region location, connection=org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@28bb494b;
serverName=slave2,60020,1345461138645
12/08/22 10:12:09 DEBUG
client.HConnectionManager$HConnectionImplementation: Cached
location for .META.,,1.1028785192 is slave3:60020
12/08/22 10:12:09 DEBUG client.MetaScanner: Scanning .META.
starting at row=xyz,,00000000000000 for max=10 rows using org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@28bb494b

12/08/22 10:12:09 DEBUG
client.HConnectionManager$HConnectionImplementation: Cached
location for xyz,,1340764906812.6aa4cb2fb4c9eb34f360953acdb1e21c.
is slave2:60020
12/08/22 10:12:09 DEBUG client.MetaScanner: Scanning .META.
starting at row=xyz,,00000000000000 for max=2147483647 rows using
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@28bb494b

12/08/22 10:12:09 DEBUG mapreduce.TableInputFormatBase: getSplits:
split -> 0 -> slave2:,
12/08/22 10:12:10 INFO mapred.JobClient: Running job:
job_201208201908_0002
12/08/22 10:12:11 INFO mapred.JobClient:  map 0%
reduce 0%
12/08/22 10:12:30 INFO mapred.JobClient:  map 100%
reduce 0%
12/08/22 10:12:35 INFO mapred.JobClient: Job complete:
job_201208201908_0002
12/08/22 10:12:35 INFO mapred.JobClient: Counters: 18
12/08/22 10:12:35 INFO
mapred.JobClient:   Job
Counters
12/08/22 10:12:35 INFO
mapred.JobClient:    
SLOTS_MILLIS_MAPS=16203
12/08/22 10:12:35 INFO
mapred.JobClient:    
Total time spent by all reduces waiting after reserving slots
(ms)=0
12/08/22 10:12:35 INFO
mapred.JobClient:    
Total time spent by all maps waiting after reserving slots
(ms)=0
12/08/22 10:12:35 INFO
mapred.JobClient:    
Launched map tasks=1
12/08/22 10:12:35 INFO
mapred.JobClient:    
Data-local map tasks=1
12/08/22 10:12:35 INFO
mapred.JobClient:    
SLOTS_MILLIS_REDUCES=0
12/08/22 10:12:35 INFO
mapred.JobClient:   File Output
Format Counters
12/08/22 10:12:35 INFO
mapred.JobClient:    
Bytes Written=255
12/08/22 10:12:35 INFO
mapred.JobClient:  
FileSystemCounters
12/08/22 10:12:35 INFO
mapred.JobClient:    
HDFS_BYTES_READ=58
12/08/22 10:12:35 INFO
mapred.JobClient:    
FILE_BYTES_WRITTEN=31370
12/08/22 10:12:35 INFO
mapred.JobClient:   File Input
Format Counters
12/08/22 10:12:35 INFO
mapred.JobClient:    
Bytes Read=0
12/08/22 10:12:35 INFO
mapred.JobClient:   Map-Reduce
Framework
12/08/22 10:12:35 INFO
mapred.JobClient:    
Map input records=2
12/08/22 10:12:35 INFO
mapred.JobClient:    
Physical memory (bytes) snapshot=77606912
12/08/22 10:12:35 INFO
mapred.JobClient:    
Spilled Records=0
12/08/22 10:12:35 INFO
mapred.JobClient:    
CPU time spent (ms)=1830
12/08/22 10:12:35 INFO
mapred.JobClient:    
Total committed heap usage (bytes)=31850496
12/08/22 10:12:35 INFO
mapred.JobClient:    
Virtual memory (bytes) snapshot=488656896
12/08/22 10:12:35 INFO
mapred.JobClient:    
Map output records=2
12/08/22
10:12:35 INFO
mapred.JobClient:    
SPLIT_RAW_BYTES=58

上述红色字体输出已提示导出了两条数据了,因为我有3个datanode,加上数据比较少,所以肯定只会在一台datanode上有导出文件。
如果数据很多,可能每个datanode节点都会有导出文件,至于在哪台datanode上你就需要找一下/home/hadoop目录下有没有xyz目
录了。
我这找到后文件如下:
[hadoop@slave2 ~]$ cd xyz/
[hadoop@slave2 xyz]$ ls
part-m-00000  _SUCCESS
开始新建一张新表,表结构和xyz表一样
hbase(main):001:0> create 'zzz','cf1'
0 row(s) in 2.0490 seconds
然后开始导入,这里我就利用导出文件在哪我就在哪导入了。当然你也可以拿这个part-m-00000文件到其余的datanode上导入,顺便友情提醒一下,如果导出的数据很多,你导入的时候千万别把所有的part-m-0000*文件都放到一个目录下开始导入,肯定会失败的!你只能把part-m-0000*文件一个个开始导入。
[hadoop@slave2 ~]$ hbase/bin/hbase
org.apache.hadoop.hbase.mapreduce.Driver impo
rt zzz file:///home/hadoop/xyz/
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
12/08/22 10:30:42 DEBUG mapreduce.TableMapReduceUtil: New
JarFinder: org.apache.hadoop.util.JarFinder.getJar not
available.  Using old findContainingJar
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/home/hadoop/hbase/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in
[jar:file:/home/hadoop/hadoop/lib/slf4j-log4j12-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for
an explanation.
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012
10:48 GMT
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:host.name=slave2
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:java.version=1.6.0_14
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:java.vendor=Sun Microsystems Inc.
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:java.home=/usr/java/jdk1.6.0_14/jre
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:java.class.path=/home/hadoop/hbase/bin/../conf:/usr/java/jdk1.6.0_14/lib/tools.jar:/home/hadoop/hbase:/home/hadoop/hbase/hbase-0.92.1.jar:/home/hadoop/hbase/hbase-0.92.1-tests.jar:/home/hadoop/hbase/lib/activation-1.1.jar:/home/hadoop/hbase/lib/asm-3.1.jar:/home/hadoop/hbase/lib/avro-1.5.3.jar:/home/hadoop/hbase/lib/avro-ipc-1.5.3.jar:/home/hadoop/hbase/lib/commons-beanutils-1.7.0.jar:/home/hadoop/hbase/lib/commons-beanutils-core-1.8.0.jar:/home/hadoop/hbase/lib/commons-cli-1.2.jar:/home/hadoop/hbase/lib/commons-codec-1.4.jar:/home/hadoop/hbase/lib/commons-collections-3.2.1.jar:/home/hadoop/hbase/lib/commons-configuration-1.6.jar:/home/hadoop/hbase/lib/commons-digester-1.8.jar:/home/hadoop/hbase/lib/commons-el-1.0.jar:/home/hadoop/hbase/lib/commons-httpclient-3.1.jar:/home/hadoop/hbase/lib/commons-lang-2.5.jar:/home/hadoop/hbase/lib/commons-logging-1.1.1.jar:/home/hadoop/hbase/lib/commons-math-2.1.jar:/home/hadoop/hbase/lib/commons-net-1.4.1.jar:/home/hadoop/hbase/lib/core-3.1.1.jar:/home/hadoop/hbase/lib/guava-r09.jar:/home/hadoop/hbase/lib/hadoop-core-1.0.0.jar:/home/hadoop/hbase/lib/high-scale-lib-1.1.1.jar:/home/hadoop/hbase/lib/httpclient-4.0.1.jar:/home/hadoop/hbase/lib/httpcore-4.0.1.jar:/home/hadoop/hbase/lib/jackson-core-asl-1.5.5.jar:/home/hadoop/hbase/lib/jackson-jaxrs-1.5.5.jar:/home/hadoop/hbase/lib/jackson-mapper-asl-1.5.5.jar:/home/hadoop/hbase/lib/jackson-xc-1.5.5.jar:/home/hadoop/hbase/lib/jamon-runtime-2.3.1.jar:/home/hadoop/hbase/lib/jasper-compiler-5.5.23.jar:/home/hadoop/hbase/lib/jasper-runtime-5.5.23.jar:/home/hadoop/hbase/lib/jaxb-api-2.1.jar:/home/hadoop/hbase/lib/jaxb-impl-2.1.12.jar:/home/hadoop/hbase/lib/jersey-core-1.4.jar:/home/hadoop/hbase/lib/jersey-json-1.4.jar:/home/hadoop/hbase/lib/jersey-server-1.4.jar:/home/hadoop/hbase/lib/jettison-1.1.jar:/home/hadoop/hbase/lib/jetty-6.1.26.jar:/home/hadoop/hbase/lib/jetty-util-6.1.26.jar:/home/hadoop/hbase/lib/jruby-complete-1.6.5.jar:/home/hadoop/hbase/lib/jsp-2.1-6.1.14.jar:/home/hadoop/hbase/lib/jsp-api-2.1-6.1.14.jar:/home/hadoop/hbase/lib/libthrift-0.7.0.jar:/home/hadoop/hbase/lib/log4j-1.2.16.jar:/home/hadoop/hbase/lib/netty-3.2.4.Final.jar:/home/hadoop/hbase/lib/protobuf-java-2.4.0a.jar:/home/hadoop/hbase/lib/servlet-api-2.5-6.1.14.jar:/home/hadoop/hbase/lib/servlet-api-2.5.jar:/home/hadoop/hbase/lib/slf4j-api-1.5.8.jar:/home/hadoop/hbase/lib/slf4j-log4j12-1.5.8.jar:/home/hadoop/hbase/lib/snappy-java-1.0.3.2.jar:/home/hadoop/hbase/lib/stax-api-1.0.1.jar:/home/hadoop/hbase/lib/velocity-1.7.jar:/home/hadoop/hbase/lib/xmlenc-0.52.jar:/home/hadoop/hbase/lib/zookeeper-3.4.3.jar:/home/hadoop/hadoop/libexec/../conf:/usr/java/jdk1.6.0_14/lib/tools.jar:/home/hadoop/hadoop/libexec/..:/home/hadoop/hadoop/libexec/../hadoop-core-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/asm-3.2.jar:/home/hadoop/hadoop/libexec/../lib/aspectjrt-1.6.5.jar:/home/hadoop/hadoop/libexec/../lib/aspectjtools-1.6.5.jar:/home/hadoop/hadoop/libexec/../lib/commons-beanutils-1.7.0.jar:/home/hadoop/hadoop/libexec/../lib/commons-beanutils-core-1.8.0.jar:/home/hadoop/hadoop/libexec/../lib/commons-cli-1.2.jar:/home/hadoop/hadoop/libexec/../lib/commons-codec-1.4.jar:/home/hadoop/hadoop/libexec/../lib/commons-collections-3.2.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-configuration-1.6.jar:/home/hadoop/hadoop/libexec/../lib/commons-daemon-1.0.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-digester-1.8.jar:/home/hadoop/hadoop/libexec/../lib/commons-el-1.0.jar:/home/hadoop/hadoop/libexec/../lib/commons-httpclient-3.0.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-io-2.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-lang-2.4.jar:/home/hadoop/hadoop/libexec/../lib/commons-logging-1.1.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-logging-api-1.0.4.jar:/home/hadoop/hadoop/libexec/../lib/commons-math-2.1.jar:/home/hadoop/hadoop/libexec/../lib/commons-net-1.4.1.jar:/home/hadoop/hadoop/libexec/../lib/core-3.1.1.jar:/home/hadoop/hadoop/libexec/../lib/hadoop-capacity-scheduler-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/hadoop-fairscheduler-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/hadoop-thriftfs-1.0.3.jar:/home/hadoop/hadoop/libexec/../lib/hbase-0.92.1.jar:/home/hadoop/hadoop/libexec/../lib/hsqldb-1.8.0.10.jar:/home/hadoop/hadoop/libexec/../lib/jackson-core-asl-1.8.8.jar:/home/hadoop/hadoop/libexec/../lib/jackson-mapper-asl-1.8.8.jar:/home/hadoop/hadoop/libexec/../lib/jasper-compiler-5.5.12.jar:/home/hadoop/hadoop/libexec/../lib/jasper-runtime-5.5.12.jar:/home/hadoop/hadoop/libexec/../lib/jdeb-0.8.jar:/home/hadoop/hadoop/libexec/../lib/jersey-core-1.8.jar:/home/hadoop/hadoop/libexec/../lib/jersey-json-1.8.jar:/home/hadoop/hadoop/libexec/../lib/jersey-server-1.8.jar:/home/hadoop/hadoop/libexec/../lib/jets3t-0.6.1.jar:/home/hadoop/hadoop/libexec/../lib/jetty-6.1.26.jar:/home/hadoop/hadoop/libexec/../lib/jetty-util-6.1.26.jar:/home/hadoop/hadoop/libexec/../lib/jsch-0.1.42.jar:/home/hadoop/hadoop/libexec/../lib/junit-4.5.jar:/home/hadoop/hadoop/libexec/../lib/kfs-0.2.2.jar:/home/hadoop/hadoop/libexec/../lib/log4j-1.2.15.jar:/home/hadoop/hadoop/libexec/../lib/mockito-all-1.8.5.jar:/home/hadoop/hadoop/libexec/../lib/oro-2.0.8.jar:/home/hadoop/hadoop/libexec/../lib/servlet-api-2.5-20081211.jar:/home/hadoop/hadoop/libexec/../lib/slf4j-api-1.4.3.jar:/home/hadoop/hadoop/libexec/../lib/slf4j-log4j12-1.4.3.jar:/home/hadoop/hadoop/libexec/../lib/xmlenc-0.52.jar:/home/hadoop/hadoop/libexec/../lib/jsp-2.1/jsp-2.1.jar:/home/hadoop/hadoop/libexec/../lib/jsp-2.1/jsp-api-2.1.jar

12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:java.library.path=/home/hadoop/hadoop/libexec/../lib/native/Linux-amd64-64:/home/hadoop/hbase/lib/native/Linux-amd64-64

12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:java.io.tmpdir=/tmp
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:java.compiler=
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:os.name=Linux
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:os.arch=amd64
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:os.version=2.6.9-89.ELsmp
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:user.name=hadoop
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:user.home=/home/hadoop
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Client
environment:user.dir=/home/hadoop
12/08/22 10:30:44 INFO zookeeper.ZooKeeper: Initiating client
connection, connectString=slave2:2222,slave1:2222,slave3:2222
sessionTimeout=180000 watcher=hconnection
12/08/22 10:30:44 INFO zookeeper.ClientCnxn: Opening socket
connection to server /192.168.15.72:2222
12/08/22 10:30:44 INFO zookeeper.RecoverableZooKeeper: The
identifier of this process is 30654@slave2
12/08/22 10:30:44 WARN client.ZooKeeperSaslClient:
SecurityException: java.lang.SecurityException: 无法定位登录配置 occurred
when trying to find JAAS configuration.
12/08/22 10:30:44 INFO client.ZooKeeperSaslClient: Client will not
SASL-authenticate because the default JAAS configuration section
'Client' could not be found. If you are not using SASL, you may
ignore this. On the other hand, if you expected SASL to work,
please fix your JAAS configuration.
12/08/22 10:30:44 INFO zookeeper.ClientCnxn: Socket connection
established to slave1/192.168.15.72:2222, initiating session
12/08/22 10:30:44 WARN zookeeper.ClientCnxnSocket: Connected to an
old server; r-o mode will be unavailable
12/08/22 10:30:44 INFO zookeeper.ClientCnxn: Session establishment
complete on server slave1/192.168.15.72:2222, sessionid =
0x13943ba912f0007, negotiated timeout = 40000
12/08/22 10:30:44 DEBUG
client.HConnectionManager$HConnectionImplementation: Lookedup root
region location, connection=org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@1c23f1bb;
serverName=slave2,60020,1345461138645
12/08/22 10:30:44 DEBUG
client.HConnectionManager$HConnectionImplementation: Cached
location for .META.,,1.1028785192 is slave3:60020
12/08/22 10:30:44 DEBUG client.MetaScanner: Scanning .META.
starting at row=zzz,,00000000000000 for max=10 rows using org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation@1c23f1bb

12/08/22 10:30:44 DEBUG
client.HConnectionManager$HConnectionImplementation: Cached
location for zzz,,1345602149536.dbeb5fc388bcc537d40b5602b60798ff.
is slave3:60020
12/08/22 10:30:44 INFO mapreduce.TableOutputFormat: Created table
instance for zzz
12/08/22 10:30:44 INFO input.FileInputFormat: Total input paths to
process : 1
12/08/22 10:30:45 INFO mapred.JobClient: Running job:
job_201208201908_0004
12/08/22 10:30:46 INFO mapred.JobClient:  map 0%
reduce 0%
12/08/22 10:31:23 INFO mapred.JobClient: Task Id :
attempt_201208201908_0004_m_000000_0, Status : FAILED
java.io.FileNotFoundException: File
file:/home/hadoop/xyz/part-m-00000 does not exist.
       
at
org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:397)

at
org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:251)

at
org.apache.hadoop.fs.FileSystem.getLength(FileSystem.java:796)

at
org.apache.hadoop.io.SequenceFile$Reader.(SequenceFile.java:1475)

at
org.apache.hadoop.io.SequenceFile$Reader.(SequenceFile.java:1470)

at
org.apache.hadoop.mapreduce.lib.input.SequenceFileRecordReader.initialize(SequenceFileRecordReader.java:50)

at
org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.initialize(MapTask.java:522)

at
org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:763)

at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
       
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
       
at java.security.AccessController.doPrivileged(Native Method)
       
at javax.security.auth.Subject.doAs(Subject.java:396)
       
at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)

at org.apache.hadoop.mapred.Child.main(Child.java:249)

12/08/22 10:31:35 INFO mapred.JobClient:  map
100% reduce 0%
12/08/22 10:31:40 INFO mapred.JobClient: Job complete:
job_201208201908_0004
12/08/22 10:31:40 INFO mapred.JobClient: Counters: 19
12/08/22 10:31:40 INFO
mapred.JobClient:   Job
Counters
12/08/22 10:31:40 INFO
mapred.JobClient:    
SLOTS_MILLIS_MAPS=22927
12/08/22 10:31:40 INFO
mapred.JobClient:    
Total time spent by all reduces waiting after reserving slots
(ms)=0
12/08/22 10:31:40 INFO
mapred.JobClient:    
Total time spent by all maps waiting after reserving slots
(ms)=0
12/08/22 10:31:40 INFO
mapred.JobClient:    
Rack-local map tasks=2
12/08/22 10:31:40 INFO
mapred.JobClient:    
Launched map tasks=2
12/08/22 10:31:40 INFO
mapred.JobClient:    
SLOTS_MILLIS_REDUCES=0
12/08/22 10:31:40 INFO
mapred.JobClient:   File Output
Format Counters
12/08/22 10:31:40 INFO
mapred.JobClient:    
Bytes Written=0
12/08/22 10:31:40 INFO
mapred.JobClient:  
FileSystemCounters
12/08/22 10:31:40 INFO
mapred.JobClient:    
FILE_BYTES_READ=255
12/08/22 10:31:40 INFO
mapred.JobClient:    
HDFS_BYTES_READ=99
12/08/22 10:31:40 INFO
mapred.JobClient:    
FILE_BYTES_WRITTEN=31054
12/08/22 10:31:40 INFO
mapred.JobClient:   File Input
Format Counters
12/08/22 10:31:40 INFO
mapred.JobClient:    
Bytes Read=255
12/08/22 10:31:40 INFO
mapred.JobClient:   Map-Reduce
Framework
12/08/22 10:31:40 INFO
mapred.JobClient:    
Map input records=2
12/08/22 10:31:40 INFO
mapred.JobClient:    
Physical memory (bytes) snapshot=72753152
12/08/22 10:31:40 INFO
mapred.JobClient:    
Spilled Records=0
12/08/22 10:31:40 INFO
mapred.JobClient:    
CPU time spent (ms)=260
12/08/22 10:31:40 INFO
mapred.JobClient:    
Total committed heap usage (bytes)=18350080
12/08/22 10:31:40 INFO
mapred.JobClient:    
Virtual memory (bytes) snapshot=491810816
12/08/22 10:31:40 INFO
mapred.JobClient:    
Map output records=2
12/08/22
10:31:40 INFO
mapred.JobClient:    
SPLIT_RAW_BYTES=99
上述输出中可以看到导入了2条记录,但是仍然会报错,报文件不存在,这就不知道是什么原因了。但是数据是导入进去了。
查看zzz表中的数据

hbase(main):003:0> scan 'zzz'
ROW

                 
COLUMN+CELL

10000               
column=cf1:val, timestamp=1345598242644,
value=china

20000               
column=cf1:val, timestamp=1345598283332, value=zengzhunzhu
                     
n

2 row(s) in 0.0410 seconds
这样基本就完成了hbase表中的数据我们可以转化为mapreduce任务进程开始导出导入。当然也可以这么备份的。

浅谈hbase表中数据导出导入(也就是备份)的更多相关文章

  1. HBase表的数据导出和导入

    1. 表数据导出 hbase org.apache.hadoop.hbase.mapreduce.Export test file:///home/hadoop/test (导入到本地) hbase ...

  2. 用java代码调用shell脚本执行sqoop将hive表中数据导出到mysql

    1:创建shell脚本 touch sqoop_options.sh chmod 777 sqoop_options.sh 编辑文件  特地将执行map的个数设置为变量  测试 可以java代码传参数 ...

  3. DevExpress 表中数据导出

    gridView1.ExportToXlsx("SampleStock.xlsx"); if (true) { DevExpress.XtraEditors.XtraMessage ...

  4. 【uwp】浅谈China Daily中数据同步到One Drive的实现

    新版China Daily与旧版相比新增了数据同步的功能,那这个功能具体是如何实现的呢,现在让我们来一起看看. 1.注册应用 开发者中心的应用注册就不用多说了(https://developer.mi ...

  5. mysql中把一个表的数据批量导入另一个表中

    mysql中把一个表的数据批量导入另一个表中   不管是在网站开发还是在应用程序开发中,我们经常会碰到需要将MySQL或MS SQLServer某个表的数据批量导入到另一个表的情况,甚至有时还需要指定 ...

  6. c#Winform程序调用app.config文件配置数据库连接字符串 SQL Server文章目录 浅谈SQL Server中统计对于查询的影响 有关索引的DMV SQL Server中的执行引擎入门 【译】表变量和临时表的比较 对于表列数据类型选择的一点思考 SQL Server复制入门(一)----复制简介 操作系统中的进程与线程

    c#Winform程序调用app.config文件配置数据库连接字符串 你新建winform项目的时候,会有一个app.config的配置文件,写在里面的<connectionStrings n ...

  7. mapreduce 只使用Mapper往多个hbase表中写数据

    只使用Mapper不使用reduce会大大减少mapreduce程序的运行时间. 有时候程序会往多张hbase表写数据. 所以有如题的需求. 下面给出的代码,不是可以运行的代码,只是展示driver中 ...

  8. hbase使用MapReduce操作4(实现将 HDFS 中的数据写入到 HBase 表中)

    实现将 HDFS 中的数据写入到 HBase 表中 Runner类 package com.yjsj.hbase_mr2; import com.yjsj.hbase_mr2.ReadFruitFro ...

  9. 【HBase】通过Bulkload批量加载数据到Hbase表中

    目录 需求 步骤 一.开发MapReduce 二.打成Jar包放到linux执行 三.有两种办法将HFile文件加载到HBase表中 开发代码 Hadoop命令运行 需求 将hdfs上面的这个路径 / ...

随机推荐

  1. mysql批量插入之提高插入效率

    INSERT INTO insert_table (datetime, uid, content, type) VALUES ('0', 'userid_0', 'content_0', 0); IN ...

  2. 在.Net MVC中自定义ValidationAttribute标签对Model中的属性做验证

    写一个继承与ValidationAttribute类的自定义的验证方法 MVC中传递数据时,大多数都会用Model承载数据,并且在传到控制器后,对Model进行一系列的验证. 我平时经常使用的判断方法 ...

  3. List集合对象中的排序,随机显示

    List<User> students = new ArrayList<User>(); User user1 = new User(); user1.setAge(112); ...

  4. innodb更改行格式,系统盘占用急剧升高

    #大表引擎修改后,数据量较myisam引擎表大很多,对存储的行格式修改后,数据量减小. #备库修改时,由于服务器时间较早,系统盘20G,突然收到/磁盘空间占比89%的报警,立即将修改中断,恢复正常 # ...

  5. ftp服务器端的安装及配置

    搭建过程 安装 vsftp 服务(yum 安装即可) 配置/etc/vsftpd/vsftpd.conf   anonymous_enable=NO #禁止匿名登录 local_enable=YES ...

  6. java 中递归的实现 以及利用递归方法实现汉诺塔

    今天说下java语言中比较常见的一种方法,递归方法. 递归的定义 简单来说递归的方法就是"自己调用自己",通过递归方法往往可以将一个大问题简单化,最终压缩到一个易于处理的程度.对于 ...

  7. 项目管理-SVN服务器的搭建

    Subversion是优秀的版本控制工具,其具体的的优点和详细介绍,这里就不再多说. 首先来下载和搭建SVN服务器. 现在Subversion已经迁移到apache网站上了,下载地址: http:// ...

  8. ZZNU 1992: 情人节的尴尬

    题目描述 情人节这不刚过去没多久吗,我得给大家爆个料.这个事关于小飞飞的,小飞飞呢,要给她女票买礼物,但是呢有个比较尴尬的事情,小飞飞有些钱在某宝里,有些钱在某东里,众所周知,这俩可是死对头,想相互转 ...

  9. mybatis 主键UUID生成策略

    <insert id="insert" parameterType="com.lsfwpt.lawmis.po.SysUser"> <sele ...

  10. 数据库及SQL优化

    一.数据库结构的设计 如果不能设计一个合理的数据库模型,不仅会增加客户端和服务器段程序的编程和维护的难度,而且将会影响系统实际运行的性能.所以,在一个系统开始实施之前,完备的数据库模型的设计是必须的. ...