hbase和ZooKeeper集群安装配置

时间:2020-12-08 22:01:46

:ZooKeeper集群安装配置

 

1:解压zookeeper-3.3.2.tar.gz并重命名为zookeeper

2:进入~/zookeeper/conf目录:

拷贝zoo_sample.cfg文件为zoo.cfg,并编辑如下:

dataDir=/home/hadoop/zookeeper/data

 

server.1=192.168.59.133:2888:3888

server.2=192.168.59.134:2888:3888

server.3=192.168.59.135:2888:3888

 

3. 新建并编辑myid文件

dataDir目录下新建myid文件,输入一个数字(master1slave12slave23):

$ mkdir /home/hadoop/zookeeper/data

$ echo "1" > /home/hadoop/zookeeper/data/myid

同样使用scp命令进行远程复制,只不过要修改每个节点上myid文件中的数字。

 

4.启动ZooKeeper集群  

ZooKeeper集群的每个结点上,执行启动ZooKeeper服务的脚本:

$ ~/zookeeper/bin/zkServer.sh start

 

:HBase集群安装配置

1:解压hbase-1.0.1.1-bin.tar.gz并重命名为hbase

 

2:编辑hbase-env.sh文件:

export JAVA_HOME=/usr/java/jdk1.8.0_51

export HBASE_CLASSPATH=/home/hadoop/hadoop/etc/hadoop/

export HBASE_MANAGES_ZK=false

 

3:编辑hbase-site.xml

<configuration>

 

<property>

<name>hbase.rootdir</name>

         <value>hdfs://master:9000/hbase</value>

</property>

 

<property>

        <name>hbase.master</name>

 

<value>master</value>

</property>

 

<property>

        <name>hbase.cluster.distributed</name>

 

        <value>true</value>

    </property>

 

<property>

        

<name>hbase.zookeeper.property.clientPort</name>

        <value>2181</value>

 

</property>

<property>

         <name>hbase.zookeeper.quorum</name>

 

        <value>master,slave1,slave2</value>

    </property>

 

<property>

 

        <name>zookeeper.session.timeout</name>

         <value>60000000</value>

    

</property>

    

<property>

         <name>dfs.support.append</name>

<value>true</value>

    

</property>

 

</configuration>

 

4:更改 regionservers

regionservers 文件中添加slave列表:

slave1

slave2

 

5:将整个hbase安装目录都拷贝到所有slave服务器:

$ scp -r /home/hadoop/hbase  slave1:/home/hadoop

$ scp -r /home/hadoop/hbase  slave2:/home/hadoop

 

6.启动hadoop集群+Zookeeper集群+hbase集群(按顺序启动)

  启动hadoop

 

~/hadoop/sbin/start-all.sh

 

启动ZooKeeper

 

~/zookeeper/bin/zkServer.sh start

 

启动hbase

 

~/hbase/bin/start-base.sh

 

7. 进入hbase shell进行验证

[hadoop@master ~]$ hbase/bin/hbase shell