Certain deployment scenarios may need running of multiple
API configuration server instances for improved performance. One of
the methods to achieve this is by increasing the number of API configuration
server instances on a node after deploying Contrail
Networking. This is done by modifying the docker-compose.yaml file to allow multiple configuration API containers on the same
host.
The steps described in this topic are valid for Contrail Networking
Releases 5.0 through 2008. For release 2011 and later, refer the topic Scaling Up Contrail Networking Configuration API.
CAUTION:
Any change to the Contrail networking Configuration
API must be made only with the help of Juniper Networks Professional
Services. We strongly recommend that you contact Juniper Networks
Professional Services before you make any change to the Configuration
API.
- Edit the /etc/contrail/config/docker-compose.yaml file on each Contrail Configuration node. At the end of the API
section, at line 56, append the following chunk of code:
api-2:
image: "hub.juniper.net/contrail/contrail-controller-config-api:1912.32-rhel"
env_file: /etc/contrail/common_config.env
environment:
- CONFIG_API_PORT=18082
- CONFIG_API_INTROSPECT_PORT=17084
container_name: config_api_2
command: ["/usr/bin/contrail-api", "--conf_file", "/etc/contrail/contrail-api.conf", "--conf_file", "/etc/contrail/contrail-keystone-auth.conf", "--worker_id", "2"]
network_mode: "host"
volumes_from:
- node-init
depends_on:
- node-init
restart: always
stdin_open: True
tty: True
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "10"
Make sure that the API port, Introspect port, Worker ID and
container_name are unique within the node. The default API section
should not be changed to allow other Contrail services (for example,
Schema-transformer, SVC-Monitor or contrail-status command) to run
without configuration changes. The default API runs with port 8082,
introspect port 8084, worker_id 0 and container name config_api_1.
- Run the following commands on each configuration node
to apply the changes:
cd /etc/contrail/config
docker-compose down
docker-compose up -d
- Run the following commands on each configuration node
to verify the configuration:
pgrep -al contrail-api
ss -nlpt | grep contrail-api
Sample Output
# pgrep -al contrail-api
16922 /usr/bin/python /usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --worker_id 2
17139 /usr/bin/python /usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --worker_id 0
# ss -nlpt | grep contrail-api
LISTEN 0 128 *:17084 *:* users:(("contrail-api",pid=16922,fd=7))
LISTEN 0 128 10.0.0.16:18082 *:* users:(("contrail-api",pid=16922,fd=28))
LISTEN 0 128 10.0.0.16:8082 *:* users:(("contrail-api",pid=17139,fd=28))
LISTEN 0 128 *:8084 *:* users:(("contrail-api",pid=17139,fd=7))
- Add new server instances to load-balancer.
Sample HAProxy Configuration
listen contrail_config_internal
bind 192.168.3.90:8082 transparent
mode http
balance leastconn
option httpchk GET /
option httplog
option forwardfor
timeout client 360s
timeout server 360s
server 0contrail-ctl0.local 192.168.3.114:8082 check fall 5 inter 2000 rise 2
server 1contrail-ctl0.local 192.168.3.114:18081 check fall 5 inter 2000 rise 2
server 2contrail-ctl0.local 192.168.3.114:18082 check fall 5 inter 2000 rise 2
server 3contrail-ctl0.local 192.168.3.114:18083 check fall 5 inter 2000 rise 2
server 0contrail-ctl1.local 192.168.3.139:8082 check fall 5 inter 2000 rise 2
server 1contrail-ctl1.local 192.168.3.139:18081 check fall 5 inter 2000 rise 2
server 2contrail-ctl1.local 192.168.3.139:18082 check fall 5 inter 2000 rise 2
server 3contrail-ctl1.local 192.168.3.139:18083 check fall 5 inter 2000 rise 2
server 0contrail-ctl2.local 192.168.3.100:8082 check fall 5 inter 2000 rise 2
server 1contrail-ctl2.local 192.168.3.100:18081 check fall 5 inter 2000 rise 2
server 2contrail-ctl2.local 192.168.3.100:18082 check fall 5 inter 2000 rise 2
server 3contrail-ctl2.local 192.168.3.100:18083 check fall 5 inter 2000 rise 2
- Run the following commands to set load-balancer timeouts
and balancing method
You cannot configure timeout for the Neutron plugin. Neutron
relies on load-balancer to terminate connections. Therefore, it is
important that you increase the default timeout value of 30 seconds.
This enables Neutron to respond without error even if the Contrail
API responds longer than 30 seconds.
Sample timeout options for HAProxy
timeout client 360s
timeout server 360s
Note: It is recommended that you use load balancing methods
that distributes the load evenly across the configuration API server
instances. The preferred lod balancing methods are leastconn
and round-robin
.
CAUTION:
Increasing the number of configuration API server instances
might result in higher load on RabbitMQ and Schema-transformer.