Installation of Registry Zookeeper in Linux

Posted by jakeklem on Fri, 19 Jul 2019 08:21:51 +0200

Zookeeper and can be redis

Common commands

java -version

Query jdk for installation

amel@Camel ~]$ java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
[camel@Camel ~]$ 
Decompress tar zxvf zookeeper-3.4.6.tar.gz

z: Specifies the compression format of the compressed package
x: decompression
v: Display scroll progress
f: Specify the compressed file name

Get the files in the zookeeper-3.4.6 package after decompression

[camel@Camel public]$ ls
zookeeper-3.4.6  zookeeper-3.4.6.tar.gz
[camel@Camel public]$ cd keeper-3.4.6
bash: cd: keeper-3.4.6: No file or directory
[camel@Camel public]$ cd zookeeper-3.4.6
[camel@Camel zookeeper-3.4.6]$ ls
bin          dist-maven       LICENSE.txt           src
build.xml    docs             NOTICE.txt            zookeeper-3.4.6.jar
CHANGES.txt  ivysettings.xml  README_packaging.txt  zookeeper-3.4.6.jar.asc
conf         ivy.xml          README.txt            zookeeper-3.4.6.jar.md5
contrib      lib              recipes               zookeeper-3.4.6.jar.sha1
[camel@Camel zookeeper-3.4.6]$ cd bin

Focus on bin and conf

In bin

[camel@Camel zookeeper-3.4.6]$ cd bin
[camel@Camel bin]$ ls
README.txt    zkCli.cmd  zkEnv.cmd  zkServer.cmd
zkCleanup.sh  zkCli.sh   zkEnv.sh   zkServer.sh

The difference between zkServer.cmd and zkServer.sh is that. cmd is a windows environment. sh is Linix.

Create a package named data under the package

Create folders: mkdir data
[camel@Camel zookeeper-3.4.6]$ mkdir data
[camel@Camel zookeeper-3.4.6]$ ls
bin          dist-maven       NOTICE.txt            zookeeper-3.4.6.jar.asc
build.xml    docs             README_packaging.txt  zookeeper-3.4.6.jar.md5
CHANGES.txt  ivysettings.xml  README.txt            zookeeper-3.4.6.jar.sha1
conf         ivy.xml          recipes
contrib      lib              src
data         LICENSE.txt      zookeeper-3.4.6.jar

Then find the conf directory

[camel@Camel zookeeper-3.4.6]$ cd conf
[camel@Camel conf]$ ls
configuration.xsl  log4j.properties  zoo_sample.cf

Modify zoo_sample.cf by name

Name modification mv zoo_sample.cfg zoo.cfg
[camel@Camel conf]$ mv zoo_sample.cfg zoo.cfg
[camel@Camel conf]$ ls
configuration.xsl  log4j.properties  zoo.cfg

Edit the zoo.cfg file

Edit file command vim

vim zoo.cfg

image.png

Modify taDir=/tmp/zookeeper to the true path

View path command: pwd command
[camel@Camel ~]$ cd
[camel@Camel ~]$ ls
//Public Template Video Picture Document Download Music Desktop
[camel@Camel ~]$ cd public
[camel@Camel public]$ ls
zookeeper-3.4.6  zookeeper-3.4.6.tar.gz
[camel@Camel public]$ cd zookeeper-3.4.6
[camel@Camel zookeeper-3.4.6]$ ls
bin          dist-maven       NOTICE.txt            zookeeper-3.4.6.jar.asc
build.xml    docs             README_packaging.txt  zookeeper-3.4.6.jar.md5
CHANGES.txt  ivysettings.xml  README.txt            zookeeper-3.4.6.jar.sha1
conf         ivy.xml          recipes
contrib      lib              src
data         LICENSE.txt      zookeeper-3.4.6.jar
[camel@Camel zookeeper-3.4.6]$ cd data
[camel@Camel data]$ pwd
/home/camel/public/zookeeper-3.4.6/data
[camel@Camel data]$ 

Modified to dataDir=/home/camel/public/zookeeper-3.4.6/data

clientPort=2181. This client connects to the port number of zookepper

Save and exit, and then move on. At this time, we need to press the "ESC" in the upper left corner of the keypad. Did you notice that? The insertion state in the lower left corner is missing
Then, we enter a colon, that is, ":" (without double quotation marks), and a colon appears below, waiting for the input command, as shown in the figure, I entered WQ. The functions are as follows.

W: write, write

Q: quit, quit

Return, save and exit.

In fact, there are two ways to save exit:

A: When you enter the last command, you enter "x" directly, which is the same, that is, X=WQ.

B: The quickest way is to press ESC, press shift+zz directly, or switch to uppercase mode and press ZZ, then you can save and exit, that is, press 2 uppercase Z.

Start zookeeper

Under bin directory

Open. / zkServer.sh start

. / zkServer.sh shop stop

. / zkServer.sh status view status

Represents the meaning of having only one node and one instance


image.png
Question: If the operation. / zkServer.sh start starts, but prompts
JMX enabled by default
Using config: /home/camel/public/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
image.png

Solve:
Find the data folder you created earlier

There is a zookeeper_server.pid file in it.

The deletion of rm filename is OK


image.png
[camel@Camel public]$ ls
zookeeper-3.4.6  zookeeper-3.4.6.tar.gz
[camel@Camel public]$ cd zookeeper-3.4.6
[camel@Camel zookeeper-3.4.6]$ ls
bin          dist-maven       NOTICE.txt            zookeeper-3.4.6.jar.asc
build.xml    docs             README_packaging.txt  zookeeper-3.4.6.jar.md5
CHANGES.txt  ivysettings.xml  README.txt            zookeeper-3.4.6.jar.sha1
conf         ivy.xml          recipes
contrib      lib              src
data         LICENSE.txt      zookeeper-3.4.6.jar
[camel@Camel zookeeper-3.4.6]$ cd data
[camel@Camel data]$ ls
zookeeper_server.pid

Topics: Zookeeper xml Maven SHA1