7.2、compute节点配置
阅读原文时间:2023年07月12日阅读:1

用于创建虚拟机的节点;

0、配置openstack版本yum源:

yum install centos-release-openstack-rocky

1、nova-compute的安装;

(1)安装包:

yum install openstack-nova-compute

(2)编辑配置文件:

计算节点的/etc/nova/nova.conf配置文件和控制节点的配置文件比较相似,只要改变

部分配置即可:

1)将控制节点的配置拷贝到计算节点上:

scp -P22 /etc/nova/nova.conf root@172.16.1.12:/etc/nova/

chown -R root.nova /etc/nova/nova.conf

ls -l /etc/nova/nova.conf

-rw-r----- 1 root nova 389725 3月 29 23:59 /etc/nova/nova.conf

2)修改:

vim /etc/nova/nova.conf

[DEFAULT]

enabled_apis = osapi_compute,metadata

#启用计算和元数据的api;

transport_url = rabbit://openstack:openstack@controller

#启用RabbitMQ消息队列;

use_neutron = true

#启用neutron管理网络;

firewall_driver = nova.virt.firewall.NoopFirewallDriver

#关闭nova的防火墙使用neutron的防火墙;

[api_database]

#connection = mysql+pymysql://nova:nova@controller/nova_api

[database]

#connection = mysql+pymysql://nova:nova@controller/nova

[placement_database]

#connection = mysql+pymysql://placement:placement@controller/placement

#配置数据库;

#删除配置的数据库,由控制节点连接数据库;

[api]

auth_strategy = keystone

[keystone_authtoken]

auth_url = http://controller:5000/v3

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = nova

password = nova

#配置身份服务访问;

[vnc]

enabled = true

server_listen = 0.0.0.0

#vnc监听的网卡;

server_proxyclient_address = compute1

#vnc_proxy使用;

#vnc需要配置为本地;
novncproxy_base_url = http://controller:6080/vnc_auto.html

#URL指示您可以使用Web浏览器访问此计算节点上的实例的远程控制台的位置;

[glance]

api_servers = http://controller:9292

#配置glance;

[oslo_concurrency]

lock_path = /var/lib/nova/tmp

#锁路径;

[placement]

region_name = RegionOne

project_domain_name = Default

project_name = service

auth_type = password

user_domain_name = Default

auth_url = http://controller:5000/v3

username = placement

password = placement

[libvirt]

virt_type = qemu
#egrep -c '(vmx|svm)' /proc/cpuinfo

#如果返回的结果为0,说明该机器不支持
#虚拟化,使用的参数是virt_type = qemu

#特别注意:在虚拟机的环境下,虽然开机了虚拟化但是还是创建不

#了虚拟你,需要改为qemu;

(3)将服务加入到开机自启动并开启服务:

systemctl enable libvirtd.service openstack-nova-compute.service

systemctl start libvirtd.service openstack-nova-compute.service

(4)将计算节点添加到控制节点的单元数据库(很重要):

openstack compute service list --service nova-compute

+----+--------------+----------+------+---------+-------+----------------------------+

| ID | Binary | Host | Zone | Status | State | Updated At |

+----+--------------+----------+------+---------+-------+----------------------------+

| 6 | nova-compute | compute1 | nova | enabled | up | 2019-03-29T16:11:03.000000 |

+----+--------------+----------+------+---------+-------+----------------------------+

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

Found 2 cell mappings.

Skipping cell0 since it does not contain hosts.

Getting computes from cell 'cell1': e92cce3a-5fee-4e90-b7fe-1ef7fdfa6c69

Checking host mapping for compute host 'compute1': 36976a76-bf81-4300-900c-b4b0abbb573b

Creating host mapping for compute host 'compute1': 36976a76-bf81-4300-900c-b4b0abbb573b

Found 1 unmapped computes in cell: e92cce3a-5fee-4e90-b7fe-1ef7fdfa6c69

openstack image list

