Jetty high availability keeps a single application endpoint reachable during node failure by moving both the service and its virtual IP address together.

The pcs CLI configures Pacemaker resources backed by Corosync messaging. A floating IPv4 address is provided by the OCF IPaddr2 resource agent, while a systemd resource starts and stops Jetty using its unit file. Grouping the resources enforces colocation and ensures the VIP is assigned before the application is started.

Cluster nodes must share the same Layer-2 network for the VIP so ARP announcements propagate during failover. Jetty binaries and configuration must match on each node, and application state should be stored outside the process (database, cache, shared storage) to avoid session loss on failover. Existing TCP connections drop during a move, so upstream timeouts and retries should tolerate brief resets.

Steps to set up Jetty high availability with PCS:

  1. Confirm cluster status reports 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
      * 0 resource instances configured
    ##### snipped #####
  2. Identify the Jetty systemd unit name for cluster control.
    $ systemctl list-unit-files --type=service | grep -E '^jetty.*\.service'
    jetty9.service                               enabled         enabled
  3. Disable Jetty automatic startup outside pcs control.
    $ sudo systemctl disable --now jetty9
    Synchronizing state of jetty9.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
    Executing: /usr/lib/systemd/systemd-sysv-install disable jetty9
    Removed "/etc/systemd/system/multi-user.target.wants/jetty9.service".
    ##### snipped #####

    Active connections to Jetty drop when the service stops.

  4. Create a floating IP resource for the application endpoint.
    $ sudo pcs resource create jetty_ip ocf:heartbeat:IPaddr2 ip=192.0.2.62 cidr_netmask=24 op monitor interval=30s

    Using an IP address already assigned on the network causes address conflicts and intermittent outages.

    Add nic=<interface> to the IPaddr2 resource when multiple interfaces share the same subnet.

  5. Create the Jetty service resource.
    $ sudo pcs resource create jetty_service systemd:jetty9 op monitor interval=30s

    Use the unit name returned by systemctl, such as systemd:jetty9.

  6. Group the IP resource with the Jetty resource.
    $ sudo pcs resource group add jetty-stack jetty_ip jetty_service
  7. Verify the resource group placement.
    $ sudo pcs status resources
      * Resource Group: jetty-stack:
        * jetty_ip	(ocf:heartbeat:IPaddr2):	 Started node-01
        * jetty_service	(systemd:jetty9):	 Started node-01

    Both resources should show Started on the same node.

  8. Confirm the endpoint answers on the floating IP address.
    $ curl -I http://192.0.2.62:8080/
    HTTP/1.1 200 OK
    Last-Modified: Thu, 01 Jan 2026 06:29:10 GMT
    Content-Type: text/html
    Accept-Ranges: bytes
    Content-Length: 1004
    Server: Jetty(9.4.53.v20231009)

    An HTTP response confirms the VIP and Jetty are reachable; the status code depends on the deployed application path.

  9. Run a failover test with the resource group in Started state.

    Failover moves terminate existing client connections and may trigger upstream retries.