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端口檢查

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