<div dir="ltr">Hi Leandro,<div>   First, Im not sure why the solution was layed out like that, but as a rule of thumb, a single unique event should not be writen to 2 different mysql servers when they are running on a master-master replication scheme. This in itself is wrong and should be avoided.</div>
<div>   If for topology reasons, you have 2 groups of Asterisk servers, each one writing to one specific mysql server then to do so, use the mysql increment and offset parameters to prevent collisions.</div><div>   On a second note, I believe the asterisk-users list is better suited for this kind of questions and you will get more answers.</div>
<div><br></div><div>Gaston//</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 20, 2013 at 7:24 AM, Leandro Dardini <span dir="ltr">&lt;<a href="mailto:ldardini@gmail.com" target="_blank">ldardini@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div>I am running a cluster of asterisk servers and each one is writing the CDR to 2 mysql servers configured with multi master replication using the cdr_adaptive_odbc driver.</div>
<div><br></div><div>
cdr_adaptive_odbc.conf has the following configuration:</div><div><br></div><div><div>[cdr1]</div><div>connection=asteriskcdrdb1</div><div>table=cdrraw</div><div><br></div><div>[cdr2]</div><div>connection=asteriskcdrdb2</div>

<div>table=cdrraw</div><div><br></div></div><div>As you can imagine, if both mysql servers are available, every CDR is written twice.</div><div><br></div><div>To get rid of duplicates, every query against the cdr database need to use the &quot;DISTINCT&quot; using an intermediate table and that is slow, really slow.</div>

<div><br></div><div>Nothing is better if I use a view with the SELECT DISTINCT, it is slower than before.</div><div><br></div><div>The only solution I see to add an option in cdr_adaptive_odbc.conf and if set to change the INSERT in the cdr_adaptive_odbc.conf adding a &quot;ON DUPLICATE KEY UPDATE...&quot; or better a &quot;INSERT IGNORE&quot;</div>

<div><br></div><div>What do you think about it? </div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Leandro</div></font></span></div>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">
<div><span style="font-family:&#39;courier new&#39;,monospace">{</span><br></div><div><font face="courier new, monospace"><div>  &quot;fullName&quot; : &quot;Gaston Draque&quot;</div><div>  &quot;email&quot;    : &quot;<a href="mailto:gaston.draque@gmail.com" target="_blank">gaston.draque@gmail.com</a>&quot;<br>
</div><div>  &quot;twitter&quot;  : &quot;@gdraque&quot;</div><div>  &quot;google+&quot;  : &quot;<a href="http://gplus.to/gdraque" target="_blank">gplus.to/gdraque</a>&quot;</div><div>  &quot;linkedIn&quot; : &quot;<a href="http://www.linkedin.com/in/draque" target="_blank">http://www.linkedin.com/in/draque</a>&quot;</div>
</font><font face="courier new, monospace"><div>  &quot;tags&quot;     : [&quot;uc communications&quot;,&quot;telecom integrator&quot;,&quot;voip&quot;,&quot;software development&quot;]</div><div>}</div><div><br></div></font></div>
</div>
</div></div>