[asterisk-dev] CDR on multiple database servers - getting rid of duplicates

Leandro Dardini ldardini at gmail.com
Tue Aug 20 05:24:42 CDT 2013


Hello,
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.

cdr_adaptive_odbc.conf has the following configuration:

[cdr1]
connection=asteriskcdrdb1
table=cdrraw

[cdr2]
connection=asteriskcdrdb2
table=cdrraw

As you can imagine, if both mysql servers are available, every CDR is
written twice.

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.

Nothing is better if I use a view with the SELECT DISTINCT, it is slower
than before.

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"

What do you think about it?

Leandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130820/c63a2df4/attachment.htm>


More information about the asterisk-dev mailing list