<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
Hello,<BR>
<BR>
A reader/writer layer would need applied. In it you would account for a load-balancing method (random sort and pluck the top, or round robin, least used, etc.) for the readers and a single master.&nbsp; On a reader level, the status would need polled such that you don't continue to use a down server.&nbsp; A background thread would need to check downed readers to see if they are back online. (ping, for instance)<BR>
<BR>
The writer would need to spool failed queries for future injection.&nbsp; You wouldn't want to 'hang' Asterisk with a downed master server.<BR>
<BR>
And ideally, this would be a generic database layer, such that other parts of Asterisk could reuse the same logic - or even a C library so that other software could use the same (PHP frontend for billing or provisioning, for instance.)<BR>
<BR>
This would be the easiest method.&nbsp; The most complex would be multiple readers and writers which would entail spooling on a per server level when a query fails, so that when it's online it could accept the queries not yet processed. And it goes without saying that everything falls apart if the same library isn't used by all parts.&nbsp; And, if the machine dies and the spool files are lost, then you could have out-of-sync issues.<BR>
<BR>
-Joe<BR>
Thralling Penguin LLC<BR>
<BR>
<BR>
On Thu, 2006-07-06 at 10:24 -0500, JR Richardson wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Just need to bounce this off of you guys, help get my mind right&#8230;&#8230;&#8230;&#8230;.</FONT>

<FONT COLOR="#000000">Using the ARA gives the ability for multiple PBX's to pull info from a</FONT>
<FONT COLOR="#000000">MySQL database cluster.  Clustering MySQL is pretty simple when using</FONT>
<FONT COLOR="#000000">mysql master/slave database replication and distributing the database</FONT>
<FONT COLOR="#000000">lookups across the database replication cluster.</FONT>

<FONT COLOR="#000000">This gives good database HA for MySQL but I'm running into an issue</FONT>
<FONT COLOR="#000000">specifically with the PBX-to-database write operation then followed by</FONT>
<FONT COLOR="#000000">the database replication.</FONT>

<FONT COLOR="#000000">MySQL server layout:</FONT>
<FONT COLOR="#000000">Master id:1 provisioning front end, human interaction</FONT>
<FONT COLOR="#000000">Slave1 id:2 hosting database for pbx 1, 2, 3</FONT>
<FONT COLOR="#000000">Slave2 id:3 hosting database for pbx 4, 5, 6</FONT>
<FONT COLOR="#000000">Slave3 id:4 hosting database for pbx 7, 8, 9</FONT>

<FONT COLOR="#000000">When we make changes to the Master, changes are immediately replicated</FONT>
<FONT COLOR="#000000">to all the slaves and the PBX's perform accordingly.</FONT>

<FONT COLOR="#000000">When PBX 1 registers a phone and updates the &quot;full contact info&quot; to</FONT>
<FONT COLOR="#000000">database Slave1 for that UA, we now need a sync operation from Save1</FONT>
<FONT COLOR="#000000">back to the database Master so the Slave2 and Slave3 remain in sync.</FONT>

<FONT COLOR="#000000">There are database sync utilities with MySQL but are accessed by</FONT>
<FONT COLOR="#000000">manually running the utilities.  I'm looking for an automated solution</FONT>
<FONT COLOR="#000000">that will keep all these databases in 'sync' rather than just</FONT>
<FONT COLOR="#000000">replicated from one master.</FONT>

<FONT COLOR="#000000">Can ARA accomplish this by separating the read and write operations,</FONT>
<FONT COLOR="#000000">configuring the write operation to the Master database and configuring</FONT>
<FONT COLOR="#000000">the read operation to pull from another database?  This functionality</FONT>
<FONT COLOR="#000000">would need to be added to sip/iax users/peer operation, something</FONT>
<FONT COLOR="#000000">like:</FONT>

<FONT COLOR="#000000">sip.conf</FONT>

<FONT COLOR="#000000">readdbname=slave1</FONT>
<FONT COLOR="#000000">readdbhost=10.10.10.11</FONT>
<FONT COLOR="#000000">readdbuser=asteriskdb</FONT>
<FONT COLOR="#000000">readdbpass=asteriskdbpassword</FONT>

<FONT COLOR="#000000">writedbname=master</FONT>
<FONT COLOR="#000000">writedbhost=10.10.10.10</FONT>
<FONT COLOR="#000000">writedbuser=asteriskdb</FONT>
<FONT COLOR="#000000">writedbpass=asteriskdbpassword</FONT>

<FONT COLOR="#000000">Any thoughts or ideas on how to accomplish will be greatly appreciated.</FONT>

<FONT COLOR="#000000">Thanks.</FONT>

<FONT COLOR="#000000">JR</FONT>

</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>