Showing results for 
Search instead for 
Did you mean: 

Master and Slave replication not working 100%

Master and Slave replication not working 100%

I am facing one issue with master and slave replication setup on Magento 1.12. I am using MYSQL for master and slave replication and replication is working fine on MYSQL level. After this I am using local.xml for telling Magento about the default read database for SLAVE.


This works fine when I try to save anything from admin. I had verified that in most of the cases the SELECT queries are getting fired properly from SLAVE and INSERT or UPDATE queries are getting fired on MASTER by logging the queries. But in few scenarios this is failing.

E.g. If I run the the very first page of Magento admin (i.e. Login Page) then observed that the indexer query is getting fired from MASTER. Please check the following sample query log along with the backtrace.


DB TYPE: Master
SQL: SELECT `index_process`.`indexer_code` FROM `index_process`
TRACE: #1 Varien_Db_Adapter_Pdo_Mysql#0000000073e6271600000000edf479e5#->_debugStat(2, 'SELECT `index_pr...', array(), &Varien_Db_Statement_Pdo_Mysql#0000000073e6277100000000edf479e5#) called at [lib\Varien\Db\Adapter\Pdo\Mysql.php:424]
#2 Varien_Db_Adapter_Pdo_Mysql#0000000073e6271600000000edf479e5#->query(&Varien_Db_Select#0000000073e6272600000000edf479e5#, array()) called at [lib\Zend\Db\Adapter\Abstract.php:791]
#3 Varien_Db_Adapter_Pdo_Mysql[Zend_Db_Adapter_Abstract]#0000000073e6271600000000edf479e5#->fetchCol(&Varien_Db_Select#0000000073e6272600000000edf479e5#) called at [app\code\core\Mage\Index\Model\Resource\Setup.php:66]
#4 Mage_Index_Model_Resource_Setup#0000000073e6275d00000000edf479e5#->_syncIndexes() called at [app\code\core\Mage\Index\Model\Resource\Setup.php:45]
#5 Mage_Index_Model_Resource_Setup#0000000073e6275d00000000edf479e5#->applyUpdates() called at [app\code\core\Mage\Core\Model\Resource\Setup.php:235]
#6 Mage_Core_Model_Resource_Setup::applyAllUpdates() called at [app\code\core\Mage\Core\Model\App.php:417]
#7 Mage_Core_Model_App#0000000073e6271d00000000edf479e5#->_initModules() called at [app\code\core\Mage\Core\Model\App.php:343]
#8 Mage_Core_Model_App#0000000073e6271d00000000edf479e5#->run(array('scope_code' => '', 'scope_type' => 'store', 'options' => array())) called at [app\Mage.php:683]
#9 Mage::run('', 'store') called at [index.php:87]



I am seeking guidance from anyone who faced similar kind of issues and able to find some work around about this issue. Otherwise I will have to forward this issue to Magento Support in order to get answer.


Re: Master and Slave replication not working 100%

Hi Dominic,


I had face this issue in one of my project and unfortunately did not get any resolution for it. it will great help if anyone can share the solution of it.


Thanks in advance Smiley Happy

Re: Master and Slave replication not working 100%

I have found one link in which it is mentioned about the product flat index causes slag in master and slave replication setup in Magento.

LINK: Please check this link


Just scroll down below where the text says "Fixed: Product Flat Data index causes replication lag on MySQL master/slave model"


So based on this we can come to the conclusion that Magento may be aware of this issue and OOTB master slave may not be working fully. But it will be good if confirmation comes from Magento as they know best about the framework.