Running the same application service on multiple cluster nodes increases total capacity and keeps requests flowing during node maintenance or unexpected outages. An active-active pattern keeps more than one instance available at the same time, while external routing decides which node receives each request.

The pcs CLI configures Pacemaker resources and constraints on top of the Corosync cluster stack. A systemd resource tells Pacemaker how to start and stop a unit with systemctl, and a cloned resource runs one instance per eligible node while Pacemaker continuously monitors health using the configured operations.

Active-active control assumes the service is safe for parallel execution across nodes and that any shared state (files, caches, databases, locks) is designed for concurrent access. Traffic distribution is not handled by Pacemaker for cloned services, so load balancers, DNS, or upstream proxies must be updated to include only healthy nodes and to drain nodes during maintenance.

Steps to set up an active-active systemd service with PCS:

  1. Confirm the cluster is online with quorum.
    $ sudo pcs status
    Cluster name: clustername
    Cluster Summary:
      * Stack: corosync (Pacemaker is running)
      * Current DC: node-01 (version 2.1.6-6fdc9deea29) - partition with quorum
      * 3 nodes configured
    ##### snipped #####
  2. Identify the systemd unit name intended for active-active control.
    $ systemctl list-unit-files app.service --no-pager --no-legend
    app.service enabled enabled
  3. Stop the service on every cluster node.
    $ sudo systemctl stop app.service

    Stopping a production service can interrupt traffic on that node; drain or remove the node from routing before stopping the unit.

  4. Disable the service at boot on every cluster node.
    $ sudo systemctl disable app.service
    Removed "/etc/systemd/system/multi-user.target.wants/app.service".

    Pacemaker can start a disabled unit, but disabling prevents it from starting outside cluster control.

  5. Create the Pacemaker resource for the systemd unit.
    $ sudo pcs resource create app_service systemd:app op monitor interval=30s

    Use the unit name without the .service suffix in systemd:<name> (systemd:app manages app.service).

  6. Clone the resource to run one instance per node.
    $ sudo pcs resource clone app_service meta clone-max=2 clone-node-max=1

    Set clone-max to the number of nodes that should run the service, and keep clone-node-max at 1 to prevent duplicate instances on a single node.

  7. Verify the cloned resource is started on the expected nodes.
    $ sudo pcs status resources
    ##### snipped #####
      * Clone Set: app_service-clone [app_service]:
        * Started: [ node-02 node-03 ]
  8. Add a server line for every cluster node under the backend for this service in /etc/haproxy/haproxy.cfg on the load balancer.
    backend app_nodes
        balance roundrobin
        server node-01 192.0.2.11:8080 check
        server node-02 192.0.2.12:8080 check
        server node-03 192.0.2.13:8080 check

    With clone-max=2 on three nodes, the idle node shows as down in HAProxy until Pacemaker starts an instance there, and check then adds it to the rotation automatically. Other load balancers take the same node list in their pool settings, and DNS-based routing uses one A or AAAA record per node.

  9. Reload HAProxy to send traffic to the nodes.
    $ sudo systemctl reload haproxy
  10. Put one active node into standby to take it offline.
    $ sudo pcs node standby node-02

    Standby stops the service on that node and drops its open connections.

  11. Request the service through the load balancer to confirm traffic continues. Example output:
    $ curl -I http://app.example.net/
    HTTP/1.1 200 OK

    For a service that does not speak HTTP, a normal client connection to the load balancer address shows the same result.

  12. Return the node to the cluster.
    $ sudo pcs node unstandby node-02

    An instance that moved to a spare node stays there, so the returned node can remain idle until the next failover.

Share this guide