Server environment setup - Centos installs zookeeper

Preface

Because you want to use Dubbo and zookeeper recommended by the official website, record the installation of zookeeper

install

  • Download, upload
    The first step is to download zookeeper from the official website and upload it to the server. My directory is
/usr/java/download
  • decompression
    Unsurprisingly, it must be decompressed.
tar zxvf /usr/java/download/zookeeper-3.4.14.tar.gz -C /usr/java
  • To configure
//New data directory
[root@VM_0_5_centos zookeeper-3.4.14]# mkdir data

[root@VM_0_5_centos zookeeper-3.4.14]# cd conf
[root@VM_0_5_centos conf]# ll
total 12
-rw-rw-r-- 1 2002 2002  535 Mar  7 00:50 configuration.xsl
-rw-rw-r-- 1 2002 2002 2161 Mar  7 00:50 log4j.properties
-rw-rw-r-- 1 2002 2002  922 Mar  7 00:50 zoo_sample.cfg
//rename
[root@VM_0_5_centos conf]# mv zoo_sample.cfg zoo.cfg
[root@VM_0_5_centos conf]# ll
total 12
-rw-rw-r-- 1 2002 2002  535 Mar  7 00:50 configuration.xsl
-rw-rw-r-- 1 2002 2002 2161 Mar  7 00:50 log4j.properties
-rw-rw-r-- 1 2002 2002  922 Mar  7 00:50 zoo.cfg
//Modify zoo.cfg
[root@VM_0_5_centos conf]# vim zoo.cfg

//Modify the data direction to the newly created data directory
/usr/java/zookeeper-3.4.14/data

  • test
    The following information shows that our zookeeper is installed correctly.
[root@VM_0_5_centos zookeeper-3.4.14]# cd bin 
[root@VM_0_5_centos bin]# ll
total 44
-rwxr-xr-x 1 2002 2002  232 Mar  7 00:50 README.txt
-rwxr-xr-x 1 2002 2002 1937 Mar  7 00:50 zkCleanup.sh
-rwxr-xr-x 1 2002 2002 1056 Mar  7 00:50 zkCli.cmd
-rwxr-xr-x 1 2002 2002 1534 Mar  7 00:50 zkCli.sh
-rwxr-xr-x 1 2002 2002 1759 Mar  7 00:50 zkEnv.cmd
-rwxr-xr-x 1 2002 2002 2919 Mar  7 00:50 zkEnv.sh
-rwxr-xr-x 1 2002 2002 1089 Mar  7 00:50 zkServer.cmd
-rwxr-xr-x 1 2002 2002 6773 Mar  7 00:50 zkServer.sh
-rwxr-xr-x 1 2002 2002  996 Mar  7 00:50 zkTxnLogToolkit.cmd
-rwxr-xr-x 1 2002 2002 1385 Mar  7 00:50 zkTxnLogToolkit.sh
[root@VM_0_5_centos bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/java/zookeeper-3.4.14/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@VM_0_5_centos bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/java/zookeeper-3.4.14/bin/../conf/zoo.cfg
Mode: standalone

  • firewall
    If the server opens the firewall, remember to let port 2181 go, or you won't be able to connect to zookeeper

Follow-up

If you have any questions about the installation of zookeeper, please leave a message.

Tags: Zookeeper Java log4j firewall

Posted on Sat, 12 Oct 2019 10:02:02 -0700 by keyont