HBASE 单机部署

下载页面:

https://www.apache.org/dyn/closer.lua/hbase/2.2.5/hbase-2.2.5-bin.tar.gz

下载

https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/2.2.5/hbase-2.2.5-bin.tar.gz

添加变量

vim /etc/profile
# 添加
# hbase
export PATH=$PATH:/usr/local/hbase-2.2.5/bin

切换目录

/usr/local/hbase-2.2.5

直接启动试试:

[root@hadoop logs]# start-hbase.sh 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hadoop-3.2.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hbase-2.2.5/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
running master, logging to /usr/local/hbase-2.2.5/bin/../logs/hbase-root-master-hadoop.out
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hadoop-3.2.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hbase-2.2.5/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
[root@hadoop logs]# 

jps 没有任何HBASE的进程 好吧,看下日志

2020-06-26 16:28:36,935 INFO  [Thread-2] server.NIOServerCnxn: Stat command output
2020-06-26 16:28:36,936 INFO  [Thread-2] server.NIOServerCnxn: Closed socket connection for client /127.0.0.1:57168 (no session established for client)
2020-06-26 16:28:36,936 INFO  [main] zookeeper.MiniZooKeeperCluster: Started MiniZooKeeperCluster and ran successful 'stat' on client port=2182
2020-06-26 16:28:36,937 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:217)
	at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:140)
	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
	at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:149)
	at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:2945)

借鉴于此

zk运行的端口应该是2182而不是默认的2181
解决:

vim conf/hbase-site.xml
# 插入以下内容
<property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2182</value>
</property>

在重启下

stop-hbase.sh
start-hbase.sh

检查下

[root@hadoop conf]# jps
25680 SecondaryNameNode
25473 DataNode
26099 NodeManager
25048 QuorumPeerMain
25946 ResourceManager
29133 HMaster
29325 Jps
# 嗯 还不错起来一个hmaster

这段搞了一下午 改了好他妈多的东西,最终总结的配置文件是这样子:

# hbase-env.sh 文件加入
export JAVA_HOME=/usr/local/java
export HBASE_MANAGES_ZK=false
export HBASE_CLASSPATH=/usr/local/hbase/conf
# hbase-site.xml 文件加入
<configuration>
<property>
           <name>hbase.master</name>
            <!-- Hadoop主节点地址及端口 -->
           <value>hadoop:6000</value>
   </property>
   <property>
           <name>hbase.master.maxclockskew</name>
           <value>180000</value>
   </property>
   <property>
           <name>hbase.rootdir</name>
            <!-- Hadoop连接地址及端口 -->
           <value>hdfs://hadoop:9000/hbase</value>
   </property>
   <property>
           <name>hbase.cluster.distributed</name>
           <value>true</value>
   </property>
   <property>
           <name>hbase.zookeeper.quorum</name>
           <!-- zookeeper主机名,此处是在hosts中添加的解析 -->
           <value>hadoop</value>
   </property>
   <property>
           <name>hbase.zookeeper.property.dataDir</name>
           <value>/data/zookeeper</value>
   </property>
   <property>
           <name>dfs.replication</name>
           <value>1</value>
   </property>
<property>
<name>hbase.master.info.port</name>
<value>60010</value>
</property>
<property>
    <name>zookeeper.session.timeout</name>
    <value>300000</value>
   <!--默认: 180000 :zookeeper 会话超时时间,单位是毫秒 -->
</property>
<property>
  <name>hbase.unsafe.stream.capability.enforce</name>
  <value>false</value>
</property>
</configuration>
# regionservers文件内容(Hadoop是添加在hosts解析中的主机名)
hadoop

启动,访问60010端口检查

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章