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">&lt;<a href="http://asterisk.org">asterisk.org</a>@<a href="http://sedwards.com">sedwards.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 class="im">On Wed, 19 Aug 2009, ABBAS SHAKEEL wrote:<br>
<br>
</div>&gt; Rsync looks really great !<br>
<br>
Yep. Something I wish I learned about earlier in my career :)<br>
<div class="im"><br>
&gt; How you are get CDR records etc from the remote servers for reporting<br>
&gt; purpose ..... I was thinking to have one centralized database ? but your<br>
&gt; 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} &quot;+%T Mark the records on ${HOST} to be collected.&quot;<br>
                 mysql\<br>
                         ${USER_AUTH}\<br>
                         --database=@DATABASE_DATABASE@\<br>
                         --execute=&quot;update cdrs set disposition = &#39;COLLECTING&#39;&quot;\<br>
                         --execute=&quot; where disposition is NULL;&quot;\<br>
                         --host=${HOST}\<br>
                         ${END_OF_LIST}<br>
<br>
${DATE} &quot;+%T Dump the marked records from ${HOST}.&quot;<br>
                 mysqldump\<br>
                         ${USER_AUTH}\<br>
                         --databases @DATABASE_DATABASE@\<br>
                         --host=${HOST}\<br>
                         --no-create-info\<br>
                         --skip-opt\<br>
                         --tables cdrs\<br>
                         --where=&quot;disposition = &#39;COLLECTING&#39;&quot;\<br>
                         &gt;/tmp/${HOST}.sql\<br>
                         ${END_OF_LIST}<br>
<br>
${DATE} &quot;+%T Load the records from ${HOST} into our database.&quot;<br>
                 mysql\<br>
                         ${USER_AUTH}\<br>
                         --database=@DATABASE_DATABASE@\<br>
                         --host=localhost\<br>
                         &lt;/tmp/${HOST}.sql\<br>
                         ${END_OF_LIST}<br>
<br>
${DATE} &quot;+%T Compressing the dump file from ${HOST}.&quot;<br>
                 gzip /tmp/${HOST}.sql<br>
                 mv /tmp/${HOST}.sql.gz /tmp/${HOST}.sql.gz-${TIMESTAMP}<br>
<br>
${DATE} &quot;+%T Delete the collected records from ${HOST}.&quot;<br>
                 mysql ${USER_AUTH}\<br>
                         --database=@DATABASE_DATABASE@\<br>
                         --execute=&quot;delete from cdrs where disposition = &#39;COLLECTING&#39;;&quot;\<br>
                         --host=${HOST}\<br>
                         ${END_OF_LIST}<br>
<br>
${DATE} &quot;+%T Set the disposition on this host.&quot;<br>
                 mysql ${USER_AUTH}\<br>
                         --database=${DATABASE_DATABASE}\<br>
                         --execute=&quot;update cdrs set disposition = &#39;COLLECTED&#39;&quot;\<br>
                         --execute=&quot; where disposition = &#39;COLLECTING&#39;;&quot;\<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>