Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-457

Separating Database Master/Slave Requests

    XMLWordPrintable

    Details

    • Type: Feature Request
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.1.0
    • Fix Version/s: 5.2.0-B1
    • Component/s: Database
    • Labels:
      None
    • Additional information:
      Hide

      Database name isn't mentioned in slave server configuration, since it's must much during replication anyway.

      Additional notes in In-B 23001

      Show
      Database name isn't mentioned in slave server configuration, since it's must much during replication anyway. Additional notes in In-B 23001
    • Change Log Message:
      added Database Load Balancing
    • Story Points:
      3
    • External issue ID:
      576
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

      Description

      Add ability to have MASTER/SLAVE(s) configuration. This will separate WRITE/READ database requests between 2 servers.

      1. all Admin requests go to MASTER
      2. all Front READ requests go to SLAVE
      3. all Front WRITE requests go to MASTER
      4. all Front Search READ go to MASTER

      For live examples refer to VO project.

      In the future, we'd like to add function for have a Pool of Slaves servers.

      --------

      To enable load balancing:
      1. add $_CONFIG['Database']['LoadBalancing'] = '1'; to /system/config.php file
      2. create /system/db_servers.php file with following content:

      <?php

      $_CONFIG['Databases'] = Array (
      Array (
      'DBHost' => 'slave.host1',
      'DBUser' => 'slave.user1',
      'DBUserPassword' => 'slave.user.password1',
      'DBLoad' => 1,
      ),
      Array (
      'DBHost' => 'slave.host2',
      'DBUser' => 'slave.user2',
      'DBUserPassword' => 'slave.user.password2',
      'DBLoad' => 1,
      'DBMaxLag' => 15, // optional, slave replication delay in seconds
      'DBMaxThreads' => 100, // optional, when slave thread count is above this number, then it won't be used
      ),
      );

      3. only slave servers are listed in file above, since database server defined in /system/config.php is considered as master server for backwards compatibility.

      See [url]http://www.mediawiki.org/wiki/Manual:$wgDBservers[/url] for more details.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                dmitry Dmitry Andrejev [Intechnic]
                Developer:
                Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: