其他分享
首页 > 其他分享> > 添加新的计算节点(老王笔记)

添加新的计算节点(老王笔记)

作者:互联网

添加新的计算节点

一、克隆计算节点 (Networking服务安装完的快照)

修改ip地址

$ vi /etc/sysconfig/network-scripts/ifcfg-ens33
	IPADDR=192.168.100.42

重启网络

$ systemctl restart network

修改所有hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 compute2	#修改
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 compute2	#修改
192.168.100.41 controller controller.locallocaldomain
192.168.100.42 compute2 compute2.locallocaldomain	#添加
192.168.100.43 compute1 compute1.locallocaldomain
192.168.100.44 block1 block1.locallocaldomain

修改hostname

$ hostnamectl set-hostname compute2

二、修改nova配置文件(新计算节点)

修改 /etc/nova/nova.conf ,修改为对应ip

$ vi /etc/nova/nova.conf
[DEFAULT]
my_ip = 192.168.100.42
...
[libvirt]
virt_type = qemu
cpu_mode = none

重启计算服务

$ systemctl restart libvirtd.service openstack-nova-compute.service

重启Linuxbridge代理

$ systemctl restart neutron-linuxbridge-agent.service

三、加入计算节点(控制节点)

发现计算节点

$ su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

查看服务状态

$ openstack hypervisor list

$ openstack compute service list --service nova-compute

$ openstack compute service list

$ openstack network agent list #缺少compute2则在compute2 重启Linuxbridge代理

创建实例,指定compute2节点

$ openstack server create --flavor m1.nano --image cirros --key-name mykey --availability-zone nova:compute2:compute2 computer2

迁移Glance到compute2

1、在控制节点停止glance服务(Controller)

$ systemctl stop openstack-glance-api.service openstack-glance-registry.service
$ systemctl disable openstack-glance-api.service openstack-glance-registry.service

2、compute2节点环境配置(Compute2)

3、对glance数据库进行修改(Controller)

4、安装配置glance服务(Compute2)

5、镜像文件迁移(Compute2)

$ scp -rp 192.168.100.41:/var/lib/glance/images/* /var/lib/glance/images/

修改权限

$ chown glance:glance /var/lib/glance/images/*

6、修改keystone里的glance的服务命令(控制节点)

$ openstack endpoint list|grep image
# 备份endpoint表(也可以用数据库的update语句完成)
$ mysqldump keystone endpoint >endpoint.sql
$ cp endpoint.sql /opt/
$ vi endpoint.sql
	:%s#http://controller:9292#http://192.168.100.42:9292#gc
	:wq
# 或直接搜索修改
$ mysql keystone < endpoint.sql
$ openstack endpoint list|grep image
$ openstack image list

7、修改所有节点nova的配置文件(所有节点)

$ sed 's#api_servers = http://controller:9292#api_servers = http://192.168.100.42:9292#g' /etc/nova/nova.conf|grep 9292
$ sed -i 's#api_servers = http://controller:9292#api_servers = http://192.168.100.42:9292#g' /etc/nova/nova.conf|grep 9292

8、重启服务

控制节点:

$ systemctl restart openstack-nova-api

计算节点

$ systemctl restart openstack-nova-compute

9、验证以上所有操作

$ grep ERROR nova-api.log |tail -30

标签:service,老王,nova,etc,笔记,openstack,glance,节点,192.168
来源: https://www.cnblogs.com/lyjx/p/14249303.html