zoukankan      html  css  js  c++  java
  • 生产环境Zookeeper集群搭建

    三个主机就不提了,直接点

    #####安装jdk######

    [root@Zk-1 ~]# rpm -ivh jdk-7u76-linux-x64.rpm
    [root@Zk-1 ~]# vi /etc/profile
    ...
    export ZOO_HOME=/usr/local/zookeeper
    export PATH=$PATH:$ZOO_HOME/bin
    export JAVA_HOME=/usr/java/jdk1.7.0_76
    export PATH=$JAVA_HOME/bin:$PATH
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    ...


    ####安装zookeeper####

    [root@Zk-1 ~]# cd /usr/local
    [root@Zk-1 ~]# tar -zxf zookeeper-3.4.6-product.tar.gz
    [root@Zk-1 ~]# rm -f zookeeper-3.4.6-prod
    uct.tar.gz
    [root@Zk-1 ~]# mv zookeeper-3.4.6 zookeeper
    [root@Zk-1 ~]# mkdir /data
    [root@Zk-1 ~]# source /etc/profile

    ######配置zookeeper环境####

    [root@Zk-1 ~]# vim /usr/local/zookeeper/conf/zoo.cfg
    ...
    # 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=/data/
    # the port at which the clients will connect
    clientPort=2181
    # 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=500
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    autopurge.purgeInterval=168
    
    server.1=10.0.76.108:2888:3888
    server.2=10.0.76.109:2888:3888
    server.3=10.0.76.110:2888:3888
    ...
    
    [root@Zk-1 ~]# vim /data/myid
    ...
    1     #看主机而改
    ...

    #########启动zookeeper########

    [root@Zk-1 ~]# zkServer.sh start
    [root@Zk-1 ~]# zkServer.sh status
    ...
    JMX enabled by default
    Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
    Mode: follower         #或者leader
    [root@Zk-1 ~]# jps
    6213 Jps
    1932 QuorumPeerMain
  • 相关阅读:
    单向链表的创建、输出、插入、删除
    linux文件管理指令
    二叉树的创建与遍历(递归)
    小工具
    排序
    Project Euler Problem (1~10)
    福大软工 · 最终作业
    福大软工 · 第十二次作业
    Beta冲刺 7
    Beta冲刺 6
  • 原文地址:https://www.cnblogs.com/lens/p/4893388.html
Copyright © 2011-2022 走看看