Manual:$wgDBservers/pl

Szczegóły
Database load balancer. This is a two-dimensional array, an array of server info structures. Fields are:
 * host: Host name (see ). For mysql, it can contain a port or socket path after a colon.
 * dbname: Default database name (see )
 * user: DB user (see )
 * password: DB password (see )
 * type: "mysql" or "pgsql" (see )
 * load: ratio of DB_SLAVE load, must be >=0, the sum of all loads must be >0
 * groupLoads: array of load ratios, the key is the query group name. A query may belong to several groups, the most specific group defined here is used. (added in 1.4.3)
 * flags: bit field:
 * DBO_DEFAULT -- turns on DBO_TRX only if != true (recommended)
 * DBO_DEBUG -- equivalent of
 * DBO_TRX -- automatically start transactions (see )
 * DBO_IGNORE -- ignore errors (not useful in LocalSettings.php)
 * DBO_NOBUFFER -- turn off buffering (not useful in LocalSettings.php)
 * DBO_SSL -- use a secure connection
 * DBO_COMPRESS -- compress communication
 * DBO_PERSISTENT -- enable persistent connections

Leave at false to use the single-server variables listed above.

The master must be the first entry in the array.

Przykład:

This would configure one master and two slaves, each slave getting an equal amount of read access load.


 * max lag: (optional) Maximum replication lag before a slave will be taken out of rotation
 * max threads: ( optional) Maximum number of running threads

These and any other user-defined properties will be assigned to the mLBInfo member variable of the Database object.

Mysql specific options

 * lagDetectionMethod : Set to one of (Seconds_Behind_Master,pt-heartbeat). pt-heartbeat assumes the table is at heartbeat.heartbeat and uses UTC timestamps in the heartbeat.ts column. (https://www.percona.com/doc/percona-toolkit/2.2/pt-heartbeat.html)
 * lagDetectionOptions : If using pt-heartbeat, this can be set to an array map to change the default behavior. Normally, the heartbeat row with the server ID of this server's master will be used. Set the "conds" field to override the query conditions, e.g. ['shard' => 's1'].
 * useGTIDs : Use GTID methods like MASTER_GTID_WAIT when possible.
 * sslKeyPath : Path to key file.
 * sslCertPath : Path to certificate file.
 * sslCAFile: Path to a single certificate authority PEM file.
 * sslCAPath : Path to certificate authority PEM directory.
 * sslCiphers : Array list of allowable ciphers.

MSSQL specific options

 * port : Port to connect to the server.
 * UseWindowsAuth : Use Integrated Windows Authentication for authentication to the database instead of username/password.

Postgres specific options

 * port : Port to connect to the server.
 * keywordTableMap : Map of reserved table names to alternative table names to use

Sqlite specific options

 * dbFilePath : Path to the database file.
 * dbDirectory : Path to the directory containing the database file. Only needed if dbFilePath is not specified, and requires dbname.
 * dbname : Name of the database (without the .sqlite extension). Only needed if dbFilePath is not specified, and requires dbDirectory.
 * trxMode : Transaction mode. One of DEFERRED, IMMEDIATE or EXCLUSIVE.

Early versions
Versions of MediaWiki prior to 1.4.0 used a single-dimensional array, listing the server names, e.g. array("larousse", "pliny"), which was used in conjunction with. From 1.4.0 onwards, $wgDBloads is deprecated and the above method must be used.

The groupLoads field was added in 1.4.3.

max lag and max threads (and the use of other user-defined properties) was added in 1.6.0

Warnings
If you switch to this, ensure you either keep $wgDBname set, or ensure and  are set explicitly.

Zobacz też

 * (deprecated)
 * - for single-server setup