MySQL Master Slave Setup with Unable to connect errow when slave is gone

Author Message

Ekkehard Dörre

Monday 24 January 2011 8:04:47 am

Hi all,
when setting up a MySQL Master Slave Setup with the ini settings
http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Configuration-files/site.ini/DatabaseSettings
with
UseSlaveServer=enabled
http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Configuration-files/site.ini/DatabaseSettings/UseSlaveServer
I got an error, when the slave server is not reachable.
An unexpected error has occurred. Please contact the webmaster.
Unable to connect to the database server 'xxx.xxx.xxx.xxx:3306' in /var/www/releases/ezp44/lib/ezdb/classes/ezmysqldb.php on line 151
I think, it would be better, when eZ Publish is still reachable, when only the master server is running.
Any opinions?
The start eZ setup:
2 nodes MySQL - one master, one slave
2 nodes eZ Publish with GlusterFS
2 nodes eZ Find

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Andrew Duck

Monday 24 January 2011 10:02:44 pm

I agree that the DB handler really should fallback to the master configuration if the slave is not available.

For the time being we utilise Triple-M (http://mysql-mmm.org/) for handling failover events. We assign floating IPs to mysql services and then failover the slave IP to another machine (master if needed).

Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck

Ekkehard Dörre

Tuesday 25 January 2011 1:59:43 am

Hi Andrew,

mmm, we discussed this, more complexity, more possible errors is a nice thing for sites with many write requests, but for classical content sites with a lot of read requests and PHP sessions, a master with multiple slaves setup is still a good solution, but we should implement a better logic in eZ Publish.

I'll ask our customer, if they are willing to spend an eZ Enterprise Ticket on it, or we are looking deeper into mmm or the http://www.continuent.com cluster solution.

Other opinions?

Greetings ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Andrew Duck

Tuesday 25 January 2011 2:02:19 am

Hi Ekkehard,

Check out the config options for mmm, you may not need to introduce multi-master complexity to achieve nice fail over. It adds another system to maintain, but perhaps not more complexity to your mysql setup.

Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck

Gaetano Giunta

Tuesday 25 January 2011 4:46:35 am

While I agree that having smarter management inside of ez of master-slave setups would be nice (especially since this setup is supported with recent versions of postgres and oracle too, so that once it is coded in eZ it should be available to every user at no cost), generally speaking I prefer to push this kind of problems down to the architecture layer.

In the ideal world eZ should not even know about a master/slave setup. Oracle rac does it native of course, but it costs a huge amount of money, uses a lot of resources and is a pain to setup. Recent developments in the mysqlnd php driver indicate that we might get transparent load-balancing out of the box in the near future. Not sure about postgres, maybe there are commercial solutions (tungsten ?) doing that today.

The reason i say eZ should not care about this is because every complex architecture deployment has different needs in term of backups, availability, failover, polling, monitoring etc... A robust, complete and flexible solution takes a lot of time to develop, test and maintain. And in pur oss style, why reinvent the wheel inside eZ, if it already exists elsewhere?

Principal Consultant International Business
Member of the Community Project Board

Ekkehard Dörre

Tuesday 25 January 2011 5:14:38 am

Hi Andrew,

thanks for the hint, I'll give it to the system admin and

Gaetano, your are right with the perfect world approach, I forgot a blog post from Ulf Wendel: PHP: Transparent load balancing and sharding with mysqlnd http://blog.ulf-wendel.de/?p=298 this is a nice way.

Greetings ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Eduardo Fernandes

Wednesday 27 April 2011 7:30:45 am

Checking

Best regards,

Eduardo Fernandes
Product Support Engineer
edf@ez.no | www.ez.no | eZ Systems

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 29 2025 23:45:26
Script start
Timing: Jan 29 2025 23:45:26
Module start 'layout'
Timing: Jan 29 2025 23:45:26
Module start 'content'
Timing: Jan 29 2025 23:45:26
Module end 'content'
Timing: Jan 29 2025 23:45:26
Script end

Main resources:

Total runtime0.0146 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.6328151.2734
Module start 'layout' 0.00460.0020 739.906336.7656
Module start 'content' 0.00660.0064 776.6719102.2969
Module end 'content' 0.01300.0015 878.968841.9766
Script end 0.0146  920.9453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002215.3891140.0002
Check MTime0.00107.1171140.0001
Mysql Total
Database connection0.00075.061710.0007
Mysqli_queries0.002315.469130.0008
Looping result0.00000.055510.0000
Template Total0.00128.210.0012
Template load0.00106.691410.0010
Template processing0.00021.510510.0002
Override
Cache load0.00074.849710.0007
General
dbfile0.002315.785580.0003
String conversion0.00000.032640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs