传智播客旗下技术交流社区北京校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

环境:hadoop  2.6.5
           habse    1.2.6.1  ----测试为单机伪分布式部署
           redhat 6.4 64bit

1.配置文件



  • <HBASE_HOME>/conf/hbase-env.sh



  •   export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64



  •   ----这里使用的是hbase自带的zookeeper,可单独启动bin/hbase-daemon.sh start zookeepe



  •   export HBASE_MANAGES_ZK=true  




  • <HBASE_HOME>/conf/hbase-site.xml



  •   <property>



  •     <name>hbase.rootdir</name>



  •     <value>hdfs://localhost:9000/hbase</value>



  •   </property>







  •   <property>



  •      <name>hbase.cluster.distributed</name>



  •      <value>true</value>



  •   </property>







  •   <property>



  •      <name>hbase.zookeeper.quorum</name>



  •      <value>localhost</value>



  •   </property>







  •   <property>



  •     <name>hbase.zookeeper.property.dataDir</name>



  •     <value>/hbase/zoodata</value>



  •   </property>




  • <HBASE_HOME>/conf/regionservers ---类似<HADOOP_HOME>/etc/hadoop/slaves文件:



  • localhost


2.bin/start-hbase.shq启动后,HMaster和HRegionServer进程一会便消失
    [root@rhel64-64bit bin]# jps
    17507 HRegionServer
    6952 SecondaryNameNode
    17193 HQuorumPeer  ----hbase自带的zookeeper
    17276 HMaster
    6669 NameNode
    6765 DataNode
    26398 Jps

查看habse的日志:



  • <HBASE_HOME>/logs/hbase-root-master-rhel64-64bit.out



  • Caused by: java.io.IOException: Problem binding to /221.179.46.190:16000 : Cannot assign requested address. To switch ports use the 'hbase.master.port' configuration property.



  •         at org.apache.hadoop.hbase.regionserver.RSRpcServices.<init>(RSRpcServices.java:938)



  •         at org.apache.hadoop.hbase.master.MasterRpcServices.<init>(MasterRpcServices.java:231)



  •         at org.apache.hadoop.hbase.master.HMaster.createRpcServices(HMaster.java:572)



  •         at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:531)



  •         at org.apache.hadoop.hbase.master.HMaster.<init>(HMaster.java:412)



  •         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)



  •         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)



  •         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)



  •         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)



  •         at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:2505)



  •         ... 5 more



  • Caused by: java.net.BindException: Cannot assign requested address



  •         at sun.nio.ch.Net.bind0(Native Method)



  •         at sun.nio.ch.Net.bind(Net.java:433)



  •         at sun.nio.ch.Net.bind(Net.java:425)



  •         at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)







  • <HBASE_HOME>/logs/hbase-root-regionserver-rhel64-64bit.log:



  • aused by: java.io.IOException: Problem binding to /221.179.46.190:16020 : Cannot assign requested address. To switch ports use the 'hbase.regionserver.port' configuration property.



  •         at org.apache.hadoop.hbase.regionserver.RSRpcServices.<init>(RSRpcServices.java:938)



  •         at org.apache.hadoop.hbase.regionserver.HRegionServer.createRpcServices(HRegionServer.java:647)



  •         at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:531)



  •         ... 10 more



  • Caused by: java.net.BindException: Cannot assign requested address



  •         at sun.nio.ch.Net.bind0(Native Method)


上面的221.179.46.190是本地hostname的地址,原来如果配置文件中没有指定任何地址的话,hbase启动bind本机的hostname的ip:
也由上面报错看到:
master需要2个端口,默认16000 和 16010(web)端口
regionserver也需要2个端口,默认16020和16030(web)端口
      
[root@rhel64-64bit hadoop-2.6.5]# nslookup rhel64-64bit
Name:    rhel64-64bit
Address: 221.179.46.190

在/etc/hosts文件中正确解析hostname: rhel64-64bit即可

3.打开hbase的shell有以下警告:
---------------------------------------
[root@rhel64-64bit bin]# ./hbase shell
2018-07-16 18:35:40,798 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.6.1, rUnknown, Sun Jun  3 23:19:26 CDT 2018

hbase(main):001:0>
---------------------------------------

参考:
http://hbase.apache.org/book.html#hadoop.native.lib



  • 检查:



  • [root@rhel64-64bit hbase-1.2.6.1]# ./bin/hbase --config ./conf  org.apache.hadoop.util.NativeLibraryChecker



  • 2018-07-16 18:54:18,997 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable



  • Native library checking:



  • hadoop: false



  • zlib:   false



  • snappy: false



  • lz4:    false



  • bzip2:  false



  • 2018-07-16 18:54:19,119 INFO  [main] util.ExitUtil: Exiting with status 1


解决办法:
1》<HBASE_HOME>/conf/hbase-env.sh配置:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native
export HBASE_LIBRARY_PATH=$HBASE_LIBRARY_PATH:$HBASE_HOME/lib/native/Linux-amd64-64/
或者 2》
$ mkdir -p ~/hbaseLinux-amd64-64 -> /home/stack/hadoop/lib/native/lib/native/
$ cd ~/hbase/lib/native/
$ ln -s ~/hadoop/lib/native Linux-amd64-64
$ ls -la
# Linux-amd64-64 -> /home/USER/hadoop/lib/native



  • 重新检查:



  • [root@rhel64-64bit hbase-1.2.6.1]# ./bin/hbase --config ./conf  org.apache.hadoop.util.NativeLibraryChecker



  • 2018-07-16 19:02:43,533 WARN  [main] bzip2.Bzip2Factory: Failed to load/initialize native-bzip2 library system-native, will use pure-Java version



  • 2018-07-16 19:02:43,543 INFO  [main] zlib.ZlibFactory: Successfully loaded & initialized native-zlib library



  • Native library checking:



  • hadoop: true /hbase/hbase-1.2.6.1/lib/native/Linux-amd64-64/libhadoop.so.1.0.0



  • zlib:   true /lib64/libz.so.1



  • snappy: false



  • lz4:    true revision:99




分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马
关闭

站长推荐 上一条 /5 下一条