Restarting Routers and Message Processors without traffic impact

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

This document explains how to restart Routers and Message Processors (MPs) without impacting incoming API traffic. You may have to restart the Routers and MPs under certain circumstances. Some examples are as follows:

  • When a keystore that is directly referred to in the virtual host, target server or target endpoint is updated without using references.
  • When API proxies are partially deployed on a few MPs.

Before you begin

If you aren’t familiar with Routers and Message Processors, read Edge for Private Cloud overview.

Rolling restart of Routers without traffic impact

This section describes the steps used to restart Routers without impacting the incoming API traffic.

  1. Login to the Router that needs to be restarted.
  2. Block the health check port on the Router using the following command. This ensures that the Router is considered unhealthy and no traffic will be routed to this Router.
    sudo iptables -A INPUT -i eth0 -p tcp --dport 15999 -j REJECT
        
  3. Wait for two minutes to ensure that any inflight traffic is handled smoothly before you restart the Router. You can do this by running the sleep command as follows:
    for i in {001..120}; do sleep 1; printf "\r ${i}"; done
        
  4. Stop the Apigee Monit service as follows:
    apigee-service apigee-monit stop
        
  5. Stop the Apigee Router service as follows:
    apigee-service edge-router stop
        
  6. Start the Apigee Router service as follows:
    apigee-service edge-router start
        
  7. Wait until the Apigee Router service is started and ready to handle the incoming traffic using the following command:
    apigee-service edge-router wait_for_ready
        
  8. Start the Apigee Monit service as follows:
    apigee-service apigee-monit start
        
  9. Flush the IP tables to unblock the health check port 15999 and allow the Router to handle the traffic again by running the following commands:
    sudo iptables -F
    sudo iptables -L
        
sudo iptables -A INPUT -i eth0 -p tcp --dport 15999 -j REJECT
for i in {001..120}; do sleep 1; printf "\r ${i}"; done
apigee-service apigee-monit stop
apigee-service edge-router stop
apigee-service edge-router start
apigee-service edge-router wait_for_ready
apigee-service apigee-monit start
sudo iptables -F
sudo iptables -L

Rolling restart of Message Processors without traffic impact

This section describes the steps used to restart Message Processors (MPs) without impacting the incoming API traffic.

  1. Login to the Message Processor that needs to be restarted.
  2. Identify the health check port of the Message Processor using the following command:
    curl 0:8082/v1/servers/self -s | jq '.tags.property' | jq '.[] | select(.name=="http.port")'
        
  3. Block the health check port (identified in step 2) on the Message Processor. This ensures that the Message Processor is considered unhealthy and no traffic will be routed to this Message Processor.
    sudo iptables -A INPUT -i eth0 -p tcp --dport port # -j REJECT
        

    Where port # is the port number returned from the command performed in step 2.

  4. Wait for two minutes to ensure that any inflight traffic is handled smoothly before you restart the Message Processor. You can do this by running the sleep command as follows:
    for i in {001..120}; do sleep 1; printf "\r ${i}"; done
        
  5. Stop the Apigee Monit service as follows:
    apigee-service apigee-monit stop
        
  6. Stop the Apigee Message Processor service as follows:
    apigee-service edge-message-processor stop
        
  7. Sart the Apigee Message Processor service as follows:
    apigee-service edge-message-processor start
        
  8. Wait until the Apigee Message Processor service is started and ready to handle the incoming traffic using the following command:
    apigee-service edge-message-processor wait_for_ready
        
  9. Start the Apigee Monit service as follows:
    apigee-service apigee-monit start
        
  10. Flush the IP tables to unblock the health check port and allow the Message Processor to handle the traffic again by running the below commands:
    sudo iptables -F
    sudo iptables -L
        
curl 0:8082/v1/servers/self -s | jq '.tags.property' | jq '.[] | select(.name=="http.port")'

sudo iptables -A INPUT -i eth0 -p tcp --dport port # -j REJECT
for i in {001..120}; do sleep 1; printf "\r ${i}"; done
apigee-service apigee-monit stop
apigee-service edge-message-processor stop
apigee-service edge-message-processor start
apigee-service edge-message-processor wait_for_ready
apigee-service apigee-monit start
sudo iptables -F
sudo iptables -L

Where port # is the port number returned from the command performed in step 2.