1.基本配置
echo "192.168.80.45 hbase01" >> /etc/hosts
echo "192.168.80.46 hbase02" >> /etc/hosts
echo "192.168.80.47 hbase03" >> /etc/hosts
hostnamectl hostname hbase01
hostnamectl hostname hbase02
hostnamectl hostname hbase03
2.部署Java基础环境
国内下载:http://www.codebaoku.com/jdk/jdk-index.html
Oracle JDK:https://www.oracle.com/java/technologies/downloads
openJDK:https://jdk.java.net/java-se-ri/11-MR2
# 解压
tar -zxvf jdk-8u221-linux-x64.tar.gz -C /usr/local
# 配置环境变量
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
# 查看java版本
java -version
3.部署zookeeper集群
官网:https://zookeeper.apache.org/releases.html
官方文档:https://zookeeper.apache.org/doc/r3.7.0/zookeeperStarted.html
wget https://archive.apache.org/dist/zookeeper/zookeeper-3.6.4/apache-zookeeper-3.6.4-bin.tar.gz
tar -xvf apache-zookeeper-3.7.0-bin.tar.gz -C /usr/local
cd /usr/local/apache-zookeeper-3.7.0-bin
cp conf/zoo_sample.cfg conf/zoo.cfg
创建目录:
mkdir -p /home/$USER/zookeeper
mkdir -p /home/$USER/zookeeper/data
mkdir -p /home/$USER/zookeeper/logs
touch /home/$USER/zookeeper/data/myid
if [ $(hostname) = 'hbase01' ];then
export ID="1"
elif [ $(hostname) = 'hbase02' ];then
export ID="2"
elif [ $(hostname) = 'hbase03' ];then
export ID="3"
fi
echo $ID > /home/$USER/zookeeper/data/myid
cat /home/$USER/zookeeper/data/myid
3.1.编辑zoo.cfg配置文件
vim /usr/local/apache-zookeeper-3.7.0-bin/conf/zoo.cfg
# 修改dataDir路径
dataDir=/home/root/zookeeper/data/ #$USER为你用户名,刚才创建的
dataLogDir=/home/root/zookeeper/logs/
clientPort=2181
# 添加三台server服务器地址
server.1=hbase01:2888:3888;2181
server.2=hbase02:2888:3888;2181
server.3=hbase03:2888:3888;2181
注:这里*3.5以后的版本要加上;2181
才能启动。
3.2.环境变量配置
vim /etc/profile
export ZK_HOME=/usr/local/apache-zookeeper-3.7.0-bin
export PATH=$PATH:$ZK_HOME/bin
3.3.启动命令
zkServer.sh start
zkServer.sh stop
zkServer.sh status
zkCli.sh -server 127.0.0.1:2181
ps -ef | grep zookeeper | grep -v grep
标签:bin,部署,zookeeper,export,home,apache,集群,Hbase,HOME From: https://www.cnblogs.com/-k8s/p/17399934.html