• 生产环境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
  • 相关阅读:
    Java中==和equals的区别
    (转)JAVA-反射机制的使用
    JAVA三框架工作原理是什么?
    Spring的IoC模式
    JavaEE中为什么出现中文乱码?
    Android--Apache HttpClient(2种实现)
    Android之网络----使用HttpClient发送HTTP请求(通过get方法获取数据)
    Android—Http连接之GET/POST请求
    2014 12 04
    struts2的HelloWorld的基本过程
  • 原文地址:https://www.cnblogs.com/lens/p/4893388.html
Copyright © 2020-2023  润新知