Manual:$wgDBservers

From MediaWiki.org
Jump to: navigation, search
This page is a translated version of the page Manual:$wgDBservers and the translation is 33% complete.

Other languages:
English • ‎فارسی • ‎français • ‎日本語 • ‎polski
LoadBalancer settings: $wgDBservers
Settings for the database load balancer (database servers and load ratios).
導入されたバージョン: 1.2.0
除去されたバージョン: 使用中
可能な値: 下記参照
既定値: false
他の設定: アルファベット順 | 機能順


詳細

Since MediaWiki 1.18 (Release notes) the database user for all databases configured in this array (if you use replication) needs the REPLICATION CLIENT privilege to determine the lag between master <-> slave.

Database load balancer. This is a two-dimensional array, an array of server info structures. Fields are:

host
ホスト名 ($wgDBserverManual:$wgDBserver を参照)
dbname
既定のデータベース名 ($wgDBnameManual:$wgDBname を参照)
user
データベースのユーザー ($wgDBuserManual:$wgDBuser を参照)
password
データベースのパスワード ($wgDBpasswordManual:$wgDBpassword を参照)
type
"mysql" または "pgsql" ($wgDBtypeManual:$wgDBtype を参照)
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. (1.4.3 で追加)
flags
ビット フィールド:

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

The master must be the first entry in the array.

例:

$wgDBservers = array(
         array(
                 'host' => "master.serv.er",
                 'dbname' => "wikidb",
                 'user' => "wikiuser",
                 'password' => "secret",
                 'type' => "mysql",
                 'flags' => DBO_DEFAULT,
                 'load' => 0,
         ),
         array(
                 'host' => "slave1.serv.er",
                 'dbname' => "wikidb",
                 'user' => "wikiuser",
                 'password' => "secret",
                 'type' => "mysql",
                 'flags' => DBO_DEFAULT,
                 'load' => 1,
         ),
         array(
                 'host' => "slave2.serv.er",
                 'dbname' => "wikidb",
                 'user' => "wikiuser",
                 'password' => "secret",
                 'type' => "mysql",
                 'flags' => DBO_DEFAULT,
                 'load' => 1,
         ),
);

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
((1.23 で除去済) 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.

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 $wgDBloadsManual:$wgDBloads. 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

警告

If you switch to this, ensure you either keep $wgDBname set, or ensure $wgCookiePrefixManual:$wgCookiePrefix and $wgCachePrefixManual:$wgCachePrefix are set explicitly.

関連項目