Centos7 install Zookeeper, start, eliminate Jar package conflict

1. Zookeeper download address:

http://mirror.bit.edu.cn/apache/zookeeper/

Insert picture description here

2. Upload the downloaded compressed package to Centos7, (note: download the compressed package of /bin, the reason is Baidu)
Insert picture description here
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

Insert picture description here

6. Then enter the bin directory of zookeeper and start the server

[root@VM_0_17_centos ~]# ./zkServer.sh start

Insert picture description here

7, finally start the client

[root@VM_0_17_centos bin]# ./zkCli.sh

Enter the command after success: ls /
success is shown as follows!
Insert picture description here
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>
<!--            &lt;!&ndash;先排除自带的zookeeper3.5.3&ndash;&gt;-->
            <exclusions>
                <exclusion>
                    <groupId>org.apache.zookeeper</groupId>
                    <artifactId>zookeeper</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
<!--        &lt;!&ndash;添加zookeeper3.4.9版本&ndash;&gt;-->
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>3.4.9</version> <!-- 指定你的版本-->
        </dependency>

Guess you like

Origin blog.csdn.net/qq_38428298/article/details/108487702