Set up high availability

High availability is a term used to describe server setups that eliminate single points of failure. The following sections provide instructions for setting up multiple backend servers behind a NodeBalancer, then redirecting traffic from your Ion property to the NodeBalancer by adjusting DNS settings.

📘

NodeBalancers communicate with backend nodes through their private IPv4 addresses via HTTP.

Before you start, ensure your origin server supports HTTP port 80.

If you created your Linodes using Node.js from the Marketplace Apps, you can watch this interactive guide for more information.

Create multiple origin servers

This section involves cloning your Linode origin server to provide high availability through redundancy.

📘

Clustering files or databases is not in the scope of this use case. You can, however, refer to the Host a Website with High Availability guide if you want to learn more.

If you want to use a solution such as GlusterFS, instead of cloning the origin server you need to follow the instructions in Create a Linode to create two or more new Linode Compute Instances.

  1. Log in to the Linode Cloud Manager.

  2. Use the Linode cloning feature to create another Linode in the same region.

    For instructions, refer to Cloning a Linode.

  3. Under Select Linode to Clone From, click the Linode you created for the web server in Create a Linode.

  4. Select the same Linode Plan option you previously selected and click Create Linode .

  5. Add a Private IPv4 Address to the cloned Linode.

  6. Select Power On for the cloned Linode after creation is complete.

  7. Ensure that the web server is running on your cloned Linode.

    If using the Node.js Marketplace App, LISH or SSH into the cloned Linode and start the Node.js server as a background process:

    node /opt/nodejs/hello.js &

    You can also rename the cloned Linode hostname to help identify it later:

    hostnamectl set-hostname server2

Set up network load balancing

Linode NodeBalancers distribute user requests between compute instances to improve capacity, performance, and availability. For more information, refer to the Getting Started with NodeBalancers guide.

👍

Before you start, make sure that each of your origin servers has a private IPv4 address. For more information and instructions on how to add private IPv4 addresses to your origin servers, refer to the Managing IP addresses guide.

  1. Log in to the Linode Cloud Manager.

    You can also refer to the Getting Started with NodeBalancers instructions to create a Linode NodeBalancer.

  2. Navigate to the NodeBalancer page and click Create NodeBalancer.

  3. Select the same region you selected for your backend Linode instances.

  4. In the Port Configuration section, change Port form 80 to 443.

  5. Change the Protocol from HTTP to HTTPS.

  6. In the SSL Certificate section, paste the PEM-formatted contents of your web server SSL certificate.

📘

If using the Node.js Marketplace App, certificate files are located in the /etc/letsencrypt/live/domain/ directory on your origin servers. Use the contents fullchain.pem and privkey.pem when configuring your NodeBalancer.

Otherwise, to learn how to get an SSL certificate, refer to the Enabling HTTPS Using Certbot with NGINX guide.

  1. In the Private Key section, paste the PEM-formatted contents of your webserver private key. Your private key cannot have a passphrase.

  2. Select “Least Connection” for the Algorithm setting and “HTTP Cookie” for the Session Stickiness setting.

    Port configuration

📘

To enable Forward Secrecy for SSL/TLS connections, follow the instructions in the NodeBalancer SSL Configuration guide.

If using the Node.js Marketplace app, Diffie-Hellman parameters are located on the Linode origin server in the /etc/letsencrypt/ssl-dhparams.pem file by default.

  1. In the Active Health Checks section, select the HTTP Status for the Type setting and enter a forward slash (/) as the Check HTTP path.

    Active Health Checks

📘

Make sure all the origin servers listen to HTTP, not HTTPS, otherwise the HTTP Status option will not work.

  1. In the Backend Nodes section, select the Enter IP Address checkbox and select the first web server.

  2. Enter a label—for example, Server1.

  3. Enter the HTTP port number of the web server under the Port section.

Node Balancer

  1. Click Add a Node, and add the second web server.

  2. Review the configuration, and click the Create NodeBalancer button.

  3. Make note of the IP Address of the NodeBalancer.

    Node Balancer

  4. Redirect your Ion origin hostname DNS A record to point to your NodeBalancer IP address.

    If using Linode DNS Manager, the following settings apply for the example www.test.com domain and NodeBalancer IP address of 203.0.113.2 according to the choice of primary domain:

    Node Balancer

📘

For more information on configuration options, see the TLS/SSL Termination on NodeBalancers guide.