参考官网:
http://docs.openstack.org/newton/networking-guide/config-lbaas.html#lbaas-v2-concepts
[root@control ~]# yum -y install openstack-neutron-lbaas haproxy
[root@control ~]# vim /etc/neutron/neutron.conf
[DEFAULT]
service_plugins = router,neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2
接著編輯/etc/neutron/neutron_lbaas.conf設定檔,在[service_providers]中加入以下內容:
[root@control ~]# vim /etc/neutron/neutron_lbaas.conf
[service_providers]
service_provider = LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
完成後在 Controller節點更新 Neutron 資料庫:
[root@control ~]# su -s /bin/sh -c "neutron-db-manage \
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini \
--subproject neutron-lbaas upgrade head" neutron
之後重新啟動neutron-server服務:
[root@control ~]# systemctl restart neutron-server.service
========================================
編輯/etc/neutron/lbaas_agent.ini設定檔,在[DEFAULT]部分加入以下內容:
[root@control ~]# /etc/neutron/lbaas_agent.ini
[DEFAULT]
interface_driver=neutron.agent.linux.interface.BridgeInterfaceDriver
[haproxy]
user_group = nobody
接著編輯編輯/etc/neutron/neutron_lbaas.conf設定檔,在[service_providers]部分加入以下內容:
[service_providers]
service_provider = LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
neutron-lbaasv2-agent \
--config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/lbaas_agent.ini
預設的 Horizon 目前只支援LBaaSv1,若要使用LBaaSv2則需要安裝 neutron-lbaas-dashboard。
neutron-lbaas-dashboard下载地址:
https://github.com/openstack/neutron-lbaas-dashboard
cd neutron-lbaas-dashboard
python setup.py install
重点:
Copy the _1481_project_ng_loadbalancersv2_panel.py file from the neutron-lbaas-dashboard/enabled directory into the Dashboard openstack_dashboard/enabled directory. 如果按照官网拷贝到openstack_dashboard/local/enabled会报错。
拷贝好后重启http 重启后可能web界面无法操作了,这时候删除掉_1481_project_ng_loadbalancersv2_panel.py 这个文件只保留
_1481_project_ng_loadbalancersv2_panel.pyc文件,然后再重启http服务。或者pyc文件直接使用下面压缩包中的文件即可。
If Dashboard is configured to compress static files for better performance (usually set through COMPRESS_OFFLINE in local_settings.py), optimize the static files again:
$ ./manage.py collectstatic
$ ./manage.py compress
最後檢查 Dashboard 的檔案local_settings.py,是否有開啟 UI:
OPENSTACK_NEUTRON_NETWORK = {
'enable_lb': True,
...
}
转载于:https://blog.51cto.com/shenshen/2057339