标签:run port uil bsp 占用 获取 wget tun 安装
要使用 zookeeper,必须先安装 open jdk,已安装好 open jdk 的直接跳过:
yum -y list java* yum install java-1.8.0-openjdk.x86_64 java -version
配置 open jdk 环境变量
vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/jre/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/jre/bin:$JRE_HOME/bin:$PATH
source /etc/profile
echo $JAVA_HOME
zookeeper Releases 地址:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/
cd /home mkdir download && cd download/ wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.6.0/apache-zookeeper-3.6.0-bin.tar.gz tar -zxvf apache-zookeeper-3.6.0-bin.tar.gz mv apache-zookeeper-3.6.0-bin/ zookeeper cd zookeeper/ && mkdir {data,logs} cd conf/ && cp zoo_sample.cfg zoo.cfg
编辑 zoo.cfg 配置文件
1.修改 dataDir 的值为刚刚在 zookeeper 下创建的 data 文件夹路径
dataDir=/home/download/zookeeper/data
2.添加 dataLogDir 配置为刚创建的 logs 文件夹路径
dataLogDir=/home/download/zookeeper/logs
3.添加 admin.serverPort=8070 (因为8080端口被占用了)
admin.serverPort=8070
配置 zookeeper 环境变量
vi /etc/profile
export ZOOKEEPER_HOME=/home/download/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin
source /etc/profile
echo $ZOOKEEPER_HOME
cd /home/download/zookeeper/bin/
zkServer.sh start
zkServer.sh status
docker pull zookeeper:latest
mkdir -p /home/docker/zookeeper/conf
mkdir -p /home/docker/zookeeper/data
mkdir -p /home/docker/zookeeper/datalog
简单启动一个 zookeeper 容器,获取 zoo.cfg 配置文件
docker run --name zookeeper01 -d --restart=always zookeeper
docker cp -a zookeeper01:/conf/zoo.cfg /home/docker/zookeeper/conf/zoo.cfg
docker stop zookeeper01
docker rm zookeeper01
停止并删除之前的容器后,重新 run 一个 zookeeper 容器
docker run --name zookeeper01 -d --restart=always -v /home/docker/zookeeper/conf/zoo.cfg:/conf/zoo.cfg -v /home/docker/zookeeper/data:/data -v /home/docker/zookeeper/datalog:/datalog -p 2181:2181 -p 2888:2888 -p 3888:3888 -p 8070:8080 zookeeper
一个简单的记录,希望有所帮助!
CentOS 安装 zookeeper(附 docker 安装 zookeeper)
标签:run port uil bsp 占用 获取 wget tun 安装
原文地址:https://www.cnblogs.com/journet/p/12797906.html