私信
文章
58
评论
10
点赞
75
原创 40
翻译 3
转载 15

文章
关注
粉丝
收藏

个人分类:

   2019-03-18 17:59:43   

zookeeper
### 环境 三台Centos7 ```bash 主机名 IP n188 144.202.93.188 n19 144.202.80.19 n111 149.248.37.111 ```    ### 准备工作 #### 安装JDK1.8 https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html #### 配置JDK环境变量 ```bash $ tail -3 /etc/profile export JAVA_HOME=/usr/local/jdk1.8 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin ``` #### 查看JDK ```bash $ java -version java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) ``` #### 配置hosts ```bash $ tail -3 /etc/hosts 144.202.93.188 n188 144.202.80.19 n19 149.248.37.111 n111 ```    ### 安装zookeeper #### 下载zookeeper(三台配置一样) http://zookeeper.apache.org/releases.html#download #### 配置zookeeper(三台配置一样) ```bash $ grep -v "^#" zoo.cfg tickTime=2000 initLimit=10 syncLimit=5 dataDir=/opt/zookeeper/data clientPort=2181 autopurge.purgeInterval=1 server.1=n188:2888:3888 server.2=n19:2888:3888 server.3=n111:2888:3888 ``` #### 创建数据目录(三台机器一样) ```bash $ mkdir -p /opt/zookeeper/{logs,data} ``` #### 配置myid n188机器 ```bash $ echo 1 >/opt/zookeeper/data/myid ``` n19机器 ```bash $ echo 2 >/opt/zookeeper/data/myid ``` n111机器 ```bash $ echo 3 >/opt/zookeeper/data/myid ``` 启动zookeeper #### 查看三台集群状态 n188机器 ```bash $./zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Mode: follower ``` n19机器 ```bash $./zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Mode: leader ``` n111机器 ```bash $./zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Mode: follower ```
阅读 22 评论 0 收藏 0
阅读 22
评论 0
收藏 0