+--------------------------------------+--------+--------+

| ID | Name | Status |

+--------------------------------------+--------+--------+

| a036ec33-6df8-45ec-adbe-4b0ac189dc8c | cirros | active |

+--------------------------------------+--------+--------+

说明: 计算节点的主机名必需唯一,且在计算节点在控制节点注册后就不能再改计算节点的主机名,否则控制节点

会把改名的计算当做一台新的计算节点进行注册;

添加新计算节点时,必须在控制器节点上运行以注册这些新计算节点。或者可以设置适当的间隔;

vim /etc/nova/nova.conf

[scheduler]

discover_hosts_in_cells_interval = 300

2、neutron服务:

(1)安装软件包:

yum install openstack-neutron-linuxbridge ebtables ipset

(2)配置公共组件:

vim /etc/neutron/neutron.conf

[DEFAULT]

transport_url = rabbit://openstack:openstack@controller

#消息队列连接;

auth_strategy = keystone

#身份验证模式;

[keystone_authtoken]

www_authenticate_uri = http://controller:5000

auth_url = http://controller:5000

memcached_servers = controller:11211

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = neutron

password = neutron

#身份验证;

[oslo_concurrency]

lock_path = /var/lib/neutron/tmp

#锁定路径;

(3)配置网络选项1-提供商网络:

vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[linux_bridge]

physical_interface_mappings = provider:eth0

#配置提供物理网络的接口名称;

[vxlan]

enable_vxlan = false

#禁用vxlan重叠网络;

[securitygroup]

enable_security_group = true

firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

#启用安全组,并配置linux网桥iptables防火墙驱动程序;

以下参数在启动neutron-linuxbridge-agent.service的时候会自动设置为1,以确保

linux内核支持网桥过滤器;

sysctl net.bridge.bridge-nf-call-iptables

sysctl net.bridge.bridge-nf-call-ip6tables

(4)配置Compute服务以使用Networking服务:

vim /etc/nova/nova.conf

[neutron]

url = http://controller:9696

auth_url = http://controller:5000

auth_type = password

project_domain_name = default

user_domain_name = default

region_name = RegionOne

project_name = service

username = neutron

password = neutron

(5)重启compute服务:

systemctl restart openstack-nova-compute.service

(6)启动Linux网桥代理并将其配置为在系统引导时启动:

systemctl enable neutron-linuxbridge-agent.service

systemctl start neutron-linuxbridge-agent.service

(7)验证:

在控制节点进行验证:

openstack network agent list

+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+

| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |

+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+

| 1210dc27-0620-49d4-850e-2d3c86cf6a43 | DHCP agent | controller | nova | :-) | UP | neutron-dhcp-agent |

| 2aed088c-e3a4-4714-a63d-3056eabddafa | Linux bridge agent | controller | None | :-) | UP | neutron-linuxbridge-agent |

| 2ccc602e-29d4-46b2-a501-19a17a6a9b8f | Metadata agent | controller | None | :-) | UP | neutron-metadata-agent |

| 7021bdb8-e775-4c88-8976-06c1549f0440 | Linux bridge agent | compute1 | None | :-) | UP | neutron-linuxbridge-agent |

+--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+

openstack compute service list

+----+------------------+------------+----------+---------+-------+----------------------------+

| ID | Binary | Host | Zone | Status | State | Updated At |

+----+------------------+------------+----------+---------+-------+----------------------------+

| 1 | nova-consoleauth | controller | internal | enabled | up | 2019-03-30T09:56:26.000000 |

| 2 | nova-conductor | controller | internal | enabled | up | 2019-03-30T09:56:31.000000 |

| 3 | nova-scheduler | controller | internal | enabled | up | 2019-03-30T09:56:25.000000 |

| 6 | nova-compute | compute1 | nova | enabled | up | 2019-03-30T09:56:26.000000 |

+----+------------------+------------+----------+---------+-------+----------------------------+

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章