Jump to content
bbh_blocked_dnftl
Tiberium Technology® Forums

Welcome to Tiberium Technology® Forums

Welcome to Tiberium Technology® Forums, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of Tiberium Technology® Forums by signing in or creating an account.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get email updates
  • Get your own profile page and make new friends
  • Send personal messages to other members.

Recommended Posts

  • Root Admin
Posted

ABOUT THIS DRIVER:

 

This driver allows you to set up your mysql servers in a master-slave configuration where you have one master that you can both read and write updates to, and several slave databases that are read-only and stay in-sync with the master server. You can then use this driver to randomly distribute read (select) queries across one or more slave databases. You can also distribute read (select) queries to the master server as well. Using a setup like this you can potentially boost performance by using more than one database server.

 

NOTE: If you do not use mysql replication this driver will not improve your performance at all, as it relies on the native IPS MySQL drivers. This driver primarily implements load distribution of queries.

 

PRIOR TO ANY APPLICATION UPGRADES OR INSTALLATIONS YOU MUST CHANGE YOUR DRIVER IN conf_global.php BACK TO 'mysql'. OTHERWISE YOU MUST RENAME ALL APPLICATION SQL QUERY FILES TO REFLECT THE balancedmysql DRIVER NAME. ONCE UPGRADES/INSTALLATIONS ARE COMPLETE YOU CAN RESUME USING THE balancedmysql DRIVER. A SPECIAL HOOK HAS BEEN INCLUDED THAT WILL PREVENT YOU FROM ACCIDENTILY MAKING INSTALLATIONS/UPGRADES WHILE 'balancedmysql' DRIVER IS ACTIVE.

 

 

Sample High Performance Setup:

http://dev.mysql.com/doc/refman/5.1/en/images/scaleout.png

