Multiple Server Setup
Article Topics: Setup
This article explains how to set up NATS across multiple servers. The are a number of solutions you can implement to use multiple servers/databases to improve performance and distribute the workload.
Database Server(s)
NATS supports the ability to query a secondary "slave" database when running any non-essential reports. A slave database is essentially an exact copy of your actual NATS database that is typically used by NATS for larger, time-intensive queries. You can have as many slave databases attached to your master NATS database as you want at no extra charge. Using a slave database will greatly improve performance on both your join pages and on your reporting pages, as they will not be fighting for the same database resources when they are both running at the same time.
To use a slave database in NATS, your host must first create the slave database in MySQL and set up replication between the two. Replication is how the master and slave databases keep data up-to-date with each other. MySQL's official documentation on replication can be found here.
Please Note: NATS Technical Support cannot and will not create slave databases or setup replication as this is something that is set up outside of the NATS system
Once replication is set up by your host, the next step is to tell NATS how to connect to the primary slave database. Before you start this next step, you need to get the following information from your host:
The hostname/address of the slave database
The username for the slave database
The password for the slave database
The name of the slave database
Then in your includes/config.php file add the following lines:
$config['DB_STATS_SERVER'] = 'localhost'; //replace localhost with address/hostname of where slave database lives
$config['DB_STATS_USER'] = 'access'; //replace access with the username for slave database
$config['DB_STATS_PASSWORD'] = 'my_password'; //replace my_password with the password for slave database
$config['DB_STATS_DB'] = 'db_name'; //replace db_name with the name of the slave databaseWhere the STATS indicates the copy. You can verify the information by navigating to the Database Settings section of the Home tab in the Configuration Admin.
Optional Servers
If you have multiple slave databases replicating from your master NATS database, you can have NATS automatically choose one of your slave databases at random when a user hits a page/script that uses the slave database(s) by setting them up as an array.
There are several types of servers you can have configured for your NATS install, each with its own way of setup.
DB_API_SERVER
DB_REPORTING_SERVERS
DB_ADMIN_REPORTING_SERVERS
DB_SURFER_SERVERS
API Database Server
NATS supports the ability to query a secondary "slave" database for use with the REST API. API Database Servers can not be stored in an array.
In your includes/config.php file, add the following lines:
Database Reporting
The Database Reporting Server gives you a secondary slave database to display reporting stats. This can be set up as either an array or a single option.
Configure as an Array
In your includes/config.php file, add the following lines:
Configure as a Single Database
In your includes/config.php file, add the following lines:
Admin Database Reporting
The Admin Database Reporting Server functions similarly to the Database Reporting server but is reserved for admin access only, giving admins faster queries when viewing NATS reporting. Admin Database Reporting can only be configured in an array.
In your includes/config.php file, add the following lines:
Surfer Servers
The Surfer Server Database is used for tracking your signup scripts. Server Database Servers can only be configured in an array.
In your includes/config.php file, add the following lines:
Lastly, navigate to the Database Settings section of the Home tab in the Configuration Admin and enable the Allow Track Slave and Allow Signup Slave options.

Last updated
Was this helpful?