openstack-pike-HA环境部署-nova+neutron(OVS)
能业
2023-12-01
nova安装
1、首先创建nova数据库,并且赋予数据库权限
mysql -u root -p123456
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;
CREATE DATABASE nova_placement ;
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'*' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_placement.* TO 'nova'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'*' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'*' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'*' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY '123456';
source admin-openrc
2、创建nova用户
openstack user create --domain default --password-prompt nova
3、赋予admin权限
openstack role add --project service --user nova admin
4、创建service、endpoint
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region RegionOne compute public http://192.168.148.200:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://192.168.148.200:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://192.168.148.200:8774/v2.1
5、创建Placement用户
openstack user create --domain default --password-prompt placement
6、添加admin权限
openstack role add --project service --user placement admin
7、创建service服务
openstack service create --name placement --description "Placement API" placement
openstack endpoint create --region RegionOne placement public http://192.168.148.200:8778
openstack endpoint create --region RegionOne placement internal http://192.168.148.200:8778
openstack endpoint create --region RegionOne placement admin http://192.168.148.200:8778
8、安装nova服务软件包
yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-placement-api
9、修改配置文件/etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
my_ip = 192.168.148.47
novncproxy_host = 192.168.148.47
metadata_listen = 192.168.148.47
osapi_volume_listen = 192.168.148.47
osapi_compute_listen = 192.168.148.47
ec2_listen = 192.168.148.47
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
transport_url = rabbit://openstack:123456@192.168.148.200
[api]
auth_strategy = keystone
[api_database]
connection = mysql+pymysql://nova:123456@192.168.148.200/nova_api
[database]
connection = mysql+pymysql://nova:123456@192.168.148.200/nova
[glance]
api_servers = http://192.168.148.200:9292
[keystone_authtoken]
auth_uri = http://192.168.148.200:5000
auth_url = http://192.168.148.200:35357
memcached_servers = controller1:11211,controller2:11211,controller3:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = 123456
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[placement]
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://192.168.148.200:35357/v3
username = placement
password = 123456
[vnc]
enabled = true
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
10、编辑配置文件/etc/httpd/conf.d/00-nova-placement-api.conf增加以下配置
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
重启httpd服务
systemctl restart httpd
11、同步数据库
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
su -s /bin/sh -c "nova-manage db sync" nova
进入数据库查看nova数据库中是否有表
执行nova-manage验证
nova-manage cell_v2 list_cells
11、启动nova服务,并且设置开机自启动
systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
####################################################################################
网络节点安装neutron,这里我使用的是openvswhitch
1、首先进入数据库,创建neutron数据库并且设置权限
mysql -u root -p123456
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'*' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '123456';
2、创建neutron用户、赋予admin权限
openstack user create --domain default --password-prompt neutron
openstack role add --project service --user neutron admin
3、创建neutron service、创建endpoint
openstack service create --name neutron --description "OpenStack Networking" network
openstack endpoint create --region RegionOne network public http://192.168.148.200:9696
openstack endpoint create --region RegionOne network internal http://192,168.148.200:9696
openstack endpoint create --region RegionOne network admin http://192.168.148.200:9696
4、安装neutron软件包
yum -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch
5、修改配置文件/etc/neutron/neutron.conf
[DEFAULT]
bind_host = 192.168.148.47
bind_port = 9696
l3_ha = True
max_l3_agents_per_router = 0
min_l3_agents_per_router = 2
core_plugin = ml2
service_plugins = router
auth_strategy = keystone
state_path = /var/lib/neutron
dhcp_agent_notification = True
allow_overlapping_ips = True
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
transport_url = rabbit://openstack:123456@192.168.148.200
[keystone_authtoken]
auth_uri = http://192.168.148.200:5000
auth_url = http://192.168.148.200:35357
memcached_servers = controller1:11211,controller2:11211,controller3:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = 123456
[database]
connection = mysql+pymysql://neutron:123456@192.168.148.200/neutron
[nova]
auth_url = http://192.168.148.200:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = 123456
[oslo_concurrency]
lock_path = $state_path/tmp
修改配置文件/etc/neutron/metadata_agent.ini
[DEFAULT]
nova_metadata_host = 192.168.148.47
metadata_proxy_shared_secret = 123456
[cache]
memcache_servers = controller1:11211,controller2:11211,controller3:11211
修改配置文件/etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
enable_security_group = True
enable_ipset = True
修改配置文件/etc/nova/nova.conf
[DEFAULT]
use_neutron = True
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[neutron]
url = http://192.168.148.200:9696
auth_url = http://192.168.148.200:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 123456
service_metadata_proxy = True
metadata_proxy_shared_secret = 123456
6、创建文件软连接(三节点执行)
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
7、同步数据库
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
8、重启openstack-nova-api(三节点执行)
systemctl restart openstack-nova-api.service
9、启动neutron服务(三节点执行)
systemctl start neutron-server neutron-metadata-agent
systemctl enable neutron-server neutron-metadata-agent
10、修改配置文件/etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
11、修改配置文件/etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
12、启动openvswitch服务
systemctl enable openvswitch
systemctl start openvswitch
13、创建网桥
ovs-vsctl add-br br-int
14、启动服务并设置开机启动
systemctl restart neutron-dhcp-agent neutron-l3-agent neutron-metadata-agent neutron-openvswitch-agent
systemctl enable neutron-dhcp-agent neutron-l3-agent neutron-metadata-agent neutron-openvswitch-agent