前面几篇博客已经介绍了如何去一步一步的搭建云平台,无论是执行脚本还是手动搭建,整个过程也是有些漫长
本篇博客将会介绍如何去做Lbaas负载均衡
接下来可以使用我们的命令去查看我们的Lbaas有关情况和详情细节
[root@controller bin]# neutron agent-list
+-----------------------+--------------------+------------+-------------------+-------+----------------+-----------------------+
| id | agent_type | host | availability_zone | alive | admin_state_up | binary |
+-----------------------+--------------------+------------+-------------------+-------+----------------+-----------------------+
| 4df7bdd9-fb4d-475d-97 | Metadata agent | controller | | :-) | True | neutron-metadata- |
| 87-9bb2b9ebfdd1 | | | | | | agent |
| 6b0947ae-1af0-4f23 | Open vSwitch agent | compute | | :-) | True | neutron-openvswitch- |
| -a80c-4bb393006b7f | | | | | | agent |
| 6e5272b3-d348-410c- | Metadata agent | compute | | :-) | True | neutron-metadata- |
| b6f5-aba798fc6b1a | | | | | | agent |
| 75aff0be-81af-4d8a-a4 | L3 agent | controller | nova | :-) | True | neutron-l3-agent |
| 73-037c6b9d840d | | | | | | |
| 9784d842-d2b6-46a6-b6 | DHCP agent | controller | nova | :-) | True | neutron-dhcp-agent |
| a3-05f036778267 | | | | | | |
| a3e77f5d-390c-4201-bc | Loadbalancer agent | controller | | :-) | True | neutron-lbaas-agent |
| 16-f46a47551bcc | | | | | | |
| e944fb07-06e8-448c- | Open vSwitch agent | controller | | :-) | True | neutron-openvswitch- |
| bd70-be93e7ce1713 | | | | | | agent |
+-----------------------+--------------------+------------+-------------------+-------+----------------+-----------------------+
[root@controller bin]# neutron lb-pool-show resourcepool
Unable to find pool with name or id 'resourcepool'
[root@controller bin]# neutron lb-pool-list
+--------------------------------------+---------------+----------+-------------+----------+----------------+--------+
| id | name | provider | lb_method | protocol | admin_state_up | status |
+--------------------------------------+---------------+----------+-------------+----------+----------------+--------+
| a84b45ce-7fcf-4543-b207-2e489fa0722b | resource_pool | haproxy | ROUND_ROBIN | HTTP | True | ACTIVE |
+--------------------------------------+---------------+----------+-------------+----------+----------------+--------+
[root@controller bin]# neutron lb-pool-show resource_pool
+------------------------+--------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------------+--------------------------------------------------------------------------------------------------------+
| admin_state_up | True |
| description | resource_pool |
| health_monitors | 1b52b92e-dd44-4c43-98f5-4be55ae0cd01 |
| health_monitors_status | {"monitor_id": "1b52b92e-dd44-4c43-98f5-4be55ae0cd01", "status": "ACTIVE", "status_description": null} |
| id | a84b45ce-7fcf-4543-b207-2e489fa0722b |
| lb_method | ROUND_ROBIN |
| members | 58044b7b-3bf9-4f19-9c44-2687b3508a3a |
| name | resource_pool |
| protocol | HTTP |
| provider | haproxy |
| status | ACTIVE |
| status_description | |
| subnet_id | 01655c52-a687-4d29-81df-15b15fa70d88 |
| tenant_id | 7551518924a3446dad5827159148db8b |
| vip_id | 5926749c-6994-45fe-97b3-5649ae0cb247 |
+------------------------+--------------------------------------------------------------------------------------------------------+
[root@controller bin]# neutron lb-vip-list
+--------------------------------------+------------------+----------+----------+----------------+--------+
| id | name | address | protocol | admin_state_up | status |
+--------------------------------------+------------------+----------+----------+----------------+--------+
| 5926749c-6994-45fe-97b3-5649ae0cb247 | resource_poolVip | 10.0.0.4 | HTTP | True | ACTIVE |
+--------------------------------------+------------------+----------+----------+----------------+--------+
[root@controller bin]# neutron lb-vip-show resource_poolVip
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| address | 10.0.0.4 |
| admin_state_up | True |
| connection_limit | -1 |
| description | resource_poolV |
| id | 5926749c-6994-45fe-97b3-5649ae0cb247 |
| name | resource_poolVip |
| pool_id | a84b45ce-7fcf-4543-b207-2e489fa0722b |
| port_id | fae1af3f-a88a-4969-8291-9b5a86b93362 |
| protocol | HTTP |
| protocol_port | 80 |
| session_persistence | |
| status | ACTIVE |
| status_description | |
| subnet_id | 01655c52-a687-4d29-81df-15b15fa70d88 |
| tenant_id | 7551518924a3446dad5827159148db8b |
+---------------------+--------------------------------------+
查看资源池的haproxy配置文件
[root@controller bin]# cat /var/lib/neutron/lbaas/a84b45ce-7fcf-4543-b207-2e489fa0722b/conf
global
daemon
user nobody
group haproxy
log /dev/log local0
log /dev/log local1 notice
stats socket /var/lib/neutron/lbaas/a84b45ce-7fcf-4543-b207-2e489fa0722b/sock mode 0666 level user
defaults
log global
retries 3
option redispatch
timeout connect 5000
timeout client 50000
timeout server 50000
frontend 5926749c-6994-45fe-97b3-5649ae0cb247
option tcplog
bind 10.0.0.4:80
mode http
default_backend a84b45ce-7fcf-4543-b207-2e489fa0722b
option forwardfor
backend a84b45ce-7fcf-4543-b207-2e489fa0722b
mode http
balance roundrobin
option forwardfor
timeout check 20s
option httpchk GET /
http-check expect rstatus 200
server 58044b7b-3bf9-4f19-9c44-2687b3508a3a 10.0.0.3:80 weight 5 check inter 30s fall 5[root@controller bin]#