zookeeper入門學習(二),zookeeper入門學習

來源:互聯網
上載者:User

zookeeper入門學習(二),zookeeper入門學習

zookeeper安裝

單機模式

首先,下載zookeeper-3.4.8.tar.gz

建立/usr/zookeeper,解壓到zookeeper目錄

[root@localhost zookeeper]# tar -zxvf zookeeper-3.4.8.tar.gz 

配置環境變數

為了今後操作方便,我們需要對Zookeeper的環境變數進行配置,方法如下在/etc/profile檔案中加入如下內容:

[root@localhost liutie]# vi /etc/profile

#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_131
JRE_HOME=/usr/java/jdk1.8.0_131/jre
ZOOKEEPER_HOME=/usr/zookpeer/zookpeer-3.4.8
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:ZOOKEEPER_HOME/bin

使環境變數生效

[root@localhost liutie]# source /etc/profile

進入zookeeper檔案夾的bin目錄修改zoo_simple.cfg為zoo.cfg

[root@localhost conf]# mv zoo_sample.cfg zoo.cfg

修改zoo.cfg

[root@localhost conf]# vi 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=/tmp/zookeeper  # the port at which the clients will connect  clientPort=2181  #  # 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 

儲存後進入bin目錄啟動服務端

[root@localhost bin]# ./zkServer.sh start

ZooKeeper JMX enabled by default
Using config: /usr/zookeeper/zookeeper-3.4.8/bin/../conf/zoo.cfg
Starting zookeeper ... already running as process 9176.

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.