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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

For two VPS servers, the most dependable pattern is two identical proxy nodes running HAProxy, with Keepalived (VRRP) or your provider’s floating-IP service placing one shared service IP in front of them. The active proxy distributes requests to healthy application backends; if the proxy, its health check, or the host fails, the standby claims the shared IP. HAProxy independently removes failed application servers from rotation and adds them back after consecutive successful checks.

This design gives you a stable client address and automatic recovery, but it is not magic replication. Your provider must support a movable address or the VRRP traffic required by the design, and your application data, sessions, certificates, and configuration must be synchronized separately.

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

How the two-VPS topology works

Place HAProxy on both VPS instances, called VPS A and VPS B. Each proxy has the same frontend, backend, TLS, firewall, and health-check configuration. A shared service IP points to the active proxy. Keepalived exchanges VRRP advertisements and assigns that IP to the node with the highest effective priority. VPS A can be preferred with a higher priority, while VPS B remains ready to take over.

Behind the proxies are one or more application servers. HAProxy performs active checks at a regular interval. A check can open a TCP connection or send an HTTP request to an application endpoint. An unhealthy backend is removed from rotation, and a recovered backend is returned only after the configured number of successful checks. This protects users from a dead application process even when both proxy nodes are operating.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
  • Client layer: DNS and clients use the shared service IP or a DNS name that resolves to it.
  • Proxy layer: one HAProxy node is active; the other is standby and continually monitored.
  • Application layer: HAProxy balances across healthy backend servers.
  • State layer: databases, uploaded files, queues, and sessions must be shared or replicated by your application architecture.

Check the network before installing anything

Confirm these points with your VPS provider first:

  • Whether an address can be moved between two instances through a floating-IP or failover API.
  • If you intend to use VRRP directly, whether the virtual-router advertisements and the virtual address are supported on the provider’s network.
  • Whether both servers can reach each other on the interface and ports used for health checks and administration.
  • Whether the provider requires a specific interface name, address format, API agent, or route when an address is reassigned.

Keepalived’s reference setup assumes two hosts on the same LAN. Many public VPS networks do not provide that Layer 2 behavior, multicast, or arbitrary virtual addresses. In that case, do not force a conventional VRRP configuration: use the provider’s documented floating-IP mechanism, or use health-checked DNS as a less immediate fallback.

Choose the failover model

Model How traffic is distributed Strengths Important limitations
Active/standby with VRRP or a floating IP One shared address is attached to one proxy at a time. Simple operations and a stable client IP; failover can be fast when the network supports it. Requires provider support for the movable address or VRRP. The standby consumes capacity while idle.
Active/active proxies Both proxies receive traffic through DNS, separate virtual IPs, or another distribution layer. Uses both nodes during normal operation and can increase total capacity. Traffic distribution is more complex. Each node must be able to carry the workload if its peer fails.
DNS failover A health-checked DNS service changes the address returned to clients. Works across separate networks and even separate providers. Recursive resolvers and client caches can keep returning the old address until its TTL expires, so convergence is slower and less predictable.

For a first two-node deployment, active/standby is usually the easiest model to reason about. Select active/active only after capacity planning and a clear method for distributing DNS or virtual addresses.

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

Prerequisites and baseline controls

Use the same Linux distribution family, HAProxy major version, and Keepalived major version on both nodes whenever possible. Give each VPS a stable management address and record the private addresses of every backend. Open only the required public ports, normally 80 and 443, and restrict administration and synchronization traffic to trusted source addresses.

Prepare a synchronization process for:

  • HAProxy configuration and any map or certificate files.
  • Keepalived configuration and health-check scripts.
  • TLS private keys and certificate chains, stored with restrictive permissions.
  • Firewall rules, system users, systemd overrides, and log rotation settings.
  • Application health endpoints and any local dependencies those endpoints require.

Do not edit only the active node and assume the standby will learn the change. A failover can expose an old certificate, backend list, or firewall rule if configuration drift is not detected.

Step 1: Install HAProxy and Keepalived on both VPS nodes

On Debian- or Ubuntu-based systems, install the distribution packages on each node (use the equivalent package manager on another distribution):

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
sudo apt update
sudo apt install haproxy keepalived

Enable the services but delay starting them until their configurations and checks are valid:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo systemctl enable haproxy keepalived
sudo haproxy -c -f /etc/haproxy/haproxy.cfg
sudo keepalived -t -f /etc/keepalived/keepalived.conf

