First, prepare three Linux virtual machines
three machines centos01:192.168.1.168(lxs001) centos03:192.168.1.178( lxs003) centos03:192.168.1.188(lxs003) three machines
Download Zookeeper:
go to opt catalogue
Download Zookeeper:wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
Decompression ZOOKEEPER:TAR-ZXVF zookeeper-3.4.6.tar.gz
zookeeper-3.4.6 renamed to Zookeeper:MV zookeeper-3.4.6 Zookeeper
Go to conf directory profile CP copy a zoo.cfg backup
Edit Zoo.cfg:Vim Zoo.cfg
instead
Increase cluster information
server.1=192.168.1.168:2888:3888
server.2=192.168.1.178:2888:3888
server.3=192.168.1.188:2888:3888
Copy the zoo.cfg configured on 168 to 178 1882 machines
SCP zoo.cfg [Email protected]:/opt/zookeeper/conf
configuration datadir: Just datadir for/var/zookeeper
Enter var, mkdir new zookerper folder
vim myID New myid text edit myID text and write the number after service ,
Also create a myID on 178 188, respectively, and write the 2,3
The above configuration is ready to connect the test zookeeper, CD into the/opt/zookeeper/bin directory, start
Telnet 192.168.1.168 2181
If the Telnet is not installed, install it first.
Enter stat after successful reconnection
Start 178 188 servers at the same time
Sometimes the cluster is not, it may be that the firewall is not shut down on the machine, shut down the firewall separately on three machines
And the last three machines are clustered down here.
Install zookeeper cluster under Linux