Manual:External storage

External storage stores the main wiki's page text on separate DB servers.

(For a multi-master wiki farm setup (like Wikimedia), consider using LBFactory_Multi)

How to set it up
You will need to modify your LocalSettings.php and additionally setup the cluster in the database(s) itself. The order is not relevant. We begin by LocalSettings.php to have a running example to refer to.

LocalSettings.php

 * The $wgExternalStores line states, that a DB external store can be used. (The DB part is not an arbitrary name that can be adjusted. It has to be DB.)
 * The $wgExternalServers line states all the usable clusters with all usable nodes of a cluster. The top-level array's keys denote a cluster's name (The above example defines only one cluster. It has the name demoCluster</tt>). The value to those keys are again arrays. They hold the specifications of the individual nodes. The first node is consider the master. All writes to the database are performed through this master node. Zero or more slave nodes may follow. (In the above example, you find two slave nodes). Each node may have it's own host</tt>, user</tt>, password</tt>, dbname</tt>, and type</tt>, as shown in the example. The load</tt> parameter allows to specify how much of the load should pass through this note.
 * The $wgDefaultExternalStore</tt> line holds those external stores that may be used for storage of new text. If you omit this line, the external store will be read only and new texts will go into the default database (i.e.: the same database holding page, revision, image data; not the cluster).

Database setup
Create the database and tables. For the above configuration example, you would have to:
 * 1) Create the database dbM</tt> on the host master.example.org</tt>
 * 2) Run the maintenance/storage/blobs.sql</tt> SQL-script on the on the database dbM</tt> on the host master.example.org</tt>. Do not use maintainance/sql.php</tt> for this task, as it will add the required tables to your default database (i.e.: the database holding page, revision, image data) and not to dbM</tt>. If you are not sure how to run the SQL-script on the database dbM</tt> on the host <tt>master.example.org</tt>, please consult you database documentation.
 * 3) Setup replication (Consult your database's documentation on how to set up replication) towards <tt>dbS1</tt> on the host <tt>slave1.example.org</tt>, and
 * 4) Setup replication towards <tt>dbS2</tt> on the host <tt>slave2.example.org</tt>.