1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Master/Slave Database [Paid] 1.1.0

Gives XenForo master/slave database support

  1. digitalpoint

    digitalpoint Well-Known Member

    digitalpoint submitted a new resource:

    Master/Slave Database (version 1.0.0) - Gives XenForo master/slave database support

    Read more about this resource...
     
    longanh and p4guru like this.
  2. Dinh Thanh

    Dinh Thanh Well-Known Member

    After installing do we need to do anything or XF will use slave automatically?
     
  3. digitalpoint

    digitalpoint Well-Known Member

    It should have an install.txt file with it... basically just need to install the database adapter and put the slave DB servers in your normal config.php file.

    It's a little odd that it does have to use $GLOBALS for the slave DB servers, but there's no way around that unfortunately.
     
    Dinh Thanh likes this.
  4. Dinh Thanh

    Dinh Thanh Well-Known Member

    Thanks!
    Is it possible to support Fail over for master/other slave?
     
  5. digitalpoint

    digitalpoint Well-Known Member

    As in the master DB failing or one of the slaves? Normally there's a lot that needs to happen on the backend (outside the application) to promote a slave to be a new master in the case of the master failing.

    That being said, what I do is I have a servers.php file that I include in my XenForo config... the servers.php does nothing other than set the master and slave DB server variables... then there's a different monitoring process that monitors the servers and basically just updates that server.php file whenever that process decides it needs to rearrange servers for whatever reason.

    But does this system control all your database servers and go through the monitoring process and promotion process? No.
     
    p4guru and Dinh Thanh like this.
  6. Dinh Thanh

    Dinh Thanh Well-Known Member

    I've just started to use Replication with your addon. Both servers are working fine. Load shares to slave server now.
    Could you please share us some experiences on solving issues if: master down or die, slave down or die?

    Thank you so much.
     
  7. Gia Bảo

    Gia Bảo Member

    @digitalpoint

    I have an error report:
    After set read_only mysql variable to ON on slaves, wait some minutes, I see this error on /admin.php?logs/server-error :

    Error Info
    Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : The MariaDB server is running with the --read-only option so it cannot execute this statement - library/Zend/Db/Statement/Mysqli.php:214
    Generated By: 4 Love Lily, 14 minutes ago

    Stack Trace
    #0 /var/www/html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
    #1 /var/www/html/library/Zend/DigitalPoint/Mysqli.php(127): Zend_Db_Statement->execute(Array)
    #2 /var/www/html/library/Zend/Db/Adapter/Abstract.php(753): DigitalPoint_Mysqli->query('?????SELECT *??...', 1451)
    #3 /var/www/html/library/XenForo/Discussion/Definition/Thread.php(87): Zend_Db_Adapter_Abstract->fetchRow('?????SELECT *??...', 1451)
    #4 /var/www/html/library/XenForo/DataWriter/Discussion.php(1170): XenForo_Discussion_Definition_Thread->getDiscussionForUpdate(Object(DigitalPoint_Mysqli), 1451)
    #5 /var/www/html/library/XenForo/DataWriter/DiscussionMessage.php(449): XenForo_DataWriter_Discussion->getDiscussionForUpdate()
    #6 /var/www/html/library/XenForo/DataWriter/DiscussionMessage.php(353): XenForo_DataWriter_DiscussionMessage->_setPosition()
    #7 /var/www/html/library/XenForo/DataWriter.php(1434): XenForo_DataWriter_DiscussionMessage->_preSave()
    #8 /var/www/html/library/XenForo/ControllerPublic/Thread.php(541): XenForo_DataWriter->preSave()
    #9 /var/www/html/library/XenForo/FrontController.php(337): XenForo_ControllerPublic_Thread->actionAddReply()
    #10 /var/www/html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
    #11 /var/www/html/index.php(13): XenForo_FrontController->run()
    #12 {main}

    Request State
    array(3) {
    ["url"] => string(84) "https://sandinh.com/threads/chắn-hội-kinh-bắc.1451/add-reply"
    ["_GET"] => array(1) {
    ["/threads/chắn-hội-kinh-bắc_1451/add-reply"] => string(0) ""
    }
    ["_POST"] => array(9) {
    ["message_html"] => string(3099) "some removed html content"
    ["_xfRelativeResolver"] => string(83) "https://sandinh.com/threads/chắn-hội-kinh-bắc.1451/page-113"
    ["attachment_hash"] => string(32) "e3d90f5c1c59b9cdbffc7018f03af28e"
    ["last_date"] => string(10) "1375232240"
    ["last_known_date"] => string(10) "1375232240"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(64) "/threads/ch%E1%BA%AFn-h%E1%BB%99i-kinh-b%E1%BA%AFc.1451/page-113"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
    }
    }
     
  8. Gia Bảo

    Gia Bảo Member

    I use XF 1.2 RC2
     
  9. Gia Bảo

    Gia Bảo Member

    This error is cause by XenForo_Discussion_Definition_Thread::getDiscussionForUpdate:
    That function query SELECT ... FOR UPDATE => must _forceMaster (but not)
     
  10. Gia Bảo

    Gia Bảo Member

    I think we could fix this error by changing DigitalPoint_Mysqli/ line 93
    from
    if (substr($sql, 0, 6) == 'SELECT')
    to
    if (substr($sql, 0, 6) == 'SELECT' && strpos(strtoupper($sql), 'FOR UPDATE') === false)
     
  11. digitalpoint

    digitalpoint Well-Known Member

    Yeah... looks like there are a couple places where the "FOR UPDATE" clauses is used. The above code should take care of it. Can you change it and let me know if it does indeed make the error go away for you? My DB servers aren't set up in a way that I'd see the error, so a little hard to test on my end.
     
  12. Gia Bảo

    Gia Bảo Member

    Yes. I have changed as above & there is no error now.
     
  13. digitalpoint

    digitalpoint Well-Known Member

  14. hungphutho

    hungphutho Member

    how to buy add on?
    I signed up 1 month premium membership on your site
     
  15. digitalpoint

    digitalpoint Well-Known Member

  16. hungphutho

    hungphutho Member

    Thank .
    you can look at my account on your site ( hungphutho )
    I made upgraed premium member 1 month . but do not see the download button

    I apologize for not understanding your system premium membership
     
  17. digitalpoint

    digitalpoint Well-Known Member

    That account isn't a premium member. Best thing to do is post the transaction ID over in our support forum here: https://forums.digitalpoint.com/forums/support-feedback.3/

    If the payment was an eCheck, PayPal takes a couple days to approve the payment. If it's not an eCheck, maybe the wrong thing was purchased? Either way, post over in the support area and we can help figure it out.
     
    hungphutho likes this.
  18. hungphutho

    hungphutho Member

    Sent support ticket. please consider me
    thank
     
  19. hungphutho

    hungphutho Member

    add on are working fine with two of my slave server
    thank !
     
  20. zaghinguyen

    zaghinguyen New Member

    How to config Master Slave in 2 individual server
    I have 2 server individual use xenforo: 2DB, 2 Code file
    1, Master xen: I copy folder DigitalPoint to -> library/Zend
    I add code in config.php
    $config['db']['adapterNamespace'] = 'DigitalPoint';
    $GLOBALS['digitalPoint']['SlaveServerAll'][] = '192.168.1.1' -> replaced by ip Slave;
    2, Slave xen ->
    I copy folder DigitalPoint to -> library/Zend
    I add code in config.php
    $config['db']['adapterNamespace'] = 'DigitalPoint';
    $GLOBALS['digitalPoint']['SlaveServerAll'][] = '192.168.1.1' -> replaced by ip Slave;

    -> I test it not working. when i create a threads in server2, it DOESN'T has in server Master.
    How to config in Slave server to know ip of master server?

    Thanks you so much!
     

Share This Page