基于 Hadoop 集群的 zookeeper 与 Hbase 集群搭建

一世执手 提交于 2019-12-22 20:17:54

一、软件版本与系统环境

①HBase,1.2.0, 下载链接

②ZooKeeper,3.4.5,下载链接

二、zookeeper 安装

1、xftp上传zookeeper压缩包并解压
cd /opt/soft
ls
tar -zxvf zookeeper-3.4.5-cdh5.14.2.tar.gz 
mv zookeeper-3.4.5-cdh5.14.2 zooker345
2、进入解压好的安装包 在conf文件夹下配置环境
cd zookeeper345/
cd conf
ls
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg 

修改存储数据路径、添加zookeeper交换数据端口已经选举端口

dataDir=/opt/soft/zookeeper345/data
server.1=192.168.56.122:2287:3387

添加存储文件夹

[root@hw1 zookeeper345]# mkdir data
3、配置环境变量
[root@hw1 conf]# cd ..
[root@hw1 zookeeper345]# pwd
/opt/soft/zookeeper345
[root@hw1 zookeeper345]# vi /etc/profile

export ZOOKEEPER_HOME=/opt/soft/zookeeper345
export PATH=$PATH:$ZOOKEEPER_HOME/bin

刷新环境变量

source /etc/profile
4、启动zookeeper
[root@hw1 zookeeper345]# cd bin
[root@hw1 bin]# ls
README.txt    zkCli.cmd  zkEnv.cmd  zkServer.cmd            zkServer.sh
zkCleanup.sh  zkCli.sh   zkEnv.sh   zkServer-initialize.sh
[root@hw1 bin]# zkServer.sh start

三、Hbase集群搭建

1、xftp上传Hbase压缩包并解压
cd /opt/soft
tar -zxvf hbase-1.2.0-cdh5.14.2.tar.gz
mv hbase-1.2.0-cdh5.14.2 hbase120
2、环境变量配置
[root@hw1 soft]# cd hbase120/
[root@hw1 hbase120]# ls
bin                hbase-client               hbase-protocol         hbase-webapps
CHANGES.txt        hbase-common               hbase-resource-bundle  LEGAL
cloudera           hbase-examples             hbase-rest             lib
conf               hbase-external-blockcache  hbase-rsgroup          LICENSE.txt
dev-support        hbase-hadoop2-compat       hbase-server           logs
docs               hbase-hadoop-compat        hbase-shaded           NOTICE.txt
hbase-annotations  hbase-it                   hbase-shell            pom.xml
hbase-assembly     hbase-prefix-tree          hbase-testing-util     README.txt
hbase-checkstyle   hbase-procedure            hbase-thrift           src
[root@hw1 hbase120]# cd conf
// 查询 jdk 位置
[root@hw1 conf]# echo $JAVA_HOME
/opt/soft/jdk180
[root@hw1 conf]# vi hbase-env.sh

# The java implementation to use.  Java 1.7+ required.
export JAVA_HOME=/opt/soft/jdk180
 
 # Tell HBase whether it should manage it's own instance of Zookeeper or not.
export HBASE_MANAGES_ZK=false

<!—hbase.rootdir 将数据写入哪个目录 如果是单机版只要配置此属性就可以,value中file:/绝对路径,如果是分布式则配置与hadoop的core-site.sh服务器、端口以及zookeeper中事先创建的目录一致–>

[root@hw1 conf]# vi hbase-site.xml 
<property>
        <name>hbase.rootdir</name>
        <value>hdfs://192.168.56.122:9000/hbase</value>
</property>
<!—单机模式不需要配置,分布式配置此项为true-->
<property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
</property>
<!—单机模式不需要配置 分布是配置此项为zookeeper指定的物理路径名-- >
<property>
        <name>hbase.zookeeper.quorum</name>
        <value>hw1:2181,hw2:2181,hw3:2181</value>
</property>

配置 profilre

[root@hw1 conf]# vi /etc/profile
export HBASE_HOME=/opt/soft/hbase120
export PATH=$PATH:$HBASE_HOME/bin

[root@hw1 conf]# source /etc/profile
3、启动Hbase
[root@hw1 conf]# start-hbase.sh
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!