使用Clustershell搭建Kafka和Zookeeper集群

使用Clustershell搭建Kafka和Zookeeper集群

1、 安装环境

虚拟机环境,共有三台虚拟主机:
Router1 192.168.3.116
Router2 192.168.3.115
Router3 192.168.3.121

2、CMD工具

SecureCRT 7.2.3
具有Tile功能,可以将多个session窗口并列显示。
设置在菜单windows ->Tile Vertically,并且有显示 command windows功能.设置在菜单View -> Command windows.在command windows中可以右键设置 send commands to all sessions菜单,就可以在commandwindows中输入命令后向所有sessions发送输入的命令。

这里写图片描述

3、搭建zookeeper集群

3.1设置多台机器免密码

在command windows中输入命令

-bash-4.1# ls /root/.ssh known_hosts //删除原有文件 -bash-4.1# rm -rf /root/.ssh/* -bash-4.1# ls /root/.ssh //生成密钥文件 -bash-4.1# ssh-keygen -t rsa Generating public/private rsa keypair. Enter file in which to save the key(/root/.ssh/id_rsa): Enter passphrase (empty for nopassphrase): Enter same passphrase again: Your identification has been savedin /root/.ssh/id_rsa. Your public key has been saved in/root/.ssh/id_rsa.pub. The key fingerprint is: 82:1b:17:2f:30:7c:62:db:7c:34:4a:0d:d5:20:46:dcroot@router1 The key's randomart image is: +--[ RSA 2048]----+ | o=ooo | | . ..+E . | | * + + | | . @ = . | | + B S | | + + | | . | | | | | +-----------------+ //查看是否生成了密钥文件 -bash-4.1# ls /root/.ssh id_rsa id_rsa.pub //向主机一发送密钥文件 -bash-4.1# ssh-copy-id -i /root/.ssh/id_rsa.pub router1 The authenticity of host 'router1(::1)' can't be established. RSA key fingerprint is12:e8:9d:2d:ee:11:9e:a3:40:98:bf:eb:43:36:01:c7. Are you sure you want to continueconnecting (yes/no)? yes Warning: Permanently added'router1' (RSA) to the list of known hosts. root@router1's password: Now try logging into the machine,with "ssh 'router1'", and check in: .ssh/authorized_keys to make sure we haven't added extrakeys that you weren't expecting. -bash-4.1# ssh-copy-id -i /root/.ssh/id_rsa.pub router2 The authenticity of host 'router2(192.168.3.115)' can't be established. RSA key fingerprint is12:e8:9d:2d:ee:11:9e:a3:40:98:bf:eb:43:36:01:c7. Are you sure you want to continueconnecting (yes/no)? yes Warning: Permanently added'router2,192.168.3.115' (RSA) to the list of known hosts. root@router2's password: Now try logging into the machine,with "ssh 'router2'", and check in: .ssh/authorized_keys to make sure we haven't added extrakeys that you weren't expecting. -bash-4.1# ssh-copy-id -i /root/.ssh/id_rsa.pub router3 The authenticity of host 'router3(192.168.3.121)' can't be established. RSA key fingerprint is12:e8:9d:2d:ee:11:9e:a3:40:98:bf:eb:43:36:01:c7. Are you sure you want to continueconnecting (yes/no)? yes Warning: Permanently added'router3,192.168.3.121' (RSA) to the list of known hosts. root@router3's password: Now try logging into the machine,with "ssh 'router3'", and check in: .ssh/authorized_keys to make sure we haven't added extrakeys that you weren't expecting. //检查三个主机的密钥信息是否已经全部同步 -bash-4.1# cat /root/.ssh/authorized_keys ssh-rsaAAAAB3NzaC1yc2EAAAABIwAAAQEAo7uexe+lKTBWgDeJarTUmhHqW466K85AYDl6IbFZINFKJquVV9wb1+54KDltXopUYHh2TULY00XFWQ02zHp76jCFq8kYfb+bLlF0He2CP+VegiOs0o0gZXYLkb0zvVEkVju1/2jqAPf+Q3wEcKao2Qu/EppBDLEMGsfFPUp6GmIG6GLd/019zrhupKqzm7zd0csk7uxKoVeP3LW6wpNPbqV6DUwC48AosyVjdwdviCGG+Cmqi5DHy6pwAldo9Hru9n5wtHLUI3AehDjBxZ64SHrond2cMQyVV/yYSpexqBdZsAstKQAW24IBl+qcgu2y4CcbkSVYjjsG5dvZNjXuJQ==root@router1 ssh-rsaAAAAB3NzaC1yc2EAAAABIwAAAQEAxEULXbppPx8In6csFdPHSEG22s/Lkz7xCQ8FGFbkJj5NuHAt4uYdtEdkPUMfsW2d+hmAKDDcZI+Jgsa4dgkVe7OX1qYsuw4hvtN9V/RCpFrk4y/FchaEMwa08w1f0PcuC39AdARuBDCgHRfUEV7GWdS2Sh3+OJpzryflb7yGbGobys7hHbltHfnwiswiram72/Mob62gdqg7FtOC9K4AfejC/g0LBnajAhIALBqp+SSHpWWUFo9vEOAquEyE+DHFb7ojD+psYu8rZenZDSP/ibWE1gWvLADFCBukpi5RBM2mSilTcdDMunw9wjs0jUGiJZtR6y/rZk2QLwaOISmOJQ==root@router3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyLQZveV/kaD/1IQJPfB+WKyWtPZryECIeXMFufmC8QkQcdQ9SrZxMNzLshQiES8X+dGlNOnvqUlPaegpcbdTpsdKYw+2CbbYyHICePNqFf2sQzOz0GduXnrgSZom8uWfZVZKSGbzzvWtE45Z2NNSsp0/vtBI0ZsfCF93wYDMpKZbfG1iH/FhWpMh0RVpQgBzwQIxF9MsMlrhT/bE1Q996+irqickL44KzwvEAUPqQnicsyX80Swn2Ujuv0g6zdQWigji2YQGlSi3mnhwp7uoi834QQLMoYO4yu7ZCY/fxe6g73KzN15Ghc7Mhjh2PfbFPj7Buwi3/4QNM7sRy+ktPw== root@router2

//检查免密登录情况

这里写图片描述

3.2设置zookeeper集群

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/96d91513aa917e8225e62c7a08bfdd81.html