码迷,mamicode.com
首页 > 其他好文 > 详细

openstack 调整云主机大小

时间:2019-11-01 12:58:14      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:art   col   重启   title   one   tor   efault   ant   认证   

openstack 调整云主机大小 

######在主控制节点和所有的计算机节点做ssh认证 
[ ! -f sshkey_tool.sh ] && wget https://files.cnblogs.com/files/blog-lhong/sshkey_tool.sh
bash sshkey_tool.sh node171 root ess.com1
bash sshkey_tool.sh node172 root ess.com1
bash sshkey_tool.sh node173 root ess.com1
bash sshkey_tool.sh node174 root ess.com1
bash sshkey_tool.sh controller root ess.com1


######生成sshkey和配置ssh
########主控制节点和所有的计算机节点 
usermod -s /bin/bash nova
su nova -c "
cd  /tmp
yes |ssh-keygen -t rsa -P ‘‘ -f ~/.ssh/id_rsa
yes |ssh-keygen -t dsa -P ‘‘ -f ~/.ssh/id_dsa

echo Host * 
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
 >>~/.ssh/config

ls -l ~/.ssh/id*
"
###########上面的命令也可以通过sshkey来操作 
ssh node172 "usermod -s /bin/bash nova
su nova -c \"
cd  /tmp
yes |ssh-keygen -t rsa -P ‘‘ -f ~/.ssh/id_rsa
yes |ssh-keygen -t dsa -P ‘‘ -f ~/.ssh/id_dsa
echo Host * 
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
 >>~/.ssh/config
\"
ls -l /var/lib/nova/.ssh/id*
"

ssh node173 "usermod -s /bin/bash nova
su nova -c \"
cd  /tmp
yes |ssh-keygen -t rsa -P ‘‘ -f ~/.ssh/id_rsa
yes |ssh-keygen -t dsa -P ‘‘ -f ~/.ssh/id_dsa
echo Host * 
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
 >>~/.ssh/config
\"
ls -l /var/lib/nova/.ssh/id*
"

ssh node174 "usermod -s /bin/bash nova
su nova -c \"
cd  /tmp
yes |ssh-keygen -t rsa -P ‘‘ -f ~/.ssh/id_rsa
yes |ssh-keygen -t dsa -P ‘‘ -f ~/.ssh/id_dsa
echo Host * 
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
 >>~/.ssh/config
\"
ls -l /var/lib/nova/.ssh/id*
"

######################把每一个节点的公钥写入authorized_keys文件
ssh node171 "su nova -c ‘cat /var/lib/nova/.ssh/id_rsa.pub >/var/lib/nova/.ssh/authorized_keys‘"
ssh node171 "su nova -c ‘cat /var/lib/nova/.ssh/id_dsa.pub >>/var/lib/nova/.ssh/authorized_keys‘"
cat /var/lib/nova/.ssh/authorized_keys
ll /var/lib/nova/.ssh/authorized_keys

ssh node172 su nova -c "cat /var/lib/nova/.ssh/id_rsa.pub"  >>/var/lib/nova/.ssh/authorized_keys

ssh node172 su nova -c "cat /var/lib/nova/.ssh/id_dsa.pub"  >>/var/lib/nova/.ssh/authorized_keys
cat /var/lib/nova/.ssh/authorized_keys
ll /var/lib/nova/.ssh/authorized_keys

ssh node173 su nova -c "cat /var/lib/nova/.ssh/id_rsa.pub"  >>/var/lib/nova/.ssh/authorized_keys

ssh node173 su nova -c "cat /var/lib/nova/.ssh/id_dsa.pub"  >>/var/lib/nova/.ssh/authorized_keys
cat /var/lib/nova/.ssh/authorized_keys 
ll /var/lib/nova/.ssh/authorized_keys

ssh node174 su nova -c "cat /var/lib/nova/.ssh/id_rsa.pub"  >>/var/lib/nova/.ssh/authorized_keys
cat /var/lib/nova/.ssh/authorized_keys 
ll /var/lib/nova/.ssh/authorized_keys


ssh node174 su nova -c "cat /var/lib/nova/.ssh/id_dsa.pub"  >>/var/lib/nova/.ssh/authorized_keys
cat /var/lib/nova/.ssh/authorized_keys 
ll /var/lib/nova/.ssh/authorized_keys

chmod 644 /var/lib/nova/.ssh/authorized_keys
chown nova.nova /var/lib/nova/.ssh/authorized_keys
################

###下发authorized_keys文件到每一个节点

rsync -avzP /var/lib/nova/.ssh/authorized_keys root@node172:/var/lib/nova/.ssh/
rsync -avzP /var/lib/nova/.ssh/authorized_keys root@node173:/var/lib/nova/.ssh/
rsync -avzP /var/lib/nova/.ssh/authorized_keys root@node174:/var/lib/nova/.ssh/


##############################
####

#sed -i /\[DEFAULT\]/ a allow_resize_to_same_host=True \nscheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter /etc/nova/nova.conf
#head /etc/nova/nova.conf

#####在controller节点上重启nova服务 
#systemctl restart openstack-nova-api.service openstack-nova-conductor.service openstack-nova-scheduler.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-compute.service openstack-nova-novncproxy.service


###在各个计算节点上重启nova服务
#service openstack-nova-compute restart

 

openstack 调整云主机大小

标签:art   col   重启   title   one   tor   efault   ant   认证   

原文地址:https://www.cnblogs.com/blog-lhong/p/11776042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!