Master/Slave Database

Master/Slave Database [Paid] 1.1.0

No permission to buy ($100.00)

TheComputerGuy

Well-known member
Any chance I can get help with this...the error seems...odd?

Code:
ErrorException: Undefined index: digitalPoint - library/Zend/DigitalPoint/Mysqli.php:34
Generated By: Unknown Account, 6 minutes ago
Stack Trace
#0 /public_html/site.com/library/Zend/DigitalPoint/Mysqli.php(34): XenForo_Application::handlePhpError(8, 'Undefined index...', '/public_html...', 34, Array)
#1 /public_html/site.com/library/Zend/Db/Adapter/Abstract.php(858): DigitalPoint_Mysqli->_connect()
#2 /public_html/site.com/library/XenForo/Model/DataRegistry.php(143): Zend_Db_Adapter_Abstract->quote(Array)
#3 /public_html/site.com/library/XenForo/Model/DataRegistry.php(97): XenForo_Model_DataRegistry->_getMultiFromDb(Array)
#4 /public_html/site.com/library/XenForo/Dependencies/Abstract.php(147): XenForo_Model_DataRegistry->getMulti(Array)
#5 /public_html/site.com/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
#6 /public_html/site.com/index.php(13): XenForo_FrontController->run()
#7 {main}
Request State
array(3) {
  ["url"] => string(83) "http://www.site.com/threads/post-some-unusual-marbles.103/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 

TheComputerGuy

Well-known member
I'm still getting the error above, but I'm also getting the following error.
We are using AWS servers if that matters

ErrorException: array_rand() expects parameter 1 to be array, null given - library/Zend/DigitalPoint/Mysqli.php:36
Generated By: Unknown Account, 2 minutes ago
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(2, 'array_rand() ex...', '/public_html...', 36, Array)
#1 /site.com/library/Zend/DigitalPoint/Mysqli.php(36): array_rand(NULL)
#2 /site.com/library/Zend/Db/Adapter/Abstract.php(858): DigitalPoint_Mysqli->_connect()
#3 /site.com/library/XenForo/Model/DataRegistry.php(143): Zend_Db_Adapter_Abstract->quote(Array)
#4 /site.com/library/XenForo/Model/DataRegistry.php(97): XenForo_Model_DataRegistry->_getMultiFromDb(Array)
#5 /site.com/library/XenForo/Dependencies/Abstract.php(147): XenForo_Model_DataRegistry->getMulti(Array)
#6 /site.com/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
#7 /site.com/index.php(13): XenForo_FrontController->run()
#8 {main}
Request State
array(3) {
["url"] => string(41) "https://www.site.com/posts/xxxxxxxx/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

The config is set

$config['db']['adapterNamespace'] = 'DigitalPoint';
$GLOBALS['digitalPoint']['SlaveServerAll'][] = 'XXXXX';
 

digitalpoint

Well-known member
Looks right to me... I don't know anything about AWS though. Only thing I can think of is maybe they are doing something funky with PHP's $GLOBALS "superglobal" variable somehow. The error you are getting implies that the $GLOBALS['digitalPoint']['SlaveServerAll'] isn't set.
 

skicomau

Active member
@digitalpoint

I'm still on Xenforo 1.5.x - will this addon be compatible and if so, has it been tested with AWS Aurora clusters to your knowledge?

Let me know at your convenience, I am happy to purchase if you feel it will be suitable.

thanks
 

Chris D

XenForo developer
Staff member
I replied to your thread but for the benefit of others master/slave databases are supported natively in XF 2.0 and above:
Master/slave support in DB adapter
XF2 introduces master/slave replication via a new DB adapter which allows separate read and write connections to be made. By default, select statements will be sent to the read server and all other statements will be sent to the write server.

You can see a typical example of configuration below:

PHP:
$config['db']['adapterClass'] = 'XF\Db\Mysqli\ReplicationAdapter';
$config['db']['write'] = [
    'host' => '192.168.10.1',
    // ... username, password, dbname etc.
];
$config['db']['read'] = [
    'host' => '192.168.10.2',
    // ... username, password, dbname etc.
];
As well as inferring the correct connection to make from the type of query, you can also control the behavior by prefixing a query with a comment in the form of -- XFDB=modifier.

Where the modifier is one of:
  • fromWrite - forces a specific read query to come from the write server even if it normally wouldn't
  • forceAllWrite - forces this query and all subsequent queries to the write server
  • noForceAllWrite - if this query would normally force all subsequent queries to the write server, this option disables that (useful for a write you know won't be read back immediately or if it is, can tolerate lag)
 
Top