<div dir="ltr">I agree with you. Usually if you have database in multimaster replication mode, writing to one of the server is enough to make the info be written in both. Unfortunately the cdr_adaptive_odbc driver cannot use a failover configuration as working for example in the func_odbc driver. I had no choice other than to write the CDR info to both databases. I am not sure which one will be available. At the end I get two records for every call and I have to filter out the duplicates. Obviously I have no primary/unique index on the cdr table.<div>
<br></div><div>Maybe I was not clear, I was proposing a patch to add a parameter to cdr_adaptive_odbc.conf to allow the usage of INSERT IGNORE. This way I can configure a primary/unique index on the uniqueid of the cdr table and avoid having to deal with duplicates.</div>
<div><br></div><div>The patch was trivial, plus it seems not to be of any interest... sorry for bothering :-)</div><div><br></div><div>Leandro<br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/8/20 Gaston Draque <span dir="ltr"><<a href="mailto:gaston.draque@gmail.com" target="_blank">gaston.draque@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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"><div><div class="h5">On Tue, Aug 20, 2013 at 7:24 AM, Leandro Dardini <span dir="ltr"><<a href="mailto:ldardini@gmail.com" target="_blank">ldardini@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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 "DISTINCT" 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 "ON DUPLICATE KEY UPDATE..." or better a "INSERT IGNORE"</div>
<div><br></div><div>What do you think about it? </div><span><font color="#888888"><div><br></div><div>Leandro</div></font></span></div>
<br></div></div><div class="im">--<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></div></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all">
<div><br></div>-- <br><div dir="ltr">
<div><span style="font-family:'courier new',monospace">{</span><br></div><div><font face="courier new, monospace"><div> "fullName" : "Gaston Draque"</div><div> "email" : "<a href="mailto:gaston.draque@gmail.com" target="_blank">gaston.draque@gmail.com</a>"<br>
</div><div> "twitter" : "@gdraque"</div><div> "google+" : "<a href="http://gplus.to/gdraque" target="_blank">gplus.to/gdraque</a>"</div><div> "linkedIn" : "<a href="http://www.linkedin.com/in/draque" target="_blank">http://www.linkedin.com/in/draque</a>"</div>
</font><font face="courier new, monospace"><div> "tags" : ["uc communications","telecom integrator","voip","software development"]</div><div>}</div><div><br></div></font></div>
</div>
</font></span></div></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></div></div></div>