计算节点执行
#安装软件包 [root@compute ~]# yum install openstack-nova-compute -y #修改配置文件/etc/nova/nova.conf openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:000000@controller openstack-config --set /etc/nova/nova.conf api auth_strategy keystone openstack-config --set /etc/nova/nova.conf keystone_authtoken www_authenticate_uri http://controller:5000/ openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/ 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 000000 openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.30.120 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 vnc enabled true openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0 openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address 192.168.30.120 openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.30.100:6080/vnc_auto.html openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292 openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp openstack-config --set /etc/nova/nova.conf placement region_name RegionOne openstack-config --set /etc/nova/nova.conf placement project_domain_name Default openstack-config --set /etc/nova/nova.conf placement project_name service openstack-config --set /etc/nova/nova.conf placement auth_type password openstack-config --set /etc/nova/nova.conf placement user_domain_name Default openstack-config --set /etc/nova/nova.conf placement auth_url http://controller:5000/v3 openstack-config --set /etc/nova/nova.conf placement username placement openstack-config --set /etc/nova/nova.conf placement password 000000 #启动并设置开机自启 # systemctl enable libvirtd.service openstack-nova-compute.service # systemctl start libvirtd.service openstack-nova-compute.service ##########下面验证内容在控制节点执行 [root@controller ~]# . admin-openrc [root@controller ~]# openstack compute service list --service nova-compute +----+--------------+---------+------+---------+-------+------------------------- ---+ | ID | Binary | Host | Zone | Status | State | Updated At | + +--------------+---------+------+---------+-------+------------------------- + | 16 | nova-compute | compute | nova | enabled | up | 2023-06- 14T12:07:30.000000 | + +--------------+---------+------+---------+-------+------------------------- ---+ #发现主机 [root@controller ~]# 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': 08592c30-e258-4229-ad4e-40d17e42c8c2 Checking host mapping for compute host 'compute': 4a3d1eb5-e986-4aef-bf49- 2665a325bea2 Creating host mapping for compute host 'compute': 4a3d1eb5-e986-4aef-bf49- 2665a325bea2 Found 1 unmapped computes in cell: 08592c30-e258-4229-ad4e-40d17e42c8c2 [root@controller ~]# openstack-config --set /etc/nova/nova.conf scheduler discover_hosts_in_cells_interval 300
OpenStack Networking组件(也称为Neutron)是OpenStack云平台的一个核心组件,它提供了网络服 务和连接虚拟机实例的网络功能。
OpenStack Networking组件的主要作用是:
1. 提供虚拟网络和子网创建、管理和删除的功能,使用户可以在OpenStack云平台上创建和管理虚拟 网络。
2. 提供虚拟路由器和防火墙的功能,使用户可以在OpenStack云平台上创建和管理虚拟路由器和防火 墙。
3. 提供网络安全组的功能,使用户可以在OpenStack云平台上创建和管理网络安全组,从而控制虚拟 机实例的网络访问。
4. 提供Load Balancer的功能,使用户可以在OpenStack云平台上创建和管理Load Balancer,从而实 现负载均衡。
5. 提供VPN服务的功能,使用户可以在OpenStack云平台上创建和管理VPN连接,从而实现安全的远 程访问。
总之, OpenStack Networking组件提供了丰富的网络服务和功能,使用户可以更加灵活地管理和控制虚 拟网络,从而更好地满足业务需求。
#进入数据库 [root@controller ~]# mysql #创建数据库 MariaDB [(none)]> CREATE DATABASE neutron; Query OK, 1 row affected (0.000 sec) #对数据库进行授权 MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \ -> IDENTIFIED BY '000000'; Query OK, 0 rows affected (0.000 sec) #加载认证文件 [root@controller ~]# source admin-openrc #创建neutron 用户 [root@controller ~]# openstack user create --domain default --password-prompt neutron User Password: 000000 Repeat User Password: 000000 +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | default | | enabled | True | | id | b8749ff590af496998cfc1e9078d7c90 | | name | neutron | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ #将neutron用户添加到admin项目组里 [root@controller ~]# openstack role add --project service --user neutron admin #创建neutron服务实体: [root@controller ~]# openstack role add --project service --user neutron admin [root@controller ~]# openstack service create --name neutron \ > --description "OpenStack Networking" network +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Networking | | enabled | True | | id | f429380116a440faa1d9e562b6cfc694 | | name | neutron | | type | network | +-------------+----------------------------------+ #创建网络服务API端点: [root@controller ~]# openstack endpoint create --region RegionOne \ > network public http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 3a8667f564cd47388cbed7efa475d8ef | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | f429380116a440faa1d9e562b6cfc694 | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne \ > network internal http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | f70a67dd37d94d11958ccf9b44a044bb | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | f429380116a440faa1d9e562b6cfc694 | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne \ > network admin http://controller:9696 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | ae18f4ecfb7a4e64b717a56a2616a5e6 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | f429380116a440faa1d9e562b6cfc694 | | service_name | neutron | | service_type | network | | url | http://controller:9696 | +--------------+----------------------------------+ ##########配置网络######## #安装软件包 [root@controller ~]# yum install openstack-neutron openstack-neutron-ml2 \ > openstack-neutron-linuxbridge ebtables -y #修改配置文件 /etc/neutron/neutron.conf [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf database connection mysql+pymysql://neutron:000000@controller/neutron [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT core_plugin ml2 [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT service_plugins [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:000000@controller [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken www_authenticate_uri http://controller:5000 [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://controller:5000 [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken memcached_servers controller:11211 [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name default [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name default [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password 000000 [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_status_changes true [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT notify_nova_on_port_data_changes true [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova auth_url http://controller:5000 [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova auth_type password [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova project_domain_name default [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova user_domain_name default [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova region_name RegionOne [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova project_name service [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova username nova [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf nova password 000000 [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf ml2 type_drivers flat,vlan [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf ml2 tenant_network_types [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf ml2 mechanism_drivers linuxbridge [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf ml2 extension_drivers port_security [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf ml2_type_flat flat_networks provider [root@controller ~]# openstack-config --set /etc/neutron/neutron.conf securitygroup enable_ipset true #修改配置文件/etc/neutron/plugins/ml2/linuxbridge_agent.ini [root@controller network-scripts]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings = provider:ens34 [root@controller network-scripts]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan false [root@controller network-scripts]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group true [root@controller network-scripts]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver [root@controller network-scripts]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini DEFAULT interface_driver linuxbridge [root@controller network-scripts]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini DEFAULT dhcp_driver neutron.agent.linux.dhcp.Dnsmasq [root@controller network-scripts]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini DEFAULT enable_isolated_metadata true #修改配置文件 /etc/neutron/metadata_agent.ini [root@controller network-scripts]# openstack-config --set /etc/neutron/metadata_agent.ini DEFAULT nova_metadata_host controller [root@controller network-scripts]# openstack-config --set /etc/neutron/metadata_agent.ini DEFAULT metadata_proxy_shared_secret 000000 #修改配置文件 /etc/nova/nova.conf [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron auth_url http://controller:5000 [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron auth_type password [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron project_domain_name default [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron user_domain_name default [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron project_name service [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron username neutron [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron password 000000 [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron service_metadata_proxy true [root@controller network-scripts]# openstack-config --set /etc/nova/nova.conf neutron metadata_proxy_shared_secret 000000 #创建软链接 [root@controller network-scripts]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini #导入数据库 [root@controller network-scripts]# su -s /bin/sh -c "neutron-db-manage --config- file /etc/neutron/neutron.conf \ #重启服务 [root@controller network-scripts]# systemctl restart openstack-nova-api.service #启动服务并设置开机自启 [root@controller network-scripts]# systemctl enable neutron-server.service \ > neutron-linuxbridge-agent.service neutron-dhcp-agent.service \ > neutron-metadata-agent.service Created symlink from /etc/systemd/system/multi-user.target.wants/neutron- server.service to /usr/lib/systemd/system/neutron-server.service. Created symlink from /etc/systemd/system/multi-user.target.wants/neutron- linuxbridge-agent.service to /usr/lib/systemd/system/neutron-linuxbridge- agent.service. Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-dhcp- agent.service to /usr/lib/systemd/system/neutron-dhcp-agent.service. Created symlink from /etc/systemd/system/multi-user.target.wants/neutron- metadata-agent.service to /usr/lib/systemd/system/neutron-metadata-agent.service. [root@controller network-scripts]# systemctl start neutron-server.service \ > neutron-linuxbridge-agent.service neutron-dhcp-agent.service \ > neutron-metadata-agent.service [root@controller network-scripts]# systemctl enable neutron-l3-agent.service Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-l3- agent.service to /usr/lib/systemd/system/neutron-l3-agent.service. [root@controller network-scripts]# systemctl start neutron-l3-agent.service
#安装软件包 [root@compute ~]# yum install openstack-neutron-linuxbridge ebtables ipset -y #修改配置文件/etc/neutron/neutron.conf [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:000000@controller [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken www_authenticate_uri http://controller:5000 [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://controller:5000 [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken memcached_servers controller:11211 [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name default [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name default [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password 000000 [root@compute ~]# openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp ####配置网卡 #修改配置文件 [root@compute ~]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings provider:ens34 [root@compute ~]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan false [root@compute ~]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group true [root@compute ~]# openstack-config --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver [root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron auth_url http://controller:5000 [root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron auth_type password |
[root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron project_domain_name default [root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron user_domain_name default [root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron RegionOne [root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron service |
region_name project_name |
[root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron username neutron [root@compute ~]# openstack-config --set /etc/nova/nova.conf neutron password 000000 [root@compute ~]# systemctl restart openstack-nova-compute.service [root@compute ~]# systemctl enable neutron-linuxbridge-agent.service Created symlink from /etc/systemd/system/multi-user.target.wants/neutron- linuxbridge-agent.service to /usr/lib/systemd/system/neutron-linuxbridge- agent.service. [root@compute ~]# systemctl start neutron-linuxbridge-agent.service |