目录
neutron集群和其他服务的集群一样,可以先安装一台neutron服务,然后将本台neutron服务配置,同步到其他neutron节点,这里先安装zcontrollera1节点,即以下所有步骤都在zcontrollera1节点执行。
一、neutron安装
1.创建数据库
**1q2w3e4r是neutron数据库的密码
mysql -h vip -uroot -p -e "
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '1q2w3e4r';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '1q2w3e4r';
flush privileges;
"
2.创建用户以及端点
** neutron用户的密码是1q2w3e4r
. admin-openrc
openstack user create --domain default --password=1q2w3e4r neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron --description "OpenStack Networking" network
openstack endpoint create --region RegionOne network public http://vip:9696
openstack endpoint create --region RegionOne network internal http://vip:9696
openstack endpoint create --region RegionOne network admin http://vip:9696
3.安装相关模块
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y
4.配置nova.conf
[neutron]
url = http://vip:9696
auth_url = http://vip:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron用户的密码
service_metadata_proxy = true
metadata_proxy_shared_secret = metadata
5.配置metadata_agent.ini
[DEFAULT]
nova_metadata_ip = vip
metadata_proxy_shared_secret = metadata
6.配置ml2_conf.ini
[ml2]
tenant_network_types = vlan
type_drivers = vlan,flat
mechanism_drivers = linuxbridge
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[securitygroup]
enable_ipset = True
#vlan
[ml2_type_valn]
network_vlan_ranges = provider:3001:4000
7.配置linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:当前节点管理网卡
[vxlan]
enable_vxlan = false
#local_ip = 10.2.1.20
#l2_population = true
[agent]
prevent_arp_spoofing = True
[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
enable_security_group = True
8.配置dhcp_agent.ini
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
9.配置neutron.conf
[DEFAULT]
bind_port = 9696
bind_host = 当前节点ip
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = true
transport_url = rabbit://openstack:rabbit用户密码@rabbit部署节点1的ip:5672,rabbit部署节点2的ip:5672
auth_strategy = keystone
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
[keystone_authtoken]
auth_uri = http://vip:5000
auth_url = http://vip:35357
memcached_servers = 缓存部署节点1的ip:11211,缓存部署节点2的ip:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron用户的密码
[nova]
auth_url = http://vip:35357
auth_type = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = nova
password = nova用户的密码
[database]
connection = mysql://neutron:nutron数据库的密码@vip:3306/neutron
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
10.配置l3_agent.ini
[DEFAULT]
interface_driver = linuxbridge
11.同步数据库
#同步数据库
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
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
#检测数据
mysql -h vip -u neutron -p -e "use neutron;show tables;"
12.haproxy配置
echo '
#Neutron_API
listen Neutron_API_cluster
bind 10.27.31.154:9696
balance source
option tcpka
option tcplog
server neutron部署节点1的ip neutron部署节点1的ip:9696 check inter 2000 rise 2 fall 5
server neutron部署节点2的ip neutron部署节点2的ip:9696 check inter 2000 rise 2 fall 5
'>>/etc/haproxy/haproxy.cfg
13.启动服务
#启动haproxy服务
systemctl restart haproxy.service
netstat -antp|grep haproxy
#重启相关服务
systemctl restart openstack-nova-api.service
#启动neutron
systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
systemctl restart neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
二、安装其他节点neutron
1.安装模块
ssh 要安装neutron节点的ip 'yum install -y openstack-neutron openstack-neutron-ml2 \
openstack-neutron-linuxbridge python-neutronclient ebtables ipset'
2.同步配置
rsync -avzP -e 'ssh -p 22' /etc/nova/* 要安装的neutron节点ip:/etc/nova/
rsync -avzP -e 'ssh -p 22' /etc/neutron/* 要安装的neutron节点ip:/etc/neutron/
rsync -avzP -e 'ssh -p 22' /etc/haproxy/* 要安装的neutron节点ip:/etc/haproxy/
3.修改配置
**将每个节点下的nova.conf中以下配置修改成自己节点的IP
my_ip = 当前节点的IP地址
osapi_compute_listen = 当前节点的IP地址
metadata_listen = 当前节点的IP地址
**将每个节点下的neutron.conf中以下配置修改成自己节点的IP
bind_host = 当前节点的ip
4.重启相关服务
ssh 要配置neutron节点的IP "systemctl restart haproxy openstack-nova-api.service"
ssh 要配置neutron节点的IP "systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service"
ssh 要配置neutron节点的IP "systemctl start neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service"