• 2、Zookeeper集群搭建、命令行Client操作


    zookeeper 集群最好是奇数台:
    
    5台允许挂掉2台
    
    4台只能允许挂掉1台
    
    
    zjtest7-redis:/opt/zookeeper/bin# ./zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /opt/zookeeper/bin/../conf/zoo.cfg
    Mode: follower
    
    
    zjtest7-redis2:/opt/zookeeper/bin# ./zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /opt/zookeeper/bin/../conf/zoo.cfg
    Mode: leader
    
    
    
    zjtest7-haproxy:/opt/zookeeper/bin# ./zkServer.sh status
    ZooKeeper JMX enabled by default
    Using config: /opt/zookeeper/bin/../conf/zoo.cfg
    Mode: follower
    
    
    zookeeper集群 没有固定的leader
    
    
    create /test "testvalue"    前面目录,后面数据内容
    
    
    [zk: 192.168.32.81:2181(CONNECTED) 3] get /test
    testvalue
    cZxid = 0x100000017
    ctime = Mon Jul 18 14:14:24 CST 2016
    mZxid = 0x100000017
    mtime = Mon Jul 18 14:14:24 CST 2016
    pZxid = 0x100000017
    cversion = 0
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x0
    dataLength = 9
    numChildren = 0
    
    
    
    [zk: 192.168.32.81:2181(CONNECTED) 5] get /test
    testvalue
    cZxid = 0x100000017
    ctime = Mon Jul 18 14:14:24 CST 2016
    mZxid = 0x100000017
    mtime = Mon Jul 18 14:14:24 CST 2016
    pZxid = 0x100000018
    cversion = 1
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x0
    dataLength = 9
    numChildren = 1
    
    
    [zk: 192.168.32.81:2181(CONNECTED) 6] get  /test/child 
    childvalue
    cZxid = 0x100000018
    ctime = Mon Jul 18 14:17:17 CST 2016
    mZxid = 0x100000018
    mtime = Mon Jul 18 14:17:17 CST 2016
    pZxid = 0x100000018
    cversion = 0
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x0
    dataLength = 10

  • 相关阅读:
    模糊查询三种解决方式
    trim标签&&MyBatis内置参数
    ResultMap&&鉴别器&&别名
    增加null&&使用HashMap存储查询结果集
    MyBatis处理多个参数问题
    SpringCloud中使用Zuul实现路由网关
    SpringCloud分布式config配置中心
    FeignClient的参数传递给服务提供方的方式(简单数据类型、对象)
    Hystrix的使用实例***
    什么是缓存穿透、缓存击穿
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199570.html
Copyright © 2020-2023  润新知