(source: http://dev.mysql.com...s-scaleout.html)

 

What this script will do is randomly distribute select queries between the master and one or more slaves.

 

INSTALLATION:

 

Step 1: Upload the contents of the attached zip file to your server..

 

Step 2: In your conf_global.php set your sql driver to 'balancedmysql' and keep your existing mysql settings.

 

$INFO['sql_driver'] = 'balancedmysql';

 

Step 3:

 

In your /hooks/hpmysql_config.php file add the following lines toward the bottom to define your slave databases (make sure you keep the

driver set to mysql!) Be sure to fill in the correct host, username, and password.

 

$INFO['sql_slaves'] = Array ( // First read slave details Array ( 'name' => 'slave1', // REQUIRED!!!! 'weight' => 5, // (OPTIONAL) 'sql_driver' => 'mysql', 'sql_host' => 'localhost', 'sql_database' => '', 'sql_user' => '', 'sql_pass' => '', 'sql_tbl_prefix' => '' ), // Second read slave details Array ( 'name' => 'slave2', // REQUIRED!!!! 'weight' => 3, // (OPTIONAL) 'sql_driver' => 'mysql', 'sql_host' => 'localhost', 'sql_database' => '', 'sql_user' => '', 'sql_pass' => '', 'sql_tbl_prefix' => '' ));

 

 

The name field (not optional) is a key that will identify the slave mysql server in the database driver, and the weight field

is a positive INTEGER that is used to control how often the particular slave is chosen by random selection.

 

For example, if slave "apple" has weight = 1 and slave "banana" has weight = 9 then think of it like putting 1 apple and 9

bananas in a basket. Choosing the server will be as simple as drawing one item from the basket.

 

This new addition will allow you to route all select queries to one or more slaves or even balance randomly among all available

servers.

 

 

 

Step 4: Additional configuration items

 

Now some other very important configuration items. The first configuration item is 'read_selection', which allows you to define

what servers to balance traffic across. Note that your master server will ALWAYS be used for deletions, inserts, create tables,

etc.

 

$INFO['read_selection'] Possible Values

$INFO['read_selection'] = "random"; // When issuing read (select) queries, choose a random server from among all slaves-or-$INFO['read_selection'] = "randomslave"; // When issuing read (select) queries, choose a random server from among all slaves-or-$INFO['read_selection'] = "master|slave2|slave3"; // Choose randomly between the master server, slave2, and slave3. These are the names you have given to each of the slaves when setting them up in $INFO['sql_slaves']. Note that "master" is reserved

 

 

 

 

$INFO['read_weighted'] (OPTIONAL)

$INFO['read_weighted'] = true; // Apply weights when choosing a random read server-or-$INFO['read_weighted'] = false; // Do not apply weights when choosing a random read server (any configured weights will be ignored and a purely random server will be chosen)

 

 

 

$INFO['master_weight'] (OPTIONAL)

$INFO['master_weight'] = 5; // Apply a weight to the master server

 

 

 

 

So putting this all together, your /hooks/hpmysql_config.php might look like this:

 

$INFO['read_selection'] = "randomslave";$INFO['read_weighted'] = true;$INFO['master_weight'] = 2; // this won't do anything with 'randomslave' enabled // First read slave details Array ( 'name' => 'slave1', // REQUIRED!!!! 'weight' => 5, // (OPTIONAL) 'sql_driver' => 'mysql', 'sql_host' => 'localhost', 'sql_database' => '', 'sql_user' => '', 'sql_pass' => '', 'sql_tbl_prefix' => '' ), // Second read slave details Array ( 'name' => 'slave2', // REQUIRED!!!! 'weight' => 3, // (OPTIONAL) 'sql_driver' => 'mysql', 'sql_host' => 'localhost', 'sql_database' => '', 'sql_user' => '', 'sql_pass' => '', 'sql_tbl_prefix' => '' )

 

View the full article IPS Resources

 

 


My Free Mods:
[NG23] News System v1.1.1 | Custom Pages v4.2 | (NG30) Google Adsense Ads v1.2.2
(NG30) Google Ads In Topic View v1.1.1 | (NG30) iClient Message In A Bottle v1.1.0 | (NG30) Forum Icon Legend v1.0.1
(NG30) Registration Notes v1.0.0 | (NG30) IP.Chat Message v1.0.0

My Paid Mods:
(NG33) Global Adverts v2.1.0 | (NG30) Rotating Banners v1.1.0 | (NG33) BuyNow BBCode v2.0.0
(NG33) Members Donate Button v1.0.8 | (NG33) Xbox/Psn Tags v1.0.3
(NG30) Image Align BBCode v1.0.0 | (NG30) Topic HTML v1.0.0 | (NG30) Google Checkout v1.0.0 | (NG30) LightBox Link BBCode v1.0.0

Mods In Development:
(NG33) Social Groups Addon - Group Payment Button | (NG33) Global Ads v2.2.0 Alpha 1

My Services:
Mod Installation Service | Skin Installation Service | Forum Upgrade Service

25d62e68d76cd7f75667a83cf86de91d.png571a3be8802342dcad9f07b714798cab.pngd650fe3d5d63fbbbab3604d6dc2414a0.png45b90d1ccf717d0a8f5d408051b94ef2.png
cacd42cb21d2574e269f68f0e79192dc.png62544e0b76b142e25661166266eb7944.png9fd72f98b8e65b7fb691407ee5d42391.png
b7abd2a44678e89c2bb3aa91e401ea99.png9687ca76387f2ede1fbb7df8d2508b3e.pngc8c57eb84a468892635126acaf75ff6f.png

---------------------------
For Support Questions About Your Hosting Account, Please Post Your Question In The HelpDesk System.
http://www.tiberiumstudios.net/Files/Sigs/sig.gif
---------------------------
My YouTube! Channel
The Price of War Clan.com
---------------------------

NXE:
NuclearGeneral.png
NewNXE:
NuclearGeneral.png
DarkSigBar:
NuclearGeneral.png
XboxOneSig:
NuclearGeneral.png
XboxOneSig2:
NuclearGeneral.png

×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, & Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.