<div dir="ltr"><div class="gmail_quote">On Sat, Oct 9, 2010 at 11:11 PM, raghavendra t <span dir="ltr"><<a href="mailto:raagavendra.rao@gmail.com">raagavendra.rao@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>Thank you Steve,</div>
<div> </div>
<div>Let me work and get back with the result.</div>
<div> </div>
<div>Regards</div>
<div>Raghav<br><br></div><div><div></div><div class="h5">
<div class="gmail_quote">On Sun, Oct 10, 2010 at 3:19 AM, Steve Singer <span dir="ltr"><<a href="mailto:ssinger_pg@sympatico.ca" target="_blank">ssinger_pg@sympatico.ca</a>></span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div>raghavendra t wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">Hi All,<br><br>I am using slony with perltools.<br><br>I have taken the sample file from the "/usr/local/src/slony1-2.0.4/tools/altperl/slon_tools.conf-sample" and modified as per my requirement.<br>
<br>_Question_<br><br>In the place of Tables list/Sequenst list. Can I use any text file which contain all the tables information. If yes, how could I pass the test file to the "slon_tools.conf-sample".<br></blockquote>
<br></div>Yes, slon_tools.conf is a perl script, the slon_tools run the .conf file as a perl script and execute the code in it.<br><br>So you can just write perl code inside of the conf file to open up your file and read it into a variable.<br>
<br>I have not tested/tried to run the below code so there might be a syntax error or other problems but it should give you the general idea.
<div><br><br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote"><br>My Testing<br>========<br>1. Created a tables file "tab.txt" with set of replicating primary key tables.<br>
<br>2. Edited the "slon_tools.conf-sample" and trying to send the "tab.txt" file. Below is the "slon_tools.conf-sample" file I am trying to use<br><br>$CLUSTER_NAME = 'firstreplic';<br>
$LOGDIR = '/var/log/slony';<br>$MASTERNODE = 1;<br>$DEBUGLEVEL = 2;<br>*$TABLEFILE = '/usr/local/pgsql/bin/tab.txt';*<br><br>&add_node(node => 1,host => 'localhost',dbname => 'master',port => 5455,user => 'postgres',password => '');<br>
&add_node(node => 2,host => 'localhost',dbname => 'slave',port => 5456,user => 'postgres',password => '');<br></blockquote><br></div>open(INFILE,"<$TABLEFILE");<br>
my $tables='';<br>while(<INFILE>) {<br><br>{<br> $line = chomp $_;<br> $tables+=$line;<br>}<br><br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div><br>$SLONY_SETS =<br>{<br> "set1" =><br> {<br> "set_id" => 1,<br> "table_id" => 1,<br> "pkeyedtables" =><br></div> * [$TABLEFILE,],*<br>
</blockquote>pkeytables=>$tables #(replace the above line with this one)<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div> }<br>};<br><br>Kindly assist me, how to achieve this task.<br><br clear="all"></div></blockquote></blockquote></div></div></div></blockquote><div><br>This is a working code from a setup that I did recently:<br><br>
"pkeyedtables" => [ eval 'open( fh, "tables"); my $ret; while(<fh>){chomp; $ret .= "$set_name.$_\|"}; close fh;return split /\|/,$ret;'], <br><br>You will need to adapt it to your needs.<br>
<br>Regards,<br></div></div>-- <br>gurjeet.singh<br>@ EnterpriseDB - The Enterprise Postgres Company<br><a href="http://www.EnterpriseDB.com">http://www.EnterpriseDB.com</a><br><br>singh.gurjeet@{ gmail | yahoo }.com<br>
Twitter/Skype: singh_gurjeet<br>
<br>Mail sent from my BlackLaptop device<br>
</div>