hbase 2.2.3 ZooKeeper cluster setup on linux

2023-11-11 11:19:23 浏览数 (1)

1. before start

follow all steps in hadoop-3.1.3 cluster setup on linux

and then switch to root user:

代码语言:shell复制
su

2. cp zookeeper,hbase and extract

代码语言:shell复制
tar -xzvf /opt/software/apache-zookeeper-3.5.7-bin.tar.gz -C /opt/module
tar -xzvf /opt/software/hbase-2.2.3-bin.tar.gz -C /opt/module

3. setup zookeeper

3.1 config zookeeper

代码语言:shell复制
mkdir /opt/data/zookeeper
cd /opt/module/apache-zookeeper-3.5.7-bin/conf
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg

sure that the values are like the following contents:

代码语言:txt复制
tickTime=2000
dataDir=/opt/data/zookeeper
clientPort=2181
maxClientCnxns=60
initLimit=10
syncLimit=5
server.1=master:2888:3888
server.2=slave1:2888:3888

cp zookeeper to slave1:

代码语言:shell复制
scp -r /opt/module/apache-zookeeper-3.5.7-bin slave1:/opt/module

3.2 start server

代码语言:shell复制
cd /opt/module/apache-zookeeper-3.5.7-bin
bin/zkServer.sh start

use jps to check QuorumPeerMain

  • todo: fail to start server.2

3.3 connect to server

代码语言:shell复制
bin/zkCli.sh -server master:2181

try simple cmds in zkshell:

代码语言:shell复制
ls /
create /zk_test my_data
ls /
get /zk_test
set /zk_test junk
get /zk_test
delete /zk_test
ls /
# for more details: https://hbase.apache.org/book.html#_using_existing_zookeeper_ensemble

use quit to exit.

3.4 stop server

代码语言:shell复制
cd /opt/module/apache-zookeeper-3.5.7-bin
bin/zkServer.sh stop

3.5 other ops: config systemd

flollow tutorials: creating-and-using-a-systemd-unit-file

4. setup hbase

4.1 add bin to path

代码语言:shell复制
vi /etc/profile
# add: 
# export HBASE_HOME="/opt/module/hbase-2.2.3"
# export PATH=$PATH:/opt/module/hbase-2.2.3/bin
source /etc/profile

4.2 config env

代码语言:shell复制
cd /opt/module/hbase-2.2.3/conf
vi hbase-env.sh
# add: 
export JAVA_HOME="/opt/module/jdk8u392-b08"
export HBASE_MANAGES_ZK=false

4.3 config property

代码语言:shell复制
vi hbase-site.xml

add properties:

代码语言:html复制
<configuration>
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://master:9000/hbase</value>
    </property>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <name>hbase.unsafe.stream.capability.enforce</name>
        <value>false</value>
    </property>
    <property>
        <name>hbase.zookeeper.quorum</name>
        <value>master,slave1</value>
    </property>
</configuration>

4.4 config regionservers

代码语言:shell复制
vi regionservers

add master and slave1

more details, view https://hbase.apache.org/book.html#fully_dist

5. test hbase

代码语言:shell复制
hbase version

if all passed, transfer to slave1:

代码语言:shell复制
scp -r /opt/module/hbase-2.2.3 slave1:/opt/module

6. start hbase

代码语言:shell复制
#start hdfs:
$HADOOP_HOME/sbin/start-dfs.sh
# start zookeeper:
cd /opt/module/apache-zookeeper-3.5.7-bin
bin/zkServer.sh start

use jps to check datanodes and quorum

代码语言:shell复制
# start hbase:
start-hbase.sh

use jps to check HMaster and HRegionServer

代码语言:shell复制
local-master-backup.sh start 2
local-regionservers.sh start 2

7. use shell

to start shell:

代码语言:shell复制
hbase shell

check namespace cmds:

代码语言:txt复制
list_namespace
# optional cmds:
Create_namespace 'test1'
describe_namespace 'test1'
  • todo: use hbase manages zk

8. more information

HBase Web UI: http://master:16010

download archive version of pkgs, view http://archive.apache.org/dist/spark/

for more information, view

https://zookeeper.apache.org/doc/r3.4.13/zookeeperStarted.html

https://hbase.apache.org/book.html#fully_dist

https://hbase.apache.org/book.html#quickstart_fully_distributed

https://hbase.apache.org/book.html#_using_existing_zookeeper_ensemble

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-an-apache-zookeeper-cluster-on-ubuntu-18-04

https://www.tutorialspoint.com/hbase/hbase_installation.htm

0 人点赞