After starting zookeeper, I started HDFS, and finally started Hbase. I found that HMaster process was not displayed in JPS process, as follows:
[hadoop@hadoop000 bin]$ jps
3936 NameNode
4241 SecondaryNameNode
6561 Jps
4041 DataNode
3418 QuorumPeerMain
Then. / hbase shell finds the following error:
This is my previous hbase-site.xml configuration file:
In addition, the export HBASE_MANAGES_ZK=true setting in my hbase-env.sh has been changed to false, and the java path has been set correctly. Below is zoo.cfg in zookeeper:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/hadoop/app/tmp/zk
# the port at which the clients will connect
clientPort=2181
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
Find out why, then look at the log file in hbase/log and find this error message:
2017-11-17 12:01:24,469 INFO [main] server.ZooKeeperServer: Server environment:user.dir=/home/hadoop/app/hbase-1.2.0-cdh5.7.0/bin
2017-11-17 12:01:24,477 INFO [main] server.ZooKeeperServer: Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir /tmp/hbase-hadoop/zookeeper/zookeeper_0/version-2 snapdir /tmp/hbase-hadoop/zookeeper/zookeeper_0/version-2
2017-11-17 12:01:24,485 INFO [main] server.NIOServerCnxnFactory: binding to port 0.0.0.0/0.0.0.0:2181
2017-11-17 12:01:24,486 INFO [main] server.NIOServerCnxnFactory: binding to port 0.0.0.0/0.0.0.0:2182
2017-11-17 12:01:24,490 INFO [main] persistence.FileSnap: Reading snapshot /tmp/hbase-hadoop/zookeeper/zookeeper_0/version-2/snapshot.96
2017-11-17 12:01:24,501 INFO [main] persistence.FileTxnSnapLog: Snapshotting: 0x96 to /tmp/hbase-hadoop/zookeeper/zookeeper_0/version-2/snapshot.96
2017-11-17 12:01:24,558 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2182] server.NIOServerCnxnFactory: Accepted socket connection from /127.0.0.1:57611
2017-11-17 12:01:24,562 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2182] server.NIOServerCnxn: Processing stat command from /127.0.0.1:57611
2017-11-17 12:01:24,564 INFO [Thread-2] server.NIOServerCnxn: Stat command output
2017-11-17 12:01:24,564 INFO [main] zookeeper.MiniZooKeeperCluster: Started MiniZooKeeperCluster and ran successful 'stat' on client port=2182
2017-11-17 12:01:24,565 ERROR [main] master.HMasterCommandLine: Master exiting
java.io.IOException: Could not start ZK at requested port of 2181. ZK was started at port: 2182. Aborting as clients (e.g. shell) will not be able to find this ZK quorum.
at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:213)
at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:138)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:126)
at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2446)
2017-11-17 12:01:24,566 INFO [Thread-2] server.NIOServerCnxn: Closed socket connection for client /127.0.0.1:57611 (no session established for client)
Since the previous zookeeper has occupied 2181 ports, I dare not kill this process, but the hint is that HBase needs to start on this port. I began to think that HBase opened its own zookeeper conflicts with my external zookeeper. I also found many ways on the Internet, changed various hbase-site.xml configuration files, but still can not, ZK was started at port: 2182. Following this prompt, I finally changed port 2181 in hbase-site.xml to 2182 and successfully started the HMaster process. The. / hbase shell command works as well. The results are as follows: