1. Zookeeper download address:
http://mirror.bit.edu.cn/apache/zookeeper/
2. Upload the downloaded compressed package to Centos7, (note: download the compressed package of /bin, the reason is Baidu)
3. Unzip the compressed package under /usr/local (path custom)
tar -zxvf apache-zookeeper-3.6.1-bin.tar.gz -C /usr/local
4. Rename the name of the folder (no operation required)
[root@VM_0_17_centos ~]# cd /usr/local
[root@VM_0_17_centos ~]# mv apache-zookeeper-3.6.1-bin zookeeper-3.6.1
5. Enter the zookeeper's config directory and copy a configuration file
[root@VM_0_17_centos ~]# cp zoo_sample.cfg zoo.cfg
6. Then enter the bin directory of zookeeper and start the server
[root@VM_0_17_centos ~]# ./zkServer.sh start
7, finally start the client
[root@VM_0_17_centos bin]# ./zkCli.sh
Enter the command after success: ls /
success is shown as follows!
Note: When the version of zookeeper in your pom is higher than that of your server, you need to exclude the jar package
<!-- SpringBoot整合zookeeper客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zookeeper-discovery</artifactId>
<!-- <!–先排除自带的zookeeper3.5.3–>-->
<exclusions>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <!–添加zookeeper3.4.9版本–>-->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.9</version> <!-- 指定你的版本-->
</dependency>