兩台伺服器搭建zookeeper集群

2021-08-28 00:16:49 字數 1873 閱讀 3346

兩台伺服器搭建zookeeper集群

zookeeper做三節點集群,啟動後報錯如下:

[root@centos conf]# zkserver.sh start

zookeeper jmx enabled by

default

using config: /usr/local/src/zookeeper-3.4

.10/bin/../conf/zoo.cfg

starting zookeeper ... started

[root@centos conf]# zkserver.sh status

zookeeper jmx enabled by

default

using config: /usr/local/src/zookeeper-3.4

.10/bin/../conf/zoo.cfg

error contacting service. it is probably not running.

解決方案:

1.首先關閉防火牆,三颱機器之間無法正常通訊。

2.建立資料目錄,zoo.cfg配置檔案裡datadir指定的那個目錄下建立myid檔案,並且指定id,改id為你zoo.cfg檔案中server.1=ip:2888:3888中的1.只要在myid頭部寫入1即可.同理其它兩台機器的id對應上。

比如第一台機器cfg檔案:

配置相應的myid為:1

配置檔案

# 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=/usr/local/zookeeper-3/data

datalogdir=/usr/local/zookeeper-3/data

# the port at which the clients will connect

clientport=12183

server.1=172.35

.36.210:2888:3387

server.2=172.35

.36.210:2889:3388

server.3=172.35

.36.211:2890:3390

# the maximum number

of client connections.

# increase this if you need to handle more clients

#maxclientcnxns=60

這裡有個坑

server.1=172.35.36.210:2888:3387

server.2=172.35.36.210:2889:3388

server.3=172.35.36.211:2890:3390

2888

2889

2890

不能和埠一致,否則會報錯

兩台伺服器ssh授權

兩台機子ip 192.168.171.23 192.168.171.22 目標要實現 ssh www 192.168.171.22 hostname 不要輸入密碼 23機子操作 ssh keygen t rsa直接3個回車 cd sshscp r id rsa.pub 192.168.171.22 ...

Linux scp 兩台伺服器傳輸檔案

引用 設有兩機,均為區域網,兩機可相互通訊無問題,中間無防火牆。兩機ip分別為 a 192.168.1.240 b 192.168.1.102 假設a,b機的ssh都允許root登入 設要把 a上的 root abc.zip 傳到 b機並放到 abc目錄,可以在a機上用命令 scp root abc...

Linux scp 兩台伺服器傳輸檔案

引用 設有兩機,均為區域網,兩機可相互通訊無問題,中間無防火牆。兩機ip分別為 a 192.168.1.240 b 192.168.1.102 假設a,b機的ssh都允許root登入 設要把 a上的 root abc.zip 傳到 b機並放到 abc目錄,可以在a機上用命令 scp root abc...