Welcome everyone

Zookeeper自动部署脚本

java 汪明鑫 651浏览 0评论

cent os   Zookeeper集群 192.168.88.101(mini1), 192.168.88.102(mini2), 192.168.88.103(mini3)

 

首先要配置免密登陆

[root@mini1 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
f3:9e:9b:8e:b2:2a:92:b8:b5:74:7e:27:83:19:ef:11 root@mini1
The key’s randomart image is:
+–[ RSA 2048]—-+
| |
| |
| |
| |
| E S |
| . . o |
|..o .=. . |
|+o.+o *..o o |
|.o..o+o*..*. |
+—————–+
[root@mini1 ~]# ssh-copy-id mini1
root@mini1’s password:
Now try logging into the machine, with “ssh ‘mini1′”, and check in:
.ssh/authorized_keys
to make sure we haven’t added extra keys that you weren’t expecting.
[root@mini1 ~]# ssh-copy-id mini2
root@mini2’s password:
Now try logging into the machine, with “ssh ‘mini2′”, and check in:
.ssh/authorized_keys
to make sure we haven’t added extra keys that you weren’t expecting.
[root@mini1 ~]# ssh-copy-id mini3

 

startZK.sh

#!/bin/sh

echo "start my zookeeper cluster"
for i in 1 2 3
do
ssh mini$i "source /etc/profile;/root/apps/zookeeper-3.4.5/bin/zkServer.sh start"
done

 

 

直接使用自动部署脚本 startZK.sh

转载请注明:汪明鑫的个人博客 » Zookeeper自动部署脚本

喜欢 (0)

说点什么

您将是第一位评论人!

提醒
avatar
wpDiscuz