linux下配置zookeeper
我使用的是VMware裝ubuntude 虛擬機器,
使用Xshell連線到linux虛擬機器
先下載zookeeper
wget http://apache.fayea.com/zookeeper/stable/zookeeper-3.4.9.tar.gz
接著 解壓
tar -xzvf zookeeper-3.4.9.tar.gz
重新命名
mv zookeeper-3.4.9.tar.gz zookeeper
然後檢視一下
ls -l

進入zookeeper的conf目錄下,然後再檢視下
cd /opt/zookeeper/conf
ls -l
然後將conf目錄下的zoo_sample.cfg複製一份 名字叫zoo.cfg
zookeeper啟動的時候預設是讀叫zoo.cfg這個檔案的,zoo_sample.cfg只是zookeeper官方提供的一份配置檔案樣板。
cp zoo_sample.cfg zoo.cfg
現在使用vi編輯器開啟它
vim 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
# zookeeper檔案位置
dataDir=/opt/zookeeper1/zookeeperData
#日誌位置
dataLogDir=/opt/zookeeper1/zookeeperLog
# 對客戶端開放的埠號
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=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
#格式 server.id=host:port:port
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
這裡我使用的是 偽叢集模式,叢集模式就是將幾個zookeeper部署到不同的伺服器上,然後配置檔案最下面那部分換成對應的ip地址。
因為我配置了3臺主機,所以要使用3個zookeeper,將剛才的zookeeper資料夾再複製兩份,
然後改下配置檔案的 dataDir (zookeeper檔案位置), dataLogDir(日誌檔案位置), clientPort(對客戶端開放的埠號),這3個需要改成不一樣的(如果是叢集模式無所謂)。
然後cd到你剛才配置dataDir的位置
使用vi建立一個新檔案叫myid,裡面寫入剛在配置檔案中配置的server.id

一共有3個zookeeper,所以要分別在 相應的目錄建立。一共建立3次。完成後就可以啟動3臺zookeeper。
啟動方法,
cd /opt/zookeeper/bin/
./zkServer.sh start
啟動後,再執行
./zkCl.sh
就可以建立相應的節點並存放資料了

相關文章
- Linux下搭建ZooKeeper叢集Linux
- linux下搭建ZooKeeper叢集(偽叢集)Linux
- linux下配置javaLinuxJava
- Zookeeper 安裝配置
- Linux下iptables安全配置Linux
- linux下tomcat安全配置LinuxTomcat
- 在 Linux 下配置 RAIDLinuxAI
- zookeeper:spark-project專案的zookeeper配置SparkProject
- ZooKeeper系列(4):ZooKeeper的配置檔案詳解
- linux下配置java環境LinuxJava
- Linux下ODBC安裝配置Linux
- Linux 下配置 node + mongodb 環境LinuxMongoDB
- Linux CentOS 7 下 Redis 的配置LinuxCentOSRedis
- Linux下rsync安裝與配置Linux
- Linux下檢視、新增及配置Linux
- 6、nginx+linux下jdk配置NginxLinuxJDK
- linux下配置好的快捷鍵Linux
- Linux系統下網路配置Linux
- linux環境下ssh 互信配置Linux
- [Zookeeper-01]什麼是zookeeper?& Linux / Windows Zookeeper安裝和部署(單點)LinuxWindows
- Windows單機配置Zookeeper環境Windows
- Linux 下網路介面卡配置Linux
- JB的測試之旅-Linux下配置Linux
- linux下安裝node npm並配置LinuxNPM
- Linux環境下nginx安裝配置LinuxNginx
- Linux下pppd撥號指令碼配置Linux指令碼
- MySQL - 下載與安裝配置(Linux)MySqlLinux
- 【Linux】Centos7.6 安裝ZookeeperLinuxCentOS
- zookeeper下載安裝使用
- ZooKeeper: 簡介, 配置及運維指南運維
- Linux下使用Nginx做CDN伺服器下的配置LinuxNginx伺服器
- Linux下Java環境變數的配置LinuxJava變數
- Django專案在Linux下基礎配置DjangoLinux
- Linux系統下安裝配置 OpenLDAP + phpLDAPadminLinuxLDAPHP
- DM8 Linux環境下配置ODBCLinux
- 在Linux下安裝配置Cntlm代理教程Linux
- linux安裝zookeeper中各種坑Linux
- Zookeeper-3.4.10 叢集的安裝配置
- 基於zookeeper的分散式配置中心(一)分散式