A: Install zookeeper (fully distributed (with Virtual machine installation))
1. Upload ZK installation package
2. Unzip
3. Configuration (first configured on a single node)
3.1 Adding a zoo.cfg configuration file
$ZOOKEEPER/conf
MV Zoo_sample.cfg Zoo.cfg
3.2 Modifying a configuration file (zoo.cfg)
Datadir=/itcast/zookeeper-3.4.5/data
server.1=itcast05:2888:3888
server.2=itcast06:2888:3888
server.3=itcast07:2888:3888
3.3 Create a myID file in (datadir=/itcast/zookeeper-3.4.5/data) with the contents of server. N in N (the content of SERVER.2 is 2)
echo "1" > myID
3.4 Copy the configured ZK to the other nodes
Scp-r/itcast/zookeeper-3.4.5/itcast06:/itcast/
Scp-r/itcast/zookeeper-3.4.5/itcast07:/itcast/
3.5 Note: Be sure to modify the contents of myID on other nodes
In itcast06 should talk about myID content changed to 2 (echo "6" > myID)
In itcast07 should talk about myID content changed to 3 (echo "7" > myID)
4. Start the cluster
Start ZK separately
./zkserver.sh Start
View cluster status
The./zkserver.sh Status View results should be a leader, multiple follower
B: Problems that arise
1: Occurs at startup:
Viewing status after starting multiple machines individually is still it is probably not running
Then go to the Bin directory to view the Zookeeper.out log file to see the following information:
It is said that the cluster deny connection is still not the reason for exiting the log file to continue viewing errors during the restart of the cluster.
Then I looked at the log and found this sentence.
My group of IP is 192.168.2.23--192.168.25 but myid:1 to connect myid:2 when the IP is 192.168.2.22. Instantly understand,----configuration file in the host name is WRONG!!!
To open a configuration file:
It was wrong to write. Modify the host name. It's OK.
Installing the zookeeper cluster and the problems that arise