A19. openstack架构实战-云主机的冷迁移

1:开启nova计算节点之间互信

冷迁移需要nova计算节点之间使用nova用户互相免密访问

默认nova用户禁止登入,开启所有计算节点的nova用户登入shell。

[root@compute01 ~]# su - nova
This account is currently not available.

所有计算几点都需要开启:

[root@compute01 ~]# usermod  -s /bin/bash nova

[root@compute02 ~]# usermod  -s /bin/bash nova

[root@compute02 ~]# su - nova
-bash-4.2$ cp /etc/skel/.bash* .
-bash-4.2$ exit
logout
[root@compute02 ~]# su - nova
Last login: Sun Jun  7 14:14:50 CST 2020 on pts/0
[nova@compute02 ~]$

 

生成密钥对进行免密通信:

[root@compute02 ~]# su - nova
[nova@compute02 ~]$ ssh-keygen -t rsa -q -N ''
Enter file in which to save the key (/var/lib/nova/.ssh/id_rsa):
[nova@compute02 ~]$ ls .ssh/
id_rsa  id_rsa.pub

将自己和自己进行通信

[nova@compute02 ~]$ cp -fa .ssh/id_rsa.pub .ssh/authorized_keys

将密钥拷贝到其他的通信节点:

[nova@compute02 ~]$ scp -rp .ssh root@10.100.214.202:`pwd`

授权nova用户使用密钥的权限:

[root@compute01 ~]# ll /var/lib/nova/.ssh/
total 16
-rw-r--r-- 1 root root  396 Jun  7 14:17 authorized_keys
-rw------- 1 root root 1675 Jun  7 14:17 id_rsa
-rw-r--r-- 1 root root  396 Jun  7 14:17 id_rsa.pub
-rw-r--r-- 1 root root  176 Jun  7 14:21 known_hosts

 

[root@compute01 ~]# chown  -R nova:nova  /var/lib/nova/.ssh/

测试两个计算节点是否可以免密登入:

 

2:修改控制节点的配置文件

vim /etc/nova/nova.conf

[DEFAULT]
scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter

重启调度服务:

[root@controller01 ~]# systemctl restart openstack-nova-scheduler.service

 

3:修改计算几点的配置文件:

[root@compute01 ~]# vim /etc/nova/nova.conf

[DEFAULT]
allow_resize_to_same_host = True

 

重启计算服务:

[root@compute01 ~]# systemctl restart openstack-nova-compute

 

在dashboard上进行操作,测试云主机是否迁移:

 

 

 

 

 

posted @ 2020-06-07 14:46  Mr-呵呵哒  阅读(330)  评论(0编辑  收藏  举报