2 qq513536189 qq513536189 于 2017.01.06 15:05 提问

hbase启动几十秒后,HMaster和HRegionserver自动关闭

master的vim /etc/hostname配置如下

master

master的vim /etc/sysconfig/network配置如下:

# Created by anaconda
NETWORKING=yes
HOSTNAME=master

/etc/hosts配置如下:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.241.235 master
192.168.241.236 slave1
192.168.241.237 slave2
192.168.241.238 slave3

/etc/profile 增加的配置如下:

78 export JAVA_HOME=/usr/java/jdk1.8.0_112
79 export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
80 export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
81
82 export HADOOP_HOME=/root/Hadoop/hadoop-2.7.3
83 export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
84
85 export HBASE_HOME=/root/Hbase/hbase-1.2.4
86 export PATH=$PATH:$HBASE_HOME/bin

regionserver配置如下:

master
slave1
slave2
slave3

hbase-env.sh配置如下:

export JAVA_HOME=/usr/java/jdk1.8.0_112
export HBASE_CLASSPATH=/root/Hadoop/hadoop-2.7.3/etc/hadoop
export HBASE_OPTS="-XX:+UseConcMarkSweepGC"
export HBASE_MANAGES_ZK=true

hbase-site.xml配置如下:

  <configuration>
          <property>
                  <name>hbase.rootdir</name>
                  <value>hdfs://master:9000/hbase</value>
                  <description>hadoop集群地址</description>
          </property>
          <property>
                  <name>hbase.cluster.distributed</name>
                  <value>true</value>
                  <description>是否启动集群模式</description>
          </property>
          <property>
                  <name>hbase.tmp.dir</name>
                  <value>/root/Hbase/hbase-1.2.4/tmp</value>
          </property>
          <property>
                  <name>hbase.master</name> #指定hbase集群主控节点
                  <value>master:60000</value>
          </property>
          <property>
                  <name>hbase.zookeeper.quorum</name>
                  <value>slave1,slave2,slave3</value>
                  <description>zookeeper集群主机名列表</description>
          </property>
          <property>
                  <name>hbase.master.maxclockskew</name>
                  <value>180000</value>
                  <description>Time difference of regionserver from master</description>
          </property>
          <property>
                  <name>hbase.zookeeper.property.dataDir</name>
                  <value>/root/Hbase/hbase-1.2.4/zookeeper_data</value>
          </property>
  </configuration>

logs/hbase-root-master-master部分内容如下:

 2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:java.library.path=/root/Hadoop/hadoop-2.7.3/lib/native
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:os.name=Linux
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:os.arch=amd64
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:os.version=3.10.0-514.el7.x86_64
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:user.name=root
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:user.home=/root
2017-01-06 14:35:21,969 INFO  [main] zookeeper.ZooKeeper: Client environment:user.dir=/root/Hbase/hbase-1.2.4/logs
2017-01-06 14:35:21,971 INFO  [main] zookeeper.ZooKeeper: Initiating client connection, connectString=slave1:2181,slave2:2181,slave3:2181 sessionTimeout=90000 watcher=master:160000x0, quorum=slave1:2181,slave2:2181,slave3:2181, baseZNode=/hbase
2017-01-06 14:35:22,048 INFO  [main-SendThread(slave2:2181)] zookeeper.ClientCnxn: Opening socket connection to server slave2/192.168.241.237:2181. Will not attempt to authenticate using SASL (unknown error)
2017-01-06 14:35:22,080 WARN  [main-SendThread(slave2:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.NoRouteToHostException: No route to host
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2017-01-06 14:35:22,230 INFO  [main-SendThread(slave1:2181)] zookeeper.ClientCnxn: Opening socket connection to server slave1/192.168.241.236:2181. Will not attempt to authenticate using SASL (unknown error)
2017-01-06 14:35:23,239 WARN  [main-SendThread(slave1:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.NoRouteToHostException: No route to host
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2017-01-06 14:35:23,341 INFO  [main-SendThread(slave3:2181)] zookeeper.ClientCnxn: Opening socket connection to server slave3/192.168.241.238:2181. Will not attempt to authenticate using SASL (unknown error)
2017-01-06 14:35:23,342 WARN  [main-SendThread(slave3:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.NoRouteToHostException: No route to host
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
    ......此处省略N次重复
    Caused by: org.apache.hadoop.hbase.ZooKeeperConnectionException: master:160000x0, quorum=slave1:2181,slave2:2181,slave3:2181, baseZNode=/hbase Unexpected KeeperException creating base node
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.createBaseZNodes(ZooKeeperWatcher.java:206)
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(ZooKeeperWatcher.java:187)
    at org.apache.hadoop.hbase.regionserver.HRegionServer.<init>(HRegionServer.java:585)
    at org.apache.hadoop.hbase.master.HMaster.<init>(HMaster.java:381)
    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:2419)
    ... 5 more
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
    at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
    at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.createNonSequential(RecoverableZooKeeper.java:565)
    at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.create(RecoverableZooKeeper.java:544)
    at org.apache.hadoop.hbase.zookeeper.ZKUtil.createWithParents(ZKUtil.java:1204)
    at org.apache.hadoop.hbase.zookeeper.ZKUtil.createWithParents(ZKUtil.java:1182)
    at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.createBaseZNodes(ZooKeeperWatcher.java:194)
    ... 13 more
2017-01-06 14:35:39,329 WARN  [main-SendThread(slave1:2181)] zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.NoRouteToHostException: No route to host
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)

1个回答

qq513536189
qq513536189   2017.01.10 09:05
已采纳

自问自答:
原因是防火墙没有关闭,我用的是CentOS7,iptables service stop命令在CentOS7上不适用,应改成sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。所以你只要停止firewalld服务即可:sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

如果你要改用iptables的话,需要安装iptables服务:
sudo yum install iptables-services
sudo systemctl enable iptables && sudo systemctl enable ip6tables
sudo systemctl start iptables && sudo systemctl start ip6tables

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!