Pseudo-distributed mode means that HBase still runs completely on a single host, but each HBase daemon (HMaster, HRegionServer, and ZooKeeper) runs as a separate process
Prepare HDFS and permission of directory
hadoop@45883500b170:~/hadoop-2.7.3$ bin/hdfs dfs -mkdir /user/hbase hadoop@45883500b170:~/hadoop-2.7.3/bin$ ./hdfs dfs -chown -R hbase:hbase /user/hbase hadoop@45883500b170:~/hadoop-2.7.3/bin$ ./hdfs dfs -ls /user Found 2 items drwxr-xr-x - hadoop supergroup 0 2016-08-28 12:27 /user/hadoop drwxr-xr-x - hbase hbase 0 2016-08-29 06:20 /user/hbase
Re-configuration HBase
hbase-site.xml:
<configuration> <property> <name>hbase.rootdir</name> <!-- value>file:///home/hbase/hbase-1.2.2</value --> <value>hdfs://localhost:9000/user/hbase</value> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/home/hbase/zookeeper</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> </configuration>
hbase-env.sh:
...
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
...
SSH bypass a passphrase
hbase@45883500b170:~/hbase-1.2.2/bin$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa Generating public/private rsa key pair. Your identification has been saved in /home/hbase/.ssh/id_rsa. Your public key has been saved in /home/hbase/.ssh/id_rsa.pub. The key fingerprint is: 57:57:7d:53:3d:54:3e:c5:fe:ef:58:db:1e:07:c1:51 hbase@45883500b170 The key's randomart image is: +--[ RSA 2048]----+ | o+E| | . **| | . +o=| | . . .o| | S . . .| | . ..| | .+| | o*| | .++| +-----------------+ hbase@45883500b170:~/hbase-1.2.2/bin$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys hbase@45883500b170:~/hbase-1.2.2/bin$ chmod 0600 ~/.ssh/authorized_keys
Starting up HBase
hbase@45883500b170:~/hbase-1.2.2/bin$ ./start-hbase.sh localhost: starting zookeeper, logging to /home/hbase/hbase-1.2.2/bin/../logs/hbase-hbase-zookeeper-45883500b170.out starting master, logging to /home/hbase/hbase-1.2.2/bin/../logs/hbase--master-45883500b170.out Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0 starting regionserver, logging to /home/hbase/hbase-1.2.2/bin/../logs/hbase--1-regionserver-45883500b170.out
Whiling start up HBase it creates required files and directory in HDFS as below
Open and Hadoop Web Interface
Testing
hbase@45883500b170:~/hbase-1.2.2/bin$ ./hbase shell 2016-08-29 06:47:10,665 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable HBase Shell; enter 'help<RETURN>' for list of supported commands. Type "exit<RETURN>" to leave the HBase Shell Version 1.2.2, r3f671c1ead70d249ea4598f1bbcc5151322b3a13, Fri Jul 1 08:28:55 CDT 2016 hbase(main):001:0> create 'test', 'cf' 0 row(s) in 4.8240 seconds => Hbase::Table - test hbase(main):002:0> list 'test' TABLE test 1 row(s) in 0.0280 seconds => ["test"] hbase(main):003:0> put 'test', 'row1', 'cf:a', 'value1' 0 row(s) in 0.1310 seconds hbase(main):004:0> put 'test', 'row2', 'cf:b', 'value2' 0 row(s) in 0.0200 seconds hbase(main):005:0> put 'test', 'row3', 'cf:c', 'value3' 0 row(s) in 0.0150 seconds hbase(main):006:0> scan 'test' ROW COLUMN+CELL row1 column=cf:a, timestamp=1472453260190, value=value1 row2 column=cf:b, timestamp=1472453264719, value=value2 row3 column=cf:c, timestamp=1472453270502, value=value3 3 row(s) in 0.0350 seconds hbase(main):007:0> get 'test', 'row1' COLUMN CELL cf:a timestamp=1472453260190, value=value1 1 row(s) in 0.0350 seconds hbase(main):008:0> exit
No comments:
Post a Comment