Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装

一、zookper安装

1.1 下载并解压软件

cd /software
wget -c http://apache.fayea.com/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
tar -zxf zookeeper-3.4.10.tar.gz -C /usr/local/
ln -sv /usr/local/zookeeper-3.4.10/ /usr/local/zookeeperecho

1.2 修改配置文件

配置文件参数详解可参考zookeeper参数

cat > /usr/local/zookeeper/conf/zoo.cfg<<EOF
tickTime=2000 
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper/data
datalogDir=/usr/local/zookeeper/logs
clientPort=2181server.1=172.20.2.203:2888:3888server.2=172.20.2.203:2888:3888server.3=172.20.2.203:2888:3888EOF

1.3 创建目录添加环境变量

mkdir -p /usr/local/zookeeper/{data,logs}echo "1">/usr/local/zookeeper/data/myid
chown hadoop.hadoop /usr/local/zookeeper/ -R
cat >/etc/profile.d/zookeeper.sh<<EOFexport PATH=\$PATH:/usr/local/zookeeper/bin
EOFsource /etc/profile.d/zookeeper.sh

1.4 同样方式配置其他服务器

可以将文件分发至hadoop-2/3 需要修改myid为2/3

1.5 启动服务

zkServer.sh start启动服务
zkServer.sh status 查看服务器状态
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_02

二、hbase安装

2.1 下载并解压软件

cd /software 
wget -c http://archive.apache.org/dist/hbase/1.0.1.1/hbase-1.0.1.1-bin.tar.gz
tar -zxf hbase-1.0.1.1-bin.tar.gz -C /usr/local/
mkdir -p /usr/local/hbase/logs
ln -sv /usr/local/hbase-1.0.1.1/ /usr/local/hbase
chown hadoop.hadoop /usr/local/hbase-1.0.1.1/ -R

2.2 修改配置文件

修改hbase-env.sh,添加java环境变量和生命使用外部zookeeper

cat >/usr/local/hbase/conf/hbase-env.sh<<EOFexport JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-3.b10.el6_9.x86_64export HBASE_LOG_DIR=/usr/local/hbase/logsexport HBASE_MANAGES_ZK=falseEOF

修改hbase-site.xml,添加hbase在HDFS上的存储路径
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_03

cat >/usr/local/hbase/conf/hbase-site.xml<<EOF
<configuration>  
    <!-- 指定hbase在HDFS上存储的路径 -->  
       <property>  
               <name>hbase.rootdir</name>  
               <value>hdfs://hadoop-1:8020/data</value>      
       </property>  
    <!-- 指定hbase是分布式的 -->  
       <property>  
               <name>hbase.cluster.distributed</name>  
               <value>true</value>  
       </property>  
    <!-- 指定zk的地址,多个用“,”分割 -->  
       <property>  
               <name>hbase.zookeeper.quorum</name>  
               <value>hadoop-1,hadoop-2,hadoop-3</value>  
       </property>  
       <property>  
               <name>hbase.master.info.port</name>  
               <value>60010</value>  
       </property>  </configuration>  EOF

修改regionservers

cat>/usr/local/hbase/conf/regionservers<<EOFhadoop-2
hadoop-3
EOF

2.3 添加环境变量

cat >/etc/profile.d/hbase.sh<<EOFexport PATH=\$PATH:/usr/local/hbase/bin
EOFsource /etc/profile.d/hbase.sh

2.3 同样方式配置其他服务器并启动服务

可以将文件分发至hadoop-2/3 需要修改myid为2/3
启动服务start-hbase.sh
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_04
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_05
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_06

2.3 web页查看

Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_07

2.4 hbase shell测试

Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_08
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_09
Hadoop2.6+Zookeeper3.4+Hbase1.0部署安装_Hadoop2.6+Zookeeper3_10

注意:服务的启停顺序
服务启动:hadoop->zookeeper->hbase
服务停止:hbase->zookeeper->hadoop