Smarty

  1. Home
  2. Docs
  3. Smarty
  4. Scaling and fault tolerance
  5. Configure Smarty Connection to SQL Cluster

Configure Smarty Connection to SQL Cluster

When using the SQL cluster with data replication according to the Master-Slave or Master-Master scheme, it is necessary to write a connection to each DBMS in the variable in the Smarty configuration file DATABASESby giving each connection a unique name and role.

Smarty will distribute read requests between Master and Slave servers, and write requests only between Master servers.

You also need to add the following options to the configuration file:

REPLICATED_DATABASE_SLAVES, type: list. By default, the role of each connection is defined as Master, to allocate Slave roles, you need to specify the names of the connections that will be used as Slave in the REPLICATED_DATABASE_SLAVES array.

REPLICATED_DATABASE_DOWNTIMEtype: int. The unavailability time of the database server in seconds, after which it is disconnected from the request allocation scheme.

Example:

REPLICATED_DATABASE_SLAVES = ['slave1', 'slave2']
REPLICATED_DATABASE_DOWNTIME = 60