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/zookeeper
echo
配置文件参数详解可参考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=2181
server.1=172.20.2.203:2888:3888
server.2=172.20.2.203:2888:3888
server.3=172.20.2.203:2888:3888
EOF
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<<EOF
export PATH=\$PATH:/usr/local/zookeeper/bin
EOF
source /etc/profile.d/zookeeper.sh
可以将文件分发至hadoop-2/3 需要修改myid为2/3
zkServer.sh start
启动服务zkServer.sh status
查看服务器状态
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
修改hbase-env.sh,添加java环境变量和生命使用外部zookeeper
cat >/usr/local/hbase/conf/hbase-env.sh<<EOF
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-3.b10.el6_9.x86_64
export HBASE_LOG_DIR=/usr/local/hbase/logs
export HBASE_MANAGES_ZK=false
EOF
修改hbase-site.xml,添加hbase在HDFS上的存储路径
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<<EOF
hadoop-2
hadoop-3
EOF
cat >/etc/profile.d/hbase.sh<<EOF
export PATH=\$PATH:/usr/local/hbase/bin
EOF
source /etc/profile.d/hbase.sh
可以将文件分发至hadoop-2/3 需要修改myid为2/3
启动服务start-hbase.sh
注意:服务的启停顺序
服务启动:hadoop->zookeeper->hbase
服务停止:hbase->zookeeper->hadoop
Hadoop2.6+Zookper3.4+Hbase1.0部署安装
原文地址:http://blog.51cto.com/kaliarch/2119507