Install HA modules
This topic describes how to install High Availability, haproxy and keepalived. In case of using external Load balancer, you don't need install them. Instead of that, properly configure the load balancer.**Target Server: Contrail1-3
1.Set variables
Set variables of IP address, Physical NIC and so on for easy installation.
Modify sample below to IP address and servers of your actual environment.
HOST=10.84.50.131 ## Set IP address of an Installation server
IVIP=10.84.50.139 ## Set Virtual IP address of Control/Data
IVIP_name=10_84_50_139 ## An identification of keepalived for Control/Data
IDEV=eth0 ## A name of Physical NIC for Control/Data
EVIP_name=172_27_115_159 ## An identification of keepalived for Management
EVIP=172.27.115.159 ## Set Virtual IP address of Management
EDEV=eth1 ## A name of Physical NIC for Management
PRIORITY=100 ## A priority of Keepalived. Set unique number among 0-255 in each server. The server that has the biggest number elects as Master.
host1=10.84.50.131 ## Physical IP address for Control/Data of Contrail1
host2=10.84.50.132 ## Physical IP address for Control/Data of Contrail2
host3=10.84.50.133 ## Physical IP address for Control/Data of Contrail3
2.Install packages
apt-get install -y contrail-openstack-config
3.Configure haproxy
Modify configuration for Neutron, RabbitMQ, Contrail API, Discovery Server, Analytics API which needs IP address redundancy.、
External/Internal ports are below.(External port/Internal port)
Neutron
9696 / 9697
RabbitMQ
5673 / 5672
Contrail API
8082 / 9100
Discovery server
5998 / 9110
AnalyticsAPI
8081 / 9081
** Refer Juniper Official Document for Contrai Redundancy.
Copy and paste below command for Configuration.
sed -i -e '1a\ \ \ \ \ \ \ \ tune.bufsize 16384' /etc/haproxy/haproxy.cfg
sed -i -e '1a\ \ \ \ \ \ \ \ tune.maxrewrite 1024' /etc/haproxy/haproxy.cfg
echo '
listen contrail-config-stats :5937
mode http
stats enable
stats uri /
stats auth haproxy:contrail123
' >> /etc/haproxy/haproxy.cfg
echo "
##contrail-collector-marker-start
frontend contrail-analytics-api *:8081
default_backend contrail-analytics-api
backend contrail-analytics-api
option nolinger
balance roundrobin
option tcp-check
tcp-check connect port 6379
default-server error-limit 1 on-error mark-down
server $host1 $host1:9081 check inter 2000 rise 2 fall 3
server $host2 $host2:9081 check inter 2000 rise 2 fall 3
server $host3 $host3:9081 check inter 2000 rise 2 fall 3
#contrail-collector-marker-end
#contrail-config-marker-start
frontend contrail-api *:8082
default_backend contrail-api-backend
timeout client 3m
frontend neutron-server *:9696
default_backend neutron-server-backend
frontend contrail-discovery *:5998
default_backend contrail-discovery-backend
backend neutron-server-backend
option nolinger
balance roundrobin
server $host1 $host1:9697 check inter 2000 rise 2 fall 3
server $host2 $host2:9697 check inter 2000 rise 2 fall 3
server $host3 $host3:9697 check inter 2000 rise 2 fall 3
backend contrail-api-backend
option nolinger
timeout server 3m
balance roundrobin
server $host1 $host1:9100 check inter 2000 rise 2 fall 3
server $host2 $host2:9100 check inter 2000 rise 2 fall 3
server $host3 $host3:9100 check inter 2000 rise 2 fall 3
backend contrail-discovery-backend
option nolinger
balance roundrobin
server $host1 $host1:9110 check inter 2000 rise 2 fall 3
server $host2 $host2:9110 check inter 2000 rise 2 fall 3
server $host3 $host3:9110 check inter 2000 rise 2 fall 3
listen rabbitmq 0.0.0.0:5673
mode tcp
maxconn 10000
balance leastconn
option tcpka
option nolinger
option forceclose
timeout client 0
timeout server 0
timeout client-fin 60s
timeout server-fin 60s
server rabbit1 $host1:5672 weight 200 check inter 2000 rise 2 fall 3
server rabbit2 $host2:5672 weight 100 check inter 2000 rise 2 fall 3 backup
server rabbit3 $host3:5672 weight 100 check inter 2000 rise 2 fall 3 backup
#contrail-config-marker-end" >> /etc/haproxy/haproxy.cfg
4.Configure keepalived
echo "
vrrp_script chk_haproxy_INTERNAL_$IVIP_NAME {
script \"pgrep -x haproxy > /dev/null\" # verify if pid exists
interval 1
timeout 3
rise 2
fall 2
}
vrrp_script chk_ctrldatanet_INTERNAL_$IVIP_NAME {
script \"/opt/contrail/bin/chk_ctrldata.sh\"
interval 1
timeout 3
rise 1
fall 1
}
vrrp_instance INTERNAL_$IVIP_NAME {
interface $IDEV
state MASTER
preempt_delay 7
garp_master_delay 5
garp_master_repeat 3
garp_master_refresh 1
advert_int 1
virtual_router_id 100
vmac_xmit_base
priority $PRIORITY
virtual_ipaddress {
$IVIP/24 dev $IDEV
}
track_script {
chk_haproxy_INTERNAL_$IVIP_NAME
}
track_script {
chk_ctrldatanet_INTERNAL_$IVIP_NAME
}
track_interface {
$IDEV
}
}
vrrp_script chk_haproxy_EXTERNAL_$EVIP_NAME {
script \"pgrep -x haproxy > /dev/null\" # verify if pid exists
interval 1
timeout 3
rise 2
fall 2
}
vrrp_script chk_ctrldatanet_EXTERNAL_$EVIP_NAME {
script \"/opt/contrail/bin/chk_ctrldata.sh\"
interval 1
timeout 3
rise 1
fall 1
}
vrrp_instance EXTERNAL_$EVIP_NAME {
interface $EDEV
state MASTER
preempt_delay 7
garp_master_delay 5
garp_master_repeat 3
garp_master_refresh 1
advert_int 1
virtual_router_id 100
vmac_xmit_base
priority $PRIORITY
virtual_ipaddress {
$EVIP/24 dev $EDEV
}
track_script {
chk_haproxy_EXTERNAL_$EVIP_NAME
}
track_script {
chk_ctrldatanet_EXTERNAL_$EVIP_NAME
}
track_interface {
$IDEV
$EDEV
}
}" > /etc/keepalived/keepalived.conf
5.Restart each process
Reflect modified configuration of haproxy and keepalived.
service keepalived restart
service haproxy restart
Next topic is "Install Contrail Database Node".
No comments:
Post a Comment