zoukankan      html  css  js  c++  java
  • zookeeper 同步

    <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] 
    


    
                                        
    
  • 相关阅读:
    Java 9 模块解耦的设计策略
    Spring Data JPA 事务锁
    如何配置Spring Boot Tomcat
    Spring Cloud Turbine
    Spring Boot 测试时的日志级别
    Spring Boot中使用RSocket
    构造函数
    递归函数的使用
    有序数列的二分搜索
    Java第一次代码作业汇总
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350457.html
Copyright © 2011-2022 走看看