• Rolling restart replicated services behind an application load balancer

    by  • November 7, 2012 • General • 0 Comments

    Usually following a new release deployment the operation engineer needs to do a rolling restart of the running services.
    In order to avoid restarting the services at the same time and thus generating an out-of-service window you can use the following cluster command:

    $ sleep $((10+`HOST=$(hostname -s) bash -c 'echo ${HOST:${#HOST}-1}'`))
    $ service my-replicated-service restart

    The command above assumes your nodes in cluster have an numeric char suffix in their name – usually they do have – and sleeps a different number of second for each host.
    Enjoy it!


    Software surveyor

    Leave a Reply

    Your email address will not be published. Required fields are marked *