jdk-8u221-linux-x64.zip

    1. [root@alice002 ~]# mkdir /usr/java
    2. [root@alice002 ~]# cd /opt/src
    3. [root@alice002 src]# tar -xf jdk-8u221-linux-x64.tar.gz -C /usr/java/
    4. [root@alice002 src]# ln -s /usr/java/jdk1.8.0_221/ /usr/java/jdk
    5. [root@alice002 src]# cat >>/etc/profile <<'EOF'
    6. > #JAVA HOME
    7. > export JAVA_HOME=/usr/java/jdk
    8. > export PATH=$JAVA_HOME/bin:$JAVA_HOME/bin:$PATH
    9. > export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
    10. > EOF
    11. [root@alice002 src]# source /etc/profile
    12. [root@alice002 src]# java -version
    13. java version "1.8.0_221"
    14. Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
    15. Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
    16. [root@alice002 src]#
    wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
    
    [root@alice001 src]# tar -zxf zookeeper-3.4.14.tar.gz -C /opt/
    [root@alice001 src]# ln -s /opt/zookeeper-3.4.14/ /opt/zookeeper
    [root@alice001 src]# ll /opt/zookeeper
    lrwxrwxrwx 1 root root 22 Mar  1 21:16 /opt/zookeeper -> /opt/zookeeper-3.4.14/
    [root@alice001 src]# cat >/opt/zookeeper/conf/zoo.cfg <<'EOF'
    > tickTime=2000
    > initLimit=10
    > syncLimit=5
    > dataDir=/data/zookeeper/data
    > dataLogDir=/data/zookeeper/logs
    > clientPort=2181
    > server.1=zk1.od.com:2888:3888
    > server.2=zk2.od.com:2888:3888
    > server.3=zk3.od.com:2888:3888
    > EOF
    [root@alice001 src]# mkdir -p /data/zookeeper/data
    [root@alice001 src]# mkdir -p /data/zookeeper/logs
    [root@alice001 src]# echo 1 > /data/zookeeper/data/myid 分别为每台机器添加id
    [root@alice001 src]# vim /var/named/od.com.zone  记得前滚序列
    zk1                A    172.23.187.175
    zk2                A    172.23.187.173
    zk3                A    172.23.187.174                                                                                  
    [root@alice001 src]# systemctl restart named
    [root@alice001 src]# dig -t A zk1.od.com @172.23.187.175 +short
    172.23.187.175
    [root@alice001 src]# dig -t A zk2.od.com @172.23.187.175 +short
    172.23.187.173
    [root@alice001 src]# dig -t A zk3.od.com @172.23.187.175 +short
    172.23.187.174
    [root@alice001 src]# /opt/zookeeper/bin/zkServer.sh start
    ZooKeeper JMX enabled by default
    Using config: /opt/zookeeper/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED
    [root@alice001 src]# netstat -lntup |grep 2181
    tcp        0      0 0.0.0.0:2181            0.0.0.0:*               LISTEN      5191/java           
    [root@alice001 src]# /opt/zookeeper/bin/zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /opt/zookeeper/bin/../conf/zoo.cfg
    Mode: follower
    [root@alice001 src]#