10. 增加一个计算节点¶
0. 增加计算节点需要的步骤¶
#1.配置yum源
#2.时间同步
#3.安装openstack基础包
#4.安装nova-compute
#5.安装neutron-linuxbridge-agent
#6.启动服务
#7.验证
1. 克隆compute2¶
1. 克隆模板¶
# 从模板克隆一个compute2(1核2G)
2. 修改IP¶
#1.启动compute2,修改IP为:192.168.178.32
vim /etc/sysconfig/network-script/ifcfg-eth0
#2.重启网络
systemctl restart network
#3.验证
ping baidu.com
#4.使用远程工具登录
#5.修改主机名
hostnamectl set-hostname compute2
#6.添加主节点host解析
vim /etc/hosts
192.168.178.11 controller
2. 配置yum源¶
### 1.挂载光盘目录
mount /dev/cdrom /mnt
### 2.上传openstack_rpm.tar.gz到/opt并解压
cd /opt
tar -zxvf openstack_rpm.tar.gz
#搭建openstack,一定要把rpm包保存下来!因为不同版本的软件会有很多问题!
#疑问:如何保存rpm包呢???
### 3.生成repo配置文件
echo '
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
[openstack]
name=openstack
baseurl=file:///opt/repo
gpgcheck=0
' >/etc/yum.repos.d/local.repo
### 4.生成缓存
yum makecache
### 5.设置开机自动挂载
echo 'mount /dev/cdrom /mnt'>>/etc/rc.local
chmod +x /etc/rc.d/rc.local
3. 时间同步¶
vim /etc/chrony.conf
#修改第3行为
server 192.168.178.11 iburst
#重启时间同步服务
systemctl restart chronyd
4. 安装openstack基础服务¶
# 安装openstack客户端和selinux
yum install python-openstackclient.noarch openstack-selinux.noarch -y
5. 安装nova¶
1. 安装nova服务¶
yum install openstack-nova-compute -y
yum install openstack-utils.noarch -y
2. 修改配置文件¶
#1.备份
\cp /etc/nova/nova.conf{,.bak}
#2.生成不带注释的配置文件
grep -Ev '^$|#' /etc/nova/nova.conf.bak >/etc/nova/nova.conf
#3.修改
openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
#这里修改为自己的IP地址!
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.178.32
openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken password NOVA_PASS
openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_host controller
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_userid openstack
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_password RABBIT_PASS
openstack-config --set /etc/nova/nova.conf vnc enabled True
openstack-config --set /etc/nova/nova.conf vnc vncserver_listen 0.0.0.0
openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address '$my_ip'
openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://controller:6080/vnc_auto.html
openstack-config --set /etc/nova/nova.conf neutron url http://controller:9696
openstack-config --set /etc/nova/nova.conf neutron auth_url http://controller:35357
openstack-config --set /etc/nova/nova.conf neutron auth_type password
openstack-config --set /etc/nova/nova.conf neutron project_domain_name default
openstack-config --set /etc/nova/nova.conf neutron user_domain_name default
openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne
openstack-config --set /etc/nova/nova.conf neutron project_name service
openstack-config --set /etc/nova/nova.conf neutron username neutron
openstack-config --set /etc/nova/nova.conf neutron password NEUTRON_PASS
#4.md5验证
md5sum /etc/nova/nova.conf
#5.查看
cat -n /etc/nova/nova.conf
[root@compute2 opt]# #4.md5验证
[root@compute2 opt]# md5sum /etc/nova/nova.conf
c89b1a09741ea1999cc67bb524232bbd /etc/nova/nova.conf
[root@compute2 opt]#
[root@compute2 opt]# #5.查看
[root@compute2 opt]# cat -n /etc/nova/nova.conf
1 [DEFAULT]
2 rpc_backend = rabbit
3 auth_strategy = keystone
4 my_ip = 192.168.178.32#这里修改为自己的IP地址! #这里不能这么写,否则后面启动实例会报错!!!
5 use_neutron = True
6 firewall_driver = nova.virt.firewall.NoopFirewallDriver
7 [api_database]
8 [barbican]
9 [cache]
10 [cells]
11 [cinder]
12 [conductor]
13 [cors]
14 [cors.subdomain]
15 [database]
16 [ephemeral_storage_encryption]
17 [glance]
18 api_servers = http://controller:9292
19 [guestfs]
20 [hyperv]
21 [image_file_url]
22 [ironic]
23 [keymgr]
24 [keystone_authtoken]
25 auth_uri = http://controller:5000
26 auth_url = http://controller:35357
27 memcached_servers = controller:11211
28 auth_type = password
29 project_domain_name = default
30 user_domain_name = default
31 project_name = service
32 username = nova
33 password = NOVA_PASS
34 [libvirt]
35 [matchmaker_redis]
36 [metrics]
37 [neutron]
38 url = http://controller:9696
39 auth_url = http://controller:35357
40 auth_type = password
41 project_domain_name = default
42 user_domain_name = default
43 region_name = RegionOne
44 project_name = service
45 username = neutron
46 password = NEUTRON_PASS
47 [osapi_v21]
48 [oslo_concurrency]
49 lock_path = /var/lib/nova/tmp
50 [oslo_messaging_amqp]
51 [oslo_messaging_notifications]
52 [oslo_messaging_rabbit]
53 rabbit_host = controller
54 rabbit_userid = openstack
55 rabbit_password = RABBIT_PASS
56 [oslo_middleware]
57 [oslo_policy]
58 [rdp]
59 [serial_console]
60 [spice]
61 [ssl]
62 [trusted_computing]
63 [upgrade_levels]
64 [vmware]
65 [vnc]
66 enabled = True
67 vncserver_listen = 0.0.0.0
68 vncserver_proxyclient_address = $my_ip
69 novncproxy_base_url = http://controller:6080/vnc_auto.html
70 [workarounds]
71 [xenserver]
6. 安装neutron¶
1. 安装neutron服务¶
yum install openstack-neutron-linuxbridge ebtables ipset -y
2. 修改配置文件neutron.conf¶
#1.备份
\cp /etc/neutron/neutron.conf{,.bak}
#2.生成不带注释的配置文件
grep -Ev '^$|#' /etc/neutron/neutron.conf.bak >/etc/neutron/neutron.conf
#3.修改
openstack-config --set /etc/neutron/neutron.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_uri http://controller:5000
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://controller:35357
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken memcached_servers controller:11211
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name default
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron
openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password NEUTRON_PASS
openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp
openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_host controller
openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_userid openstack
openstack-config --set /etc/neutron/neutron.conf oslo_messaging_rabbit rabbit_password RABBIT_PASS
#4.md5验证
md5sum /etc/neutron/neutron.conf
#5.查看
cat -n /etc/neutron/neutron.conf
[root@compute2 opt]# #4.md5验证
[root@compute2 opt]# md5sum /etc/neutron/neutron.conf
77ffab503797be5063c06e8b956d6ed0 /etc/neutron/neutron.conf
[root@compute2 opt]#
[root@compute2 opt]# #5.查看
[root@compute2 opt]# cat -n /etc/neutron/neutron.conf
1 [DEFAULT]
2 rpc_backend = rabbit
3 auth_strategy = keystone
4 [agent]
5 [cors]
6 [cors.subdomain]
7 [database]
8 [keystone_authtoken]
9 auth_uri = http://controller:5000
10 auth_url = http://controller:35357
11 memcached_servers = controller:11211
12 auth_type = password
13 project_domain_name = default
14 user_domain_name = default
15 project_name = service
16 username = neutron
17 password = NEUTRON_PASS
18 [matchmaker_redis]
19 [nova]
20 [oslo_concurrency]
21 lock_path = /var/lib/neutron/tmp
22 [oslo_messaging_amqp]
23 [oslo_messaging_notifications]
24 [oslo_messaging_rabbit]
25 rabbit_host = controller
26 rabbit_userid = openstack
27 rabbit_password = RABBIT_PASS
28 [oslo_policy]
29 [qos]
30 [quotas]
31 [ssl]
3. 修改配置文件linuxbridge_agent.ini¶
#1.备份
\cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini{,.bak}
#2.生成不带注释的配置文件
grep '^[a-Z\[]' /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak >/etc/neutron/plugins/ml2/linuxbridge_agent.ini
#3.修改
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings provider:eth0
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group True
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan False
#4.md5验证
md5sum /etc/neutron/plugins/ml2/linuxbridge_agent.ini
#5.查看
cat -n /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[root@compute2 opt]# #4.md5验证
[root@compute2 opt]# md5sum /etc/neutron/plugins/ml2/linuxbridge_agent.ini
3f474907a7f438b34563e4d3f3c29538 /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[root@compute2 opt]# #5.查看
[root@compute2 opt]# cat -n /etc/neutron/plugins/ml2/linuxbridge_agent.ini
1 [DEFAULT]
2 [agent]
3 [linux_bridge]
4 physical_interface_mappings = provider:eth0
5 [securitygroup]
6 enable_security_group = True
7 firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
8 [vxlan]
9 enable_vxlan = False
7. 启动服务¶
#controller
source admin-openrc
#compute2
systemctl start libvirtd openstack-nova-compute neutron-linuxbridge-agent
8. 主节点验证¶
#controller
#看compute2是否已经加入进来!
nova service-list
neutron agent-list
[root@controller ~]# nova service-list
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
| 1 | nova-conductor | controller | internal | enabled | up | 2021-12-05T02:05:01.000000 | - |
| 2 | nova-consoleauth | controller | internal | enabled | up | 2021-12-05T02:05:01.000000 | - |
| 3 | nova-scheduler | controller | internal | enabled | up | 2021-12-05T02:05:01.000000 | - |
| 6 | nova-compute | compute1 | nova | enabled | up | 2021-12-05T02:05:04.000000 | - |
| 7 | nova-compute | compute2 | nova | enabled | up | 2021-12-05T02:04:58.000000 | - |
+----+------------------+------------+----------+---------+-------+----------------------------+-----------------+
[root@controller ~]#
[root@controller ~]#
[root@controller ~]#
[root@controller ~]#
[root@controller ~]# neutron agent-list
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
| 5ced1c10-a583-412b-ac9f-04472690e23a | Linux bridge agent | controller | | :-) | True | neutron-linuxbridge-agent |
| 787e9938-4d41-4735-afc3-cd2c066d495c | Linux bridge agent | compute1 | | :-) | True | neutron-linuxbridge-agent |
| 86c73826-e063-4e71-9dc1-a652bd65f2ba | Linux bridge agent | compute2 | | :-) | True | neutron-linuxbridge-agent |
| d8af3511-2fa3-4a87-80ea-e79979021aae | Metadata agent | controller | | :-) | True | neutron-metadata-agent |
| dfaa1c3b-06a7-4687-9470-23bd1131b96e | DHCP agent | controller | nova | :-) | True | neutron-dhcp-agent |
+--------------------------------------+--------------------+------------+-------------------+-------+----------------+---------------------------+
9. 修改nova配置文件¶
# compute2
#1.修改nova配置文件,添加2行内容
vim /etc/nova/nova.conf
[libvirt]
cpu_mode = none
virt_type = qemu
#2.重启服务
systemctl restart openstack-nova-compute.service
10.测试¶
# 创建虚拟机来检查新增的计算节点是否可用!
1. 创建主机聚集¶
# 登录网页端:192.168.178.31/dashboard
# 点击左侧的系统,在下拉中点击主机聚集,然后点击右上角的创建,输入名称:oldboy,可用域:oldboy
# 然后点击右侧的管理聚集内的主机,选择compute2,然后点击创建
2. 启动实例¶
# 点击左侧的项目,选择实例,然后右上角的启动实例,输入实例名称:compute2,选择可用域为oldboy
出现报错及解决办法!!!¶
#出现问题!!!
vim /etc/nova/nova.conf
#将第4行,#及后面去掉!
4 my_ip = 192.168.178.32#这里修改为自己的IP地址!
#改成如下即可!!!
4 my_ip = 192.168.178.32
#然后重启服务
systemctl restart libvirtd openstack-nova-compute neutron-linuxbridge-agent
3. 查看实例¶
# 点击左侧的管理员,在下拉中点击实例,然后查看新启动的实例所在的主机名称!!
4. 打开控制台¶
# 如果打不开!则执行如下步骤
## compute2
#1.修改nova配置文件,添加2行内容
vim /etc/nova/nova.conf
[libvirt]
cpu_mode = none
virt_type = qemu
#2.重启服务
systemctl restart openstack-nova-compute.service
##查看windows的hosts解析是否有:192.168.178.11 controller
最后更新:
2022-02-20 04:00:12