Thanks Steve for this great info ... thanks alot.<br><br><div class="gmail_quote">On Wed, Aug 19, 2009 at 6:26 PM, Steve Edwards <span dir="ltr"><<a href="http://asterisk.org">asterisk.org</a>@<a href="http://sedwards.com">sedwards.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Wed, 19 Aug 2009, ABBAS SHAKEEL wrote:<br>
<br>
</div>> Rsync looks really great !<br>
<br>
Yep. Something I wish I learned about earlier in my career :)<br>
<div class="im"><br>
> How you are get CDR records etc from the remote servers for reporting<br>
> purpose ..... I was thinking to have one centralized database ? but your<br>
> comments let me think about distributed database ?<br>
<br>
</div>I like having a database at each datacenter for autonomy and performance.<br>
<br>
Periodically, the master database executes a script with the following<br>
snippet (error checking and irrelevant details removed for brevity):<br>
<br>
# for each host<br>
for HOST in ${HOST_LIST}<br>
do<br>
<br>
${DATE} "+%T Mark the records on ${HOST} to be collected."<br>
mysql\<br>
${USER_AUTH}\<br>
--database=@DATABASE_DATABASE@\<br>
--execute="update cdrs set disposition = 'COLLECTING'"\<br>
--execute=" where disposition is NULL;"\<br>
--host=${HOST}\<br>
${END_OF_LIST}<br>
<br>
${DATE} "+%T Dump the marked records from ${HOST}."<br>
mysqldump\<br>
${USER_AUTH}\<br>
--databases @DATABASE_DATABASE@\<br>
--host=${HOST}\<br>
--no-create-info\<br>
--skip-opt\<br>
--tables cdrs\<br>
--where="disposition = 'COLLECTING'"\<br>
>/tmp/${HOST}.sql\<br>
${END_OF_LIST}<br>
<br>
${DATE} "+%T Load the records from ${HOST} into our database."<br>
mysql\<br>
${USER_AUTH}\<br>
--database=@DATABASE_DATABASE@\<br>
--host=localhost\<br>
</tmp/${HOST}.sql\<br>
${END_OF_LIST}<br>
<br>
${DATE} "+%T Compressing the dump file from ${HOST}."<br>
gzip /tmp/${HOST}.sql<br>
mv /tmp/${HOST}.sql.gz /tmp/${HOST}.sql.gz-${TIMESTAMP}<br>
<br>
${DATE} "+%T Delete the collected records from ${HOST}."<br>
mysql ${USER_AUTH}\<br>
--database=@DATABASE_DATABASE@\<br>
--execute="delete from cdrs where disposition = 'COLLECTING';"\<br>
--host=${HOST}\<br>
${END_OF_LIST}<br>
<br>
${DATE} "+%T Set the disposition on this host."<br>
mysql ${USER_AUTH}\<br>
--database=${DATABASE_DATABASE}\<br>
--execute="update cdrs set disposition = 'COLLECTED'"\<br>
--execute=" where disposition = 'COLLECTING';"\<br>
--host=localhost\<br>
${END_OF_LIST}<br>
<br>
# end of hosts loop<br>
done<br>
<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">Thanks in advance,<br>
-------------------------------------------------------------------------<br>
Steve Edwards <a href="mailto:sedwards@sedwards.com">sedwards@sedwards.com</a> Voice: +1-760-468-3867 PST<br>
Newline Fax: +1-760-731-3000<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>
AstriCon 2009 - October 13 - 15 Phoenix, Arizona<br>
Register Now: <a href="http://www.astricon.net" target="_blank">http://www.astricon.net</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Best Regards<br>Shakeel Abbas<br><br>