Difference between revisions of "NATS Multiple Server Setup"

From TMM Wiki
Jump to navigationJump to search
Line 7: Line 7:
 
== Database Server(s) ==  
 
== Database Server(s) ==  
  
NATS supports the ability of querying a secondary "slave" database when running any non-essential reports.  You can have as many slave databases attached to your master NATS database as you want at no extra charge from us.  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.
+
NATS supports the ability of querying 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 from us.  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.
  
  

Revision as of 13:28, 2 July 2009

NATS 4
About NATS 4
NATS4 Requirements
NATS4 vs NATS3 Advantages
IPSP Integration
NATS4 Changelog
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers

This article explains how to setup NATS across multiple servers. The are a number of solutions you can implement to use multiple servers/databases to improve performance and distribute the work load across multiple servers.

Database Server(s)

NATS supports the ability of querying 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 from us. 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 between each other. MySQL's official documentation on replication can be found here.
(NOTE: NATS Tech Support CANNOT and WILL NOT do this step as it 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['STATS_DB_SERVER'] = 'localhost';     //replace localhost with address/hostname of where slave database lives
$config['STATS_DB_USER'] = 'access';          //replace access with the username for slave database
$config['STATS_DB_PASSWORD'] = 'my_password'; //replace my_password with the password for slave database
$config['STATS_DB_DB'] = 'db_name';           //replace db_name with the name of the slave database


THE FOLLOWING STEP ONLY APPLIES TO USERS OF NATS V4
THE FOLLOWING STEP IS OPTIONAL

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). You can add an array of slave databases to your includes/config.php file in the following manner:

$config['DB_REPORTING_SERVERS'] = Array(
	"0" => Array(
		'SERVER' => 'localhost',   //replace localhost with address of where first slave database lives
		'USER' => 'access1',       //replace access1 with the username for the first slave database
		'PASSWORD' => 'password1', //replace password1 with the password for first slave database
		'DB' => 'slave_name1'      //replace slave_name1 with the name of the first slave database
	),
	"1" => Array(
		'SERVER' => 'localhost',   //replace localhost with address of where second slave database lives
		'USER' => 'access2',       //replace access2 with the username for the second slave database
		'PASSWORD' => 'password2', //replace password2 with the password for second slave database
		'DB' => 'slave_name2'      //replace slave_name2 with the name of the second slave database
	)
	//continue in this manner for as many slave databases you wish to configure
);


Load Balancing Web Files

(coming soon...)