Manual:$wgDBservers
| ロードバランサーの設定: $wgDBservers | |
|---|---|
| データベースのロード バランサーの設定 (データベース サーバーとロード率)。 |
|
| 導入されたバージョン: | 1.2.0 |
| 除去されたバージョン: | 使用中 |
| 許容される値: | 下記参照 |
| 既定値: | false |
| その他の設定: アルファベット順 | 機能順 | |
詳細
データベースのロード バランサー。 This is a two-dimensional array, an array of server info structures. Fields are:
- host
- ホスト名 ($wgDBserver を参照)。 For MySQL, it can contain a port or socket path after a colon.
- dbname
- 既定のデータベース名 ($wgDBname を参照)
- user
- データベースのユーザー ($wgDBuser を参照)
- password
- データベースのパスワード ($wgDBpassword を参照)
- type
- "mysql" または "postgres" ($wgDBtype を参照)
- load
- ratio of DB_REPLICA 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. (1.4.3 で導入)(1.46 で除去)
- max lag
- (optional) Maximum replication lag before a replica will be taken out of rotation
- max threads
- (optional) Maximum number of running threads (1.23 で除去)
- flags
- ビット フィールド:
- DBO_DEFAULT — turns on DBO_TRX only if $wgCommandLineMode != true (recommended)
- DBO_DEBUG — equivalent of $wgDebugDumpSql
- 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 (1.39 で廃止予定)
- DBO_COMPRESS — compress communication
- DBO_PERSISTENT — enable persistent connections
- ssl (1.39 で導入)
- Boolean, whether to use TLS encryption. Overrides DBO_SSL.
Leave at false to use the single-server variables listed above.
The primary must be the first entry in the array.
例 1:
$wgDBservers = [
[
'host' => "primary.serv.er",
'dbname' => "wikidb",
'user' => "wikiuser",
'password' => "secret",
'type' => "mysql",
'flags' => DBO_DEFAULT,
'load' => 0,
],
[
'host' => "replica1.serv.er",
'dbname' => "wikidb",
'user' => "wikiuser",
'password' => "secret",
'type' => "mysql",
'flags' => DBO_DEFAULT,
'load' => 1,
],
[
'host' => "replica2.serv.er",
'dbname' => "wikidb",
'user' => "wikiuser",
'password' => "secret",
'type' => "mysql",
'flags' => DBO_DEFAULT,
'load' => 1,
],
];
This would configure one primary and two replicas, each replica getting an equal amount of read access load.
Example 2:
$wgDBservers = [
[
'host' => 'serv.er',
'dbname' => 'wikidb',
'user' => 'wikiuser',
'password' => 'secret',
'type' => 'mysql',
'flags' => DBO_DEFAULT | DBO_SSL,
'load' => 0
]
];
This would configure one server with custom SSL connection if $wgDBssl set to true fails.
These and any other user-defined properties will be assigned to the mLBInfo member variable of the Database object.
MySQLの固有オプション
- 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 primary 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. (1.30+ で導入)
- sslCAPath
- Path to certificate authority PEM directory.
- sslCiphers
- Array list of allowable ciphers.
PostgreSQLの固有オプション
- port
- Port to connect to the server.
- keywordTableMap
- Map of reserved table names to alternative table names to use
SQLiteの固有オプション
- 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.
MSSQLの固有オプション
- port
- Port to connect to the server.
- UseWindowsAuth
- Use Integrated Windows Authentication for authentication to the database instead of username/password.
重要な注記
If you switch to this, ensure you either keep $wgDBname、$wgDBprefix および $wgDBTableOptions set, or ensure $wgCookiePrefix および $wgCachePrefix are set explicitly.
Note also that if you only connect to one database server the load parameter needs to be set to 0.
関連項目
- $wgDBserver - for single-server setup