zookeeper cluster install note

here is a handy steps to intall zk 3.2.2

 

a.modify to zoo.cfg to add machines mapping.
 note:server.1=master:2888:3888
 the first port is used to connect to master(or listen to followers if this is a leader)
 second one is used to leader election.
b.add a myid file which contains a id that correponding to the settings in zoo.cfg
 (set to else if more then one)
c.start in all nodes
 zkServer.sh start
d.check running
 zkServer.sh status
 #or(note the host must be the leader node,else others will get NOTHING response,  maybe one of the ensemble:leader or followers)
 echo ruok | nc <leader- host> 2181
 zkServer.sh status    #this will show who r leader/follow
e.creat a tree node in any host
 zkClient.sh
 create /cluster test
 then check it now in others to see cluster-well-running:
 get /cluster
f.let the leader to dead to simulate to 'leader-election' occurs:
 ssh to leader for one thing,then:
 kill -9 <pid>
 now u will see the event occurs mentioned above.

stop see below.

*note:during execute the zkServer.sh in some znodes,u will get a excetion like this:
 WARN  [QuorumPeer:/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@336] - Cannot open channel to 2 at election address ubuntu1/192.168.0.2:3888
 this is a normal info (u will see it's WARN level);
 'to 2' is the id set in znode ubuntu1;
 3888:it is attempted to be a leader ,say 'leader election'
*if u want to stop a node,that means leader in general, will be attempted to election again,
 so login to new leader,then run cmd:
 zkServer.sh stop
  for any nodes.

* click 'jps ' in any node to see,there is a process running :

QuorumPeerMain

 

u know,the nodes are peer for both leader and followers as the pid named.

 

你可能感兴趣的:(C++,c,ssh,F#,C#)