If you have a shared host for your website you may know what I mean. MySQL users get 50,000 Questions per hour. The account is banned then after the hour you get access again.
The hosts will allow you to create unlimited users per DB.
If I reindex the search index of my forums.
"" "" any part of my site that has a lot of data.
- 50,000 limit smashed and no access / DB errors
PLAN: "mySQL user load balance"
- This works for the most part untill error ER_USER_LIMIT_REACHED then the script failes to work.
I think this could use some sort of:
- counter in session memory per user and stop using account when close to 50k.
- IF mysql connect gives error ER_USER_LIMIT_REACHED (Error Number : 1226) THEN skip that user and use the next one.
includes/config.php
Quote:
// ****** DATABASE NAME ******
// This is the name of the database where your vBulletin will be located.
// This must be created by your webhost.
$config['Database']['dbname'] = 'forum';
// ****** TABLE PREFIX ******
// Prefix that your vBulletin tables have in the database.
$config['Database']['tableprefix'] = '';
// ****** TECHNICAL EMAIL ADDRESS ******
// If any database errors occur, they will be emailed to the address specified here.
// Leave this blank to not send any emails when there is a database error.
$config['Database']['technicalemail'] = 'dbmaster@example.com';
// ****** MASTER DATABASE SERVER NAME AND PORT ******
// This is the hostname or IP address and port of the database server.
// If you are unsure of what to put here, leave the default values.
$config['MasterServer']['servername'] = 'localhost';
$config['MasterServer']['port'] = 3306;
// User array.
// ################################################
$dblogins = array();
// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dblogins['1']['user'] = 'root';
$dblogins['1']['pass'] = '';
// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dblogins['2']['user'] = '';
$dblogins['2']['pass'] = '';
// ****** MASTER DATABASE USERNAME & PASSWORD ******
// This is the username and password you use to access MySQL.
// These must be obtained through your webhost.
$dblogins['3']['user'] = '';
$dblogins['3']['pass'] = '';
// ****** MASTER DATABASE PERSISTENT CONNECTIONS ******
// This option allows you to turn persistent connections to MySQL on or off.
// The difference in performance is negligible for all but the largest boards.
// If you are unsure what this should be, leave it off. (0 = off; 1 = on)
$config['MasterServer']['usepconnect'] = 0;
// ********* place @ bottem of Config.php file before ?>
// ##########################################
srand((float) microtime() * 10000000);
$dbloginid = array_rand($dblogins);
while ($dblogins[$dbloginid]['user'] == '')
{
$dbloginid = array_rand($dblogins);
}
$config['MasterServer']['username'] = $dblogins[$dbloginid]['user'];
$config['MasterServer']['password'] = $dblogins[$dbloginid]['pass'];
unset($dblogins, $dbloginid);
|
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data used and results:
$dblogins['1']['user'] = 'root2';
$dblogins['2']['user'] = 'root3';
$dblogins['3']['user'] = 'root4';
I have tested Code posted.
Reindex of forums search.
Quote:
Processing: 102279 ... Done
Processing: 102281 ... Querying first post of thread... Done
Processing: 102282 ... Done
Processing: 102283 ...
Invalid SQL:
INSERT IGNORE INTO word (title) VALUES ('annnnnnything');
MySQL Error : User 'root4' has exceeded the 'max_questions' resource (current value: 50000)
Error Number : 1226
|