• linux系统安装zookeeper


    1. 新建/usr/loca/zookeeper文件夹
    [root@localhost ~]# mkdir -pv /usr/local/zookeeper

    2.拷贝文件到指定文件夹
    [root@localhost ~]# cd /root/Desktop/
    [root@localhost ~]# cp ./zookeeper-3.4.6.tar.gz /usr/local/zookeeper

    3. 解压
    [root@localhost ~]# tar -zxvf jdk-8u121-linux-x64.tar.gz

    4. 配置环境变量
    [root@localhost ~]#cd /etc/
    [root@localhost ~]#cp ./profile ./profile.bak -- 把文件备份一下
    [root@localhost ~]#vi /etc/profile -- 编辑此配置文件
    在文件末尾添加此段内容: -- 开始和--中间的一段.(注意,尽量保持环境变量名全大写,下划线隔开. 保持规范)
    -- 开始
    export ZOOKEEPER_INSTALL=/usr/local/zookeeper/zookeeper-3.4.6/
    export PATH=$PATH:$ZOOKEEPER_INSTALL/bin
    -- 结束

    5. 配置文件修改
    [root@localhost zookeeper-3.4.6]# cd /usr/local/zookeeper/zookeeper-3.4.6/conf/ -- 进入文件所在路径
    [root@localhost conf]# cp zoo_sample.cfg zoo.cfg -- 将zoo.sample.cfg拷贝出一份zoo.cfg出来. 文件名强制

    6. 文件内容如下:
    [root@localhost conf]# vi zoo.cfg -- 按i进入编辑模式. 修改完成之后, esc退出编辑模式, 大写字母Z双击即可保存.


    # The number of milliseconds of each tick
    tickTime=2000
    # The number of ticks that the initial
    # synchronization phase can take
    initLimit=10
    # The number of ticks that can pass between
    # sending a request and getting an acknowledgement
    syncLimit=5
    # the directory where the snapshot is stored.
    # do not use /tmp for storage, /tmp here is just
    # example sakes.
    dataDir=/tmp/zookeeper -- 这里要设置一下文件路径 路径必须存在,不存在的话就新建一个呗
    dataLogDir=/tmp/zookeeper/log -- 日志路径 路径必须存在,不存在的话就新建一个呗
    # the port at which the clients will connect
    clientPort=2181 -- 如果是多机器的话,在clientPort处添加服务器的ip
    # the maximum number of client connections.
    # increase this if you need to handle more clients
    #maxClientCnxns=60
    #
    # Be sure to read the maintenance section of the
    # administrator guide before turning on autopurge.
    #
    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    #
    # The number of snapshots to retain in dataDir
    #autopurge.snapRetainCount=3
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    #autopurge.purgeInterval=1

    修改完之后 通过 > # cat zoo.cfg 查看.


    7. 开启服务,关闭服务, 查看
    [root@localhost bin]# cd /usr/local/zookeeper/zookeeper.3.4.14/bin/
    [root@localhost bin]# ./zkServer.sh stop -- 停止服务
    JMX enabled by default
    Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
    Stopping zookeeper ... STOPPED

    [root@localhost bin]# ./zkServer.sh start -- 开启服务
    JMX enabled by default
    Using config: /usr/local/zookeeper/zookeeper-3.4.14/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED

    [root@localhost bin]# ./zkServer.sh status -- 查看状态
    JMX enabled by default
    Using config: /usr/local/zookeeper/zookeeper-3.4.14/bin/../conf/zoo.cfg
    Mode: standalone
    [root@localhost bin]#

  • 相关阅读:
    nodejs redis数据类型命令汇总
    十大经典排序算法最强总结
    基于Nodejs的Tcp封包和解包的理解
    排序算法 JavaScript
    import和require的区别
    Socket.io的默认事件列表
    非常完整的coco screator socketio
    分布式、集群、微服务、SOA 之间的区别
    关于插入3条数据第三条失败全部回滚的操作
    @Scope注解的详细用法
  • 原文地址:https://www.cnblogs.com/zmjc/p/12020696.html
Copyright © 2020-2023  润新知