Skip to content

Instantly share code, notes, and snippets.

@alexfinnarn
Created March 6, 2018 22:32
Show Gist options
  • Save alexfinnarn/d0d2a6ac6ea9d8b1fbffe812c0a459b7 to your computer and use it in GitHub Desktop.
Save alexfinnarn/d0d2a6ac6ea9d8b1fbffe812c0a459b7 to your computer and use it in GitHub Desktop.
settings.php database comments
For each database, you may optionally specify multiple "target" databases.
A target database allows Drupal to try to send certain queries to a
different database if it can but fall back to the default connection if not.
That is useful for master/slave replication, as Drupal may try to connect
to a slave server when appropriate and if one is not available will simply
fall back to the single master server.
The general format for the $databases array is as follows:
@code
$databases['default']['default'] = $info_array;
$databases['default']['slave'][] = $info_array;
$databases['default']['slave'][] = $info_array;
$databases['extra']['default'] = $info_array;
@endcode
In the above example, $info_array is an array of settings described above.
The first line sets a "default" database that has one master database
(the second level default). The second and third lines create an array
of potential slave databases. Drupal will select one at random for a given
request as needed. The fourth line creates a new database with a name of
"extra".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment