• Linux 单机搭建Zookeeper集群


    下载

    http://archive.apache.org/dist/zookeeper

    解压缩

    tar -zxvf /opt/zookeeper-3.4.9.tar.gz -C /home/

    复制

    cp -a /home/zookeeper-3.4.9 zookeeper-1
    cp -a /home/zookeeper-3.4.9 zookeeper-2
    cp -a /home/zookeeper-3.4.9 zookeeper-3

    创建目录

    mkdir /home/zookeeper-1/data
    mkdir /home/zookeeper-2/data
    mkdir /home/zookeeper-3/data
    
    mkdir /home/zookeeper-1/data_log
    mkdir /home/zookeeper-2/data_log
    mkdir /home/zookeeper-3/data_log
    
    echo "1" > /home/zookeeper-1/data/myid
    echo "2" > /home/zookeeper-2/data/myid
    echo "3" > /home/zookeeper-3/data/myid

    配置文件

    cp -a /home/zookeeper-1/conf/zoo_sample.cfg zoo.cfg
    cp -a /home/zookeeper-2/conf/zoo_sample.cfg zoo.cfg
    cp -a /home/zookeeper-3/conf/zoo_sample.cfg zoo.cfg
    
    vim /home/zookeeper-1/conf/zoo.cfg 
    
    dataDir=/home/zookeeper-1/data
    dataLogDir=/home/zookeeper-1/data_log
    clientPort=2171 server.
    1=127.0.0.1:2888:3888 server.2=127.0.0.1:2889:3889 server.3=127.0.0.1:2890:3890 vim /home/zookeeper-3/conf/zoo.cfg dataDir=/home/zookeeper-2/data dataLogDir=/home/zookeeper-2/data_log
    clientPort=2181 server.
    1=127.0.0.1:2888:3888 server.2=127.0.0.1:2889:3889 server.3=127.0.0.1:2890:3890 vim /home/zookeeper-1/conf/zoo.cfg dataDir=/home/zookeeper-3/data dataLogDir=/home/zookeeper-3/data_log
    clientPort=2191 server.
    1=127.0.0.1:2888:3888 server.2=127.0.0.1:2889:3889 server.3=127.0.0.1:2890:3890

    启动

    /home/zookeeper-1/bin/zkServer.sh start
    /home/zookeeper-2/bin/zkServer.sh start
    /home/zookeeper-3/bin/zkServer.sh start
    
    /home/zookeeper-1/bin/zkServer.sh status
    /home/zookeeper-2/bin/zkServer.sh status
    /home/zookeeper-3/bin/zkServer.sh status
  • 相关阅读:
    利用 fsockopen() 函数开放端口扫描器
    oracle如何返回列名作为第一条数据简单解决
    redis
    MYSQL
    JUC 多线程
    java单例模式六种实现方式
    java.net.URISyntaxException 问题解决
    Calender类——字段值介绍
    Dorado开发——树形下拉框
    Java—— 一点关于String的转换
  • 原文地址:https://www.cnblogs.com/BINGJJFLY/p/11310721.html
Copyright © 2020-2023  润新知