今天在配置hbase+zookeeper时遇到了问题,使用list和create语句时没有问题,但是使用put语句一直报错:
put ‘students’, ‘stud003’, ‘info:name’, ‘Tom’
2019-03-09 13:39:08,238 ERROR [main] client.AsyncProcess: Failed to get region location
org.apache.hadoop.hbase.client.NoServerForRegionException: No server address listed in hbase:meta for region students,1552108739539.23f6a3aed5b74cc07c3544bca5df5c71. containing row stud003
。
。
。
我之前搭建zookeeper时使用了4台机器,所以hbase中也是配置了四台,配置完zookeeper时也没有全部检查,后来使用zkServer status 查看zookeeper状态后发现有一台机器没有连接到集群上。
Using config: /root/training/zookeeper-3.4.10/bin/…/conf/zoo.cfg
Error contacting service. It is probably not running.
索性改为使用奇数台配置。
更改完成后就能正常put了。
hbase(main):002:0> put ‘students’,‘stu001’,‘info:age’,‘28’
0 row(s) in 0.1890 seconds
hbase(main):003:0> list
TABLE
students
1 row(s) in 0.0070 seconds
=> [“students”]
hbase(main):004:0> scan ‘students’
ROW COLUMN+CELL
stu001 column=info:age, timestamp=1552113209322, value=28
1 row(s) in 0.0290 seconds