<pre name="code" class="html">一个节点上的数据发生变化后,通知其他节点 server 1: [root@wx03 bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /zookeeper/server1/bin/../conf/zoo.cfg Mode: follower server 2: [root@wx03 bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /zookeeper/server2/bin/../conf/zoo.cfg Mode: leader server 3: [root@wx03 bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /zookeeper/server3/bin/../conf/zoo.cfg Mode: follower 在server 3上创建节点; ls / [scan01, zk, mysql, zk01, zookeeper] [zk: localhost:2181(CONNECTED) 1] create czcb001 'ddadqweq312' Command failed: java.lang.IllegalArgumentException: Path must start with / character [zk: localhost:2181(CONNECTED) 2] create /czcb001 'ddadqweq312' Created /czcb001 [zk: localhost:2181(CONNECTED) 3] ls / [scan01, zk, mysql, zk01, czcb001, zookeeper] [zk: localhost:2181(CONNECTED) 4] server 1节点; ls / [scan01, zk, mysql, zk01, zookeeper] [zk: localhost:2181(CONNECTED) 1] ls / [scan01, zk, mysql, zk01, czcb001, zookeeper] [zk: localhost:2181(CONNECTED) 2] server 2节点: ls / [scan01, zk, mysql, zk01, zookeeper] [zk: localhost:2181(CONNECTED) 1] ls / [scan01, zk, mysql, zk01, czcb001, zookeeper] [zk: localhost:2181(CONNECTED) 2]