DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk11 min

How to Set Up Load Balancing and Failover Across Two VPS Servers

A practical architecture and runbook for balancing application traffic across two VPS servers while automatically failing over the client-facing IP when a proxy or backend fails.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run HAProxy on both VPS instances, place a shared service IP in front of them, and let Keepalived (VRRP) move that IP to the healthy node when the active proxy fails. HAProxy then checks each application backend and removes unhealthy servers from rotation. This active/standby design gives clients one stable address, but it only works when your VPS network supports a movable address or the VRRP traffic required by the design; otherwise, use health-checked DNS and accept slower, cache-dependent failover.

What the two-VPS design actually does

There are two separate availability problems to solve:

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Proxy availability: the machine accepting client connections must survive a process crash, host failure, or network interruption.
  • Application availability: the proxy must stop sending requests to an application server that is down or returning unusable responses.

Use two redundant proxy nodes, VPS A and VPS B. Install HAProxy on both. Each HAProxy instance has the same frontend and backend definitions and can send traffic to the same pool of application servers. Keepalived runs on both proxy nodes and advertises a shared virtual IP (VIP). One node owns the VIP at a time; the other is ready to claim it.

When the active node fails, loses VRRP heartbeats, or fails a configured health script, its priority drops. The standby then claims the VIP and accepts new connections. HAProxy health checks independently remove failed application backends and add them back only after they pass the configured recovery threshold. This means proxy failover and backend failover are related but not identical events.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Choose the traffic-distribution model first

Model How clients reach you Advantages Costs and limits
Active/standby with VRRP One shared VIP moves between the two proxies Simple operating model, stable client address, fast local handoff when the network supports a movable IP Requires provider support for a floating address or for VRRP on the relevant network; the standby normally carries no client traffic
Active/active proxies Traffic is distributed to both nodes through DNS, separate VIPs, or another distribution layer Uses both VPS instances and can provide more normal-operation capacity More complex distribution and monitoring; each node must be able to carry the workload if the other is lost
DNS failover Health-checked DNS returns the address of a healthy proxy Works when the two VPS instances are in separate networks or a provider cannot move an IP Recursive resolvers and clients may cache the old answer until its expiry, so convergence is slower and less predictable than moving a VIP

For two ordinary VPS servers, active/standby with a provider-supported floating IP is usually the least complicated design. Do not assume that a public VPS network behaves like a private Ethernet segment: Keepalived’s reference setup assumes two hosts on the same LAN, while arbitrary public VPS networks may block or ignore the VRRP traffic and address ownership behavior it needs.

Prerequisites and network checks

Confirm the provider’s failover mechanism

Before installing software, ask whether the provider offers a movable or floating service IP and how it is attached to another instance. Some providers expose an API operation rather than permitting customer-managed VRRP. If neither a floating-IP mechanism nor the required VRRP traffic is available, plan DNS failover instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inventory addresses and roles

  • Record the management address of VPS A and VPS B.
  • Reserve the service IP (the VIP) if your provider supports one.
  • List every application backend address and port.
  • Decide whether TLS terminates at HAProxy or is passed through as TCP.
  • Choose an application health endpoint for Layer 7 checks, such as an endpoint that verifies the service can answer a real request.

Make the two nodes equivalent

Both VPS instances should run Linux and the same major versions of HAProxy and Keepalived. Keep the HAProxy configuration, certificates and private keys, firewall rules, and health-check scripts synchronized. Configuration drift is a common form of silent single-node failure: a standby that has not received a new certificate or backend definition may claim the VIP successfully but still serve the wrong behavior.

Plan state outside the proxy

HAProxy does not replicate application state. Use a shared or replicated database, external session storage, or another application-level state strategy. Make requests idempotent where possible. If the application truly requires a user to stay on one backend, use deliberate session affinity and understand that affinity does not survive every failure scenario. A proxy handoff can preserve the service IP while still breaking in-flight connections and any state held only in the failed node.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Install and synchronize the software

  1. Install HAProxy and Keepalived from your Linux distribution’s supported packages or your organization’s standard repository on both VPS instances.
  2. Pin both nodes to the same major release lines and record the versions. Test upgrades on the standby first, then switch roles and upgrade the former active node.
  3. Place identical HAProxy frontend and backend definitions on both nodes. Keep certificates, key permissions, firewall policy, and health scripts identical as well.
  4. Store configuration in version control or another auditable synchronization system. After every change, validate the configuration on each node before reloading either one.

The exact package command depends on the Linux distribution. The important operational requirement is parity: a failover node is useful only when it has the same listeners, certificates, routes, checks, and security rules as the preferred node.