Run the validation commands on both nodes. A syntax check on one machine does not prove that paths, interfaces, certificates, or backend routes exist on the other.

Step 2: Configure HAProxy backends and health checks

The following example terminates HTTPS on the proxy and sends HTTP to two application servers. Replace the addresses, certificate path, and health endpoint with values from your environment:

global
    log /dev/log local0
    log /dev/log local1 notice
    stats socket /run/haproxy/admin.sock mode 660 level admin

defaults
    mode http
    log global
    timeout connect 5s
    timeout client 30s
    timeout server 30s

frontend https_in
    bind *:443 ssl crt /etc/haproxy/certs/site.pem
    default_backend app_pool

backend app_pool
    option httpchk GET /healthz
    http-check expect status 200
    server app1 10.0.0.11:8080 check inter 2s fall 3 rise 5
    server app2 10.0.0.12:8080 check inter 2s fall 3 rise 5

HAProxy’s active checks can connect to a server or send an HTTP request at regular intervals. The explicit check keyword is what enables checking for each listed server. A Layer 7 endpoint such as /healthz should return success only when the application can serve real traffic; do not make it depend on a slow optional service unless that dependency genuinely determines user-visible health.

If the service is not HTTP, use TCP mode and check port reachability instead:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
backend tcp_pool
    mode tcp
    server app1 10.0.0.11:5432 check
    server app2 10.0.0.12:5432 check

TCP checks prove that a port accepts connections, not that the application is producing correct responses. HTTP checks provide a stronger signal for web applications but must be designed to avoid expensive or state-changing work.

Set failure and recovery thresholds deliberately

The example uses a two-second check interval and rise 5, matching the interval and recovery pattern shown in HAProxy documentation. It also uses fall 3 so three failed checks are required before removal. With those illustrative values, a backend normally needs several seconds of failures before removal and five consecutive successes before re-entry. Choose thresholds from your application’s recovery time and tolerance for false positives:

  • Short intervals and low fall counts detect faults quickly but can eject a server during a brief network or CPU spike.
  • Higher fall counts reduce flapping but send traffic to a broken server for longer.
  • A high rise count prevents an application that is still warming up from receiving production traffic too soon.

Document the chosen values and alert on repeated state changes. A backend that alternates between up and down is usually a symptom to fix, not a reason to keep lowering thresholds.

Step 3: Configure Keepalived for the shared address

Keepalived combines health checking with VRRP so a shared virtual IP can move between nodes. Create the same structure on both servers, changing the interface, address, and node priority to match your environment:

vrrp_script chk_proxy {
    script '/usr/local/sbin/check-proxy.sh'
    interval 2
    fall 3
    rise 2
    weight -20
}

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 51
    priority 150
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass change-this-value
    }
    virtual_ipaddress {
        203.0.113.10/24 dev eth0
    }
    track_script {
        chk_proxy
    }
}

Use a different priority on the second node, such as 100. Keep the virtual_router_id and virtual address identical on both nodes, and use a unique router ID within the network. Replace eth0 and the example address with the provider-assigned interface and address notation. Some providers require an API-driven address move instead of this block.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

The tracked script should fail when the local proxy cannot provide service, not merely when a process ID exists:

#!/bin/sh
systemctl is-active --quiet haproxy || exit 1
printf 'show infon' | socat - UNIX-CONNECT:/run/haproxy/admin.sock >/dev/null 2>&1 || exit 1
exit 0

Install it as an executable root-owned file, and test it manually. You can extend the check to verify a local application path when that is appropriate. Do not make the script call the shared public address, because that can succeed through the other node and hide a local failure. A failed health script lowers the active node’s effective priority; the standby can then claim the address.

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

Step 4: Start services in a controlled order

  1. Copy certificates, HAProxy configuration, Keepalived configuration, and the health script to both nodes.
  2. Run haproxy -c and keepalived -t on each node. Correct file ownership, interface names, and certificate permissions before proceeding.
  3. Start HAProxy on both nodes and confirm each can reach every backend directly.
  4. Start Keepalived on the preferred node, then on the standby. Use ip addr show to verify that the shared address is present on only one node.
  5. Check service logs and neighbor or ARP state from an external client. A virtual address appearing on both nodes indicates a network or VRRP configuration error.

Use your distribution’s journal and Keepalived logs to confirm which node is MASTER and which is BACKUP. The standby should still have HAProxy running and should be able to serve traffic immediately after it receives the address.

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

