每一个集成环境都缺不了一个中控服务器我们这里姑且叫它操控服务器(supcon)吧,今天介绍一下,该lab-bill-davidey清单里的公共服务(common)模块supcon服务器。
工程化平台就是在这里,ssh免密码登录集成环境的所有主机,这里存放所以的管理脚本。
ssh免密码配置如下:
sudo service sshd start
sudo chkconfig sshd on
vi /etc/ssh/ssh_config
StrictHostKeyChecking no
sudo service sshd restart
ssh-keygen -t ras
ssh-copy-id slave1
ssh [email protected]
configuration is successful!
#!/bin/sh
ssh-keygen -t rsa -P ‘‘ -f ~/.ssh/id_rsa
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
ssh-keygen一般来说需要输入passphrase,但是一般都是三个回车过去了,我懒的输入,加上-P ‘‘就不用了。
add public key
#!/bin/sh
read -p "please input your IP: "ip
ssh-copy-id -o StrictHostKeyChecking=no -i~/.ssh/id_rsa.pub [email protected]$ip
ssh [email protected]$ip ‘sed -i"s/^#RSAAuthentication\ yes/RSAAuthentication\ yes/g"/etc/ssh/sshd_config‘
ssh [email protected]$ip ‘sed -i"s/^#PubkeyAuthentication\ yes/PubkeyAuthentication yes/g"/etc/ssh/sshd_config‘
ssh [email protected]$ip ‘sed -i"s/^#PermitRootLogin\ yes/PermitRootLogin\ yes/g"/etc/ssh/sshd_config‘
ssh [email protected]$ip ‘service sshd restart‘
hostname=`ssh [email protected]${ip} ‘hostname‘`
echo "add the hostname to local/etc/hosts"
echo "$ip $hostname" >> /etc/hosts
echo "please check /etc/hosts"
echo "ok"
copy to others
#!/bin/sh
cat /etc/hosts | while read LINE
do
ip=`echo $LINE | awk ‘{print $1}‘ | grep -v "::" | grep -v"127.0.0.1"`
echo "Copying /etc/hosts to ${ip}"
scp -o StrictHostKeyChecking=no /etc/hosts [email protected]${ip}:/etc/
done
很晚完成才文档,尽管每一天工作强度很大,还是愿意与大家一起进步。呵呵每天进步一点。
后续介绍其他模块,有什么问题敬请大家不要吝啬指出,一同改进。欢迎大家和大家的技术发烧友一起加入我们的qq群262407268,共建我们的《云络智慧城市》