3 Steps to Optimizing Application Performance with Multi-CDN - REGISTER NOW!

Automatic Failover

This article describes an automatic failover configuration for an A record, in which NS1 is configured to automatically shift traffic to a secondary IP (which normally receives no traffic) upon detecting a failure of your primary IP. For a guide to configuring simple manual failover, read this Knowledge Base article.
Please note that the same guide can be used for CNAME and other record types compatible with a failover configuration.

Configure an Integration

If you’re using NS1's built-in monitoring, then navigate to the Monitoring tab and follow the guides for creating Ping or TCP monitors.
Alternatively, NS1 has pre-configured integrations with the following 3rd-party monitoring services:

  • Amazon CloudWatch
  • Rackspace Cloud Monitoring
  • Monitis
  • Monitor.us
  • Pingdom
  • Boundary
  • Catchpoint
  • Datadog

For this example we'll use NS1's native API service:

  1. Navigate to the Integrations tab
  2. In the "Supported Services" section select NS1 API. 
  3. Create an Incoming Datafeed and enter a name for the feed that you will be able to easily identify when connecting to record metadata. Choose a Label for your feed that will be used as an identifier in the API call. (Note: this field does not allow spaces.) 
  4. Click Create Datafeed from nsone_v1, which will send you to the Incoming screen, where you will see this new feed now lives.

Create an A record

  1. Click on the Zones tab and select the Zone you will be working under.
  2. Click on the Add Record button.
  3. Enter the domain (e.g. abc.example.web)
  4. Select the record type as A
  5. Enter your desired TTL.
  6. Set the Answers for this record
  7. Click on the Save Changes button

Preparing the record for failover

  1. Once you've created the A record in the portal, click on the drop-down menu in the top right corner of the record and click "Add Filter Chain" 
  2. Click "Add Filter" and drag the "Up" filter from the Telemetry and Healthchecks section over to Active Filters. This prevents NS1 from returning any IPs that are marked down. 
  3. Click into the Traffic Management section and drag the Priority filter into your newly created Filter Chain. This tells the system to sort the answers by priority (after executing "UP" to remove any answers that are down). Also drag over the Select First N filter, which will be set to N=1 by default. This tells the system that after sorting by priority, return ONLY the answer with the highest priority associated. Click Done. 

Adding the secondary IP and setting Answer priority

Now that we have added both servers’ IP’s into the A record config, we need to set up/down state and a priority value for both servers:

  1. Click the Filter Data button at left to reveal the metadata associated with your Filter Chain.
  2. Under the primary IP's metadata section, click the plug icon in the "up" row and connect your primary monitor or data feed (we'll use NS1 native monitoring for this example)
  3. Then click the edit tool in the "priority" row and set the priority of the primary IP (1.1.1.1) to 1 (note: lower numerical value indicates higher prioritization)
  4. Under the secondary IP's metadata section, click the plug icon and connect your secondary monitor or data feed.
  5. Then click the edit tool in the "priority" row for the secondary IP (2.2.2.2)  and set it equal to 2
  6. Click the Save button.
  7. Your record configuration should now look like this: 

You're done!  At this point, if the monitor on your primary server trips, the corresponding answer will be updated to up status of "false" in the NS1 platform immediately.

If you have other DNS records serviced by the same servers, you can reuse the same Data Feeds in those records too.  Updates to a Data Feed will automatically be pushed to every connected answer throughout our system.

Optional: “Failback”

Assuming you want to automate "failback" (shifting traffic back to your primary server once it returns to a healthy state), make sure your monitoring service is configured to notify NS1 when your monitors return to an "up" state. Please note that this is the default setting for NS1 monitors.
To enable this if you are using NS1's monitoring;

  1. Click on the Monitors tab
  2. Select the monitoring job attributed to your primary server’s IP address. You will be taken to the monitoring job details page
  3. Click "Toggle advanced options"
  4. Make sure “Notify Failback” is checked
  5. Click “Save”

If you want to do manual failback, make sure your monitoring service doesn't notify NS1 on return to an "up" state; to failback to your primary, just visit your record page and manually change the "Up/down" state of the primary back to "up".