Configure HAProxy to balance healthy backends

Define the frontend

Create a frontend for each protocol you serve. An HTTP or HTTPS frontend can inspect requests at Layer 7; a TCP frontend is appropriate when HAProxy must pass an opaque protocol through without interpreting it. Bind the frontend to the service ports on the local node. When TLS terminates at HAProxy, install the certificate bundle on both nodes and keep renewal synchronized.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Define every backend with an explicit check

Each backend server should have an explicit health check. HAProxy documentation describes active checks that connect to a server or send an HTTP request at regular intervals. A TCP check proves that the target accepts connections on the configured port. An HTTP check can call an application endpoint and therefore provides a stronger signal of user-visible health.

backend app_pool
    mode http
    balance roundrobin
    option httpchk GET /health
    server app_a {{BACKEND_A_ADDRESS}}:{{BACKEND_PORT}} check
    server app_b {{BACKEND_B_ADDRESS}}:{{BACKEND_PORT}} check

The example uses template variables so you can insert your own addresses and port. If the service is not HTTP, use the appropriate TCP mode and a TCP check instead of an HTTP request. Do not point an HTTP check at an endpoint that always returns success while the application is unable to reach its database or other critical dependency; the check should represent the failure you want HAProxy to detect.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Set failure and recovery thresholds deliberately

Use fall to require consecutive failed checks before removing a server, and rise to require consecutive successful checks before returning it to rotation. HAProxy’s example uses a two-second default health-check interval and shows rise 5. Treat those as reference behavior, not universal values: shorter intervals can detect failure sooner but create more probe traffic and make transient faults more visible; higher thresholds reduce flapping but delay removal or recovery.

server app_a {{BACKEND_A_ADDRESS}}:{{BACKEND_PORT}} check fall {{FAIL_COUNT}} rise {{RECOVERY_COUNT}}

Document why you selected each threshold. Base the decision on the application’s recovery time, the cost of a false positive, and how quickly clients need a replacement backend. HAProxy keeps failed servers out of the load-balancing rotation and restores them only after the configured successes.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reload safely

Validate the HAProxy configuration on each node, reload the standby first, and verify that it can establish checks to every expected backend. Then reload the active node. Keep the previous configuration available so a failed reload can be reverted without taking down both proxies.

Configure Keepalived and the shared service IP

Build the VRRP instance

Configure a vrrp_instance on each node with the same shared virtual IP, the correct network interface, and a unique router_id per node. Give the preferred node a higher priority and the standby a lower priority. The node with the higher effective priority owns the VIP while both are healthy.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
vrrp_instance {{INSTANCE_NAME}} {
    state {{INITIAL_STATE}}
    interface {{NETWORK_INTERFACE}}
    virtual_router_id {{VRID}}
    priority {{NODE_PRIORITY}}
    virtual_ipaddress {
        {{SERVICE_VIRTUAL_IP}}
    }
    track_script {
        {{HEALTH_SCRIPT_NAME}}
    }
}

Use the same VRID and VIP on both nodes, but different priorities and unique router identifiers. The exact interface name and address notation vary by Linux distribution and provider network.

Track the service, not merely the process

Add a vrrp_script that checks HAProxy and, where appropriate, the local application path. A process-only check can report success while HAProxy is listening on the wrong address or cannot reach any usable backend. When the script fails, Keepalived lowers the node’s effective priority so the standby can claim the VIP. VRRP can therefore react to failed health checks as well as lost heartbeats.

vrrp_script {{HEALTH_SCRIPT_NAME}} {
    script "{{CHECK_COMMAND}}"
    interval {{CHECK_INTERVAL_SECONDS}}
    fall {{SCRIPT_FAIL_COUNT}}
    rise {{SCRIPT_RECOVERY_COUNT}}
    weight {{PRIORITY_ADJUSTMENT}}
}

Ensure the script is executable, has a bounded runtime, and exits nonzero for a genuinely unusable proxy path. Test it independently before enabling it in Keepalived. Keepalived documentation describes its role as providing frameworks for both load balancing and high availability; in this design, HAProxy handles backend rotation while Keepalived handles ownership of the client-facing address.

Open only the traffic you need

Permit client traffic to the service ports on the VIP, management access only from trusted networks, and the provider-approved VRRP or control-plane traffic between the two nodes. If your provider uses an API to move the floating IP, grant the narrowly scoped credentials required by that mechanism and protect them as production secrets.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Point DNS, TLS, and firewalls at the right address

