[asterisk-users] Re: Realtime +Mysql +Failover

JR Richardson jmr.richardson at gmail.com
Wed Dec 13 17:37:51 MST 2006


> > Can Realtime be set up with a secondary mysql server to get its data
> > from. We can set up mysql to sync with its fellow server, and maybe when
> > it goes down, it couldn't make any changes (write), but either way, you
> > could still get the extension info, etc, so your phones would still
> > survive a mysql outage.

I run MySQL Replication from a Master MySQL Server (only runs the
database function).  Apply patch
http://bugs.digium.com/view.php?id=5881to the various asterisk servers
and configure them as slaves to the master.  Write only to the Master
database and all the slaves update automatically, in realtime.  Have
the PBX's write to the Master and read from 127.0.0.1(localhost), if a
PBX goes down, it doesn't affect database operations with the rest of
the cluster.  Also if the Master goes down, all the PBX's can still
read from their local database.

snip from res_mysql.conf

[general]
dbname=asterisk
dbuser=asterisk
dbpass=asterisk
dbport = 3306
dbsock = /tmp/mysql.sock

[read]
dbhost = 127.0.0.1

[write]
dbhost = 10.10.10.10


For MySQL redundancy, have a second MySQL server running in a
Master-to-Master replication with the first Master.   There is your
backup if one goes down, switch IP or run LVS or Heatbeat between the
two Master MySQL servers.

This setup, IMHO, is less costly than a MySQL Cluster (due to less
servers needed to implement), is easier to configure and get running,
easier to recover during a failure, greatly increases realtime
performance on the PBX (reading from localhost than from across a
network), scales very well (15-20 slaves for each Master).  Also MySQL
replication is more mature that MySQL clustering (I'm using 3.23, not
5.0 which is needed for clustering) so the software footprint is
smaller comparatively).

Hope this helps.

JR Richardson
Engineering for the Masses


More information about the asterisk-users mailing list