标签:linux base st表 env 测试 目录 电脑 域名 tar
# su hadoop
$ tar -zxvf hbase-${version} -C /opt/hadoop
$ ln -s hbase-${version}/ hbase
export JAVA_HOME=/opt/java
export HBASE_PID_DIR=/opt/hadoop/hadoop/pids
export HADOOP_HOME=/opt/hadoop/hadoop
export HBASE_HOME=/opt/hadoop/hbase
添加下面内容
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://baseline01:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>baseline01,baseline02,baseline03</value>
</property>
</configuration>
baseline02
baseline03
$ scp -r /opt/hadoop/hbase-${version} hadoop@baseline02:/opt/hadoop
$ ln -s hbase-${version}/ hbase
$ scp -r /opt/hadoop/hbase-${version} hadoop@baseline03:/opt/hadoop
$ ln -s hbase-${version}/ hbase
6.在baseline01上启动hbase集群:
$ /opt/hadoop/hbase/bin/start-hbase.sh
若baseline01如下所示:
$ jps
22898 ResourceManager
20739 Jps
24383 JobHistoryServer
20286 HMaster
22722 SecondaryNameNode
22488 NameNode
若baseline02和baseline03如下所示:
2141 NodeManager
3257 HRegionServer
25283 Jps
1841 DataNode
显示有HMaster和HRegionServer,则说明启动成功
a.创建表test:
hbase(main):002:0> create "test", "cf"
0 row(s) in 2.5840 seconds
=> Hbase::Table - test
b.列出全部表:
hbase(main):003:0> list
TABLE
test
1 row(s) in 0.0310 seconds
=> ["test"]
c.插入数据到test表:
hbase(main):001:0> put "test","row","cf:a","value"
0 row(s) in 0.4150 seconds
d.查看test表信息:
hbase(main):002:0> scan ‘test‘
ROW COLUMN+CELL
row column=cf:a, timestamp=1447246157917, value=value
1 row(s) in 0.0270 seconds
若hbase shell测试成功,则进入浏览器访问以下网址:
http://baseline01:16010/,若正常显示,则hbase集群安装成功! 用ip保险一点,用域名首先要在自己的电脑host文件中配置。
$ nohup /opt/hadoop/hbase/bin/hbase-daemon.sh start thrift2 &
标签:linux base st表 env 测试 目录 电脑 域名 tar
原文地址:http://www.cnblogs.com/wyl9527/p/6395385.html