For a movable VIP, create the public DNS record for that address and use the same service IP in firewall and monitoring rules. Clients continue using one name and one address while ownership moves between proxies. Install the same certificate and complete chain on both nodes; otherwise, a successful failover can become a certificate error.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a movable IP is impossible, publish health-checked DNS records for the two proxy addresses. Set a deliberately short TTL, but explain to operators that a short authoritative TTL cannot force every recursive resolver or client to discard an older answer immediately. DNS failover therefore has a convergence window during which some users still contact the failed address.

Test failover before calling it highly available

Run tests from an external client as well as from the VPS nodes. Record timestamps, observed addresses, connection errors, logs, ARP or neighbour state where applicable, DNS answers, and application health.

  1. Backend removal: disable one application backend. Confirm HAProxy marks it down, stops sending new requests to it, and logs the state change.
  2. Backend recovery: restore the backend and verify that it returns only after the configured rise count of successful checks.
  3. Process failure: stop HAProxy on the active node. Confirm the Keepalived health script lowers its priority and that the standby claims the VIP.
  4. Heartbeat or host failure: stop Keepalived, block the relevant path, or power off the active VPS in a controlled window. Confirm the standby claims the VIP and accepts new connections.
  5. Recovery and pre-emption: restore the original node and observe whether your priority and pre-emption policy return ownership as intended. Verify that an unnecessary role switch does not interrupt service.
  6. Client behavior: keep long-lived TCP connections and application reconnect logic in the test plan. In-flight sessions can break during proxy failure even when new requests recover quickly.
  7. Repeat under load: test backend loss while the proxy is failing and test proxy loss while one backend is already down. These combined cases reveal capacity and monitoring assumptions that a single fault test misses.

Capacity, sessions, and failure boundaries

Size for the loss of one node

In active/standby mode, the standby is normally idle, but it must be able to handle the expected traffic when the active node disappears. In active/active mode, both nodes receive traffic in rotation, so losing one removes capacity immediately; plan headroom accordingly rather than running both at their normal maximum.

Separate proxy health from application health

A healthy HAProxy process does not prove that the application is healthy, and a healthy backend does not prove that the proxy node can serve clients. Monitor the VIP externally, HAProxy’s backend states, Keepalived role changes, and the application endpoint. Alert on repeated transitions, not only on a single failed probe.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand what failover cannot preserve

Moving an IP does not migrate kernel connection state, TLS session state in every circumstance, uploads in progress, or data held only in memory on the failed node. Design clients to retry safely, make write operations idempotent where possible, and ensure the application stores durable state in a system available to either proxy path.

Troubleshoot the common failure modes

Symptom Likely cause What to check
The standby never claims the VIP VRRP is blocked, the provider does not support the VIP, or priorities and interfaces are wrong Provider networking requirements, Keepalived logs, interface names, VRID, priorities, and neighbour/ARP state
The VIP moves but connections fail Firewall rules, listeners, routes, or certificates differ between nodes Both nodes’ HAProxy bind settings, firewall policy, routes, certificate files, and external connection tests
All backends are marked down Incorrect address or port, an unsuitable health endpoint, or a network policy blocking checks Run the same TCP or HTTP probe from the proxy, inspect HAProxy logs, and verify the endpoint’s dependency checks
A backend flaps up and down Checks are too aggressive for the application’s response time or the endpoint is intermittently failing Response latency, timeout settings, fall/rise values, and application logs
DNS users still reach the failed node Resolver or client caching has not expired Query several recursive resolvers, inspect TTLs, and allow for the documented cache window
Users report dropped sessions after failover In-flight TCP connections ended with the failed proxy or application state was local Client reconnect behavior, session storage, request idempotency, and application logs

Operational checklist

  • Both VPS instances run the same supported HAProxy and Keepalived major versions.
  • Configuration, certificates, firewall rules, and health scripts are synchronized and validated on both nodes.
  • The provider’s floating-IP or VRRP behavior is documented and tested, not assumed.
  • HAProxy checks represent real service health and use documented fall and rise thresholds.
  • Keepalived tracks HAProxy and any local application path that must be healthy before owning the VIP.
  • Monitoring covers VIP reachability, role changes, backend status, logs, and external client results.
  • Capacity planning includes the loss of one proxy and the loss of one or more application backends.
  • Failover drills include process failure, heartbeat failure, host failure, backend recovery, DNS behavior where relevant, and client reconnects.

A two-VPS deployment is resilient only when the network can move the client address, the standby is configured as carefully as the active node, and the application itself is prepared for a proxy change. HAProxy supplies health-based backend rotation; Keepalived or a provider failover API supplies proxy-node ownership. Test those boundaries separately and together before relying on them in production.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.