Step 5: Connect DNS, firewall rules, and TLS

Point the public DNS record, firewall policy, and TLS termination at the shared service IP. Permit the service ports on both VPS firewalls because either node may own the address after failover. Permit the VRRP protocol or provider-specific control path only where the provider requires it; never expose management interfaces broadly.

When the provider cannot move an IP and VRRP is unsupported, use health-checked DNS as the fallback. Set a deliberately short TTL, but explain the consequence to stakeholders: recursive caches may continue returning the old address until their cached value expires, regardless of your authoritative health decision. DNS failover is therefore useful across separate networks but cannot provide the same convergence behavior as a movable address.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Keep the certificate and private key synchronized before enabling HTTPS on the standby. A failover that reaches a node with an expired or missing certificate appears to clients as an outage even if routing is correct.

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

Verification runbook: test every failure path

Perform tests from an external client as well as from the VPS hosts. Record timestamps, the node owning the address, HAProxy state changes, Keepalived logs, neighbor or ARP entries, DNS answers, and application responses.

  1. Backend removal: disable one application backend or stop its service. Confirm HAProxy marks it down and sends new requests only to the remaining healthy backend.
  2. Backend recovery: restore the service and verify that it returns to rotation only after the configured rise count of successful checks.
  3. Proxy-process failure: stop HAProxy on the active node. Confirm the tracked script lowers its priority and that the standby claims the shared address.
  4. Heartbeat failure: stop Keepalived or isolate the active node’s network. Confirm the standby claims the address when advertisements stop.
  5. Host failure: power off or reboot the active VPS. Confirm that the standby receives the address and accepts new connections.
  6. Recovery and preemption: bring the original node back and verify the documented policy: it either reclaims the address because of its higher priority or remains standby until an operator switches it.
  7. Client behavior: test new HTTP requests and long-lived TCP connections separately. In-flight TCP sessions can break during proxy failure even when new requests recover successfully, so clients and applications need reconnect and retry behavior.

Common failure modes and fixes

Symptom Likely cause What to check
Both nodes claim the service IP VRRP is blocked, the virtual-router ID conflicts, or the provider does not support the address. Provider networking requirements, interface names, VRRP advertisements, and Keepalived logs. Switch to the provider’s floating-IP API when required.
The standby never takes over The health script always succeeds, priorities are wrong, or advertisements are still arriving. Run the script as the Keepalived user context, inspect its exit status, verify priority differences, and test with Keepalived stopped.
Failover occurs but clients cannot connect Firewall, route, TLS, or address attachment is missing on the standby. Listen sockets, firewall rules, certificate paths, provider address state, and external connectivity.
A backend flaps up and down Health endpoint is too sensitive, interval is too short, or the application is overloaded. Endpoint dependencies, logs, response latency, and the fall/rise thresholds.
DNS users still reach the failed node Resolvers are serving cached answers. Authoritative records, TTL, resolver cache age, and the client’s reconnect behavior. DNS changes cannot invalidate existing recursive caches instantly.

Design for state, capacity, and safe operations

Proxy failover does not replicate application state. Use a shared or replicated database, external session storage, replicated file storage, or stateless tokens as appropriate. If the application truly requires a user to remain on one backend, configure deliberate session affinity and understand that affinity does not survive every failure. Prefer idempotent requests so clients can safely retry after a broken connection.

Size each proxy for the failure case, not just normal traffic. In an active/standby pair, the surviving node must handle the full expected load, including TLS work and connection spikes. In active/active operation, plan capacity for one node being lost and test that reduced topology before production.

  • Monitor proxy process health, backend check states, shared-IP ownership, connection rates, error rates, certificate expiry, and Keepalived transitions.
  • Alert on repeated failovers, flapping backends, and a standby that is not ready.
  • Keep configuration changes versioned and apply them to both nodes using an auditable process.
  • Rotate the Keepalived authentication value and administrative credentials according to your security policy.
  • Schedule recurring failover drills; a configuration that has never been exercised is not a proven recovery mechanism.

When active/active is worth the complexity

Active/active proxies can receive traffic through DNS, separate virtual IPs, or another distribution method. This uses both VPS instances during normal operation, but it introduces uneven DNS caching, more complicated health decisions, and a requirement that either node can absorb the other’s traffic. HAProxy documentation describes active/active as multiple nodes receiving traffic in rotation. Use it when the capacity benefit justifies those operational costs; otherwise, active/standby with one movable address is easier to troubleshoot.

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

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.