Steve Singer ssinger_pg at sympatico.ca
Sat Oct 9 14:49:45 PDT 2010
raghavendra t wrote:
> Hi All,
> 
> I am using slony with perltools.
> 
> 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.
> 
> _Question_
> 
> 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".

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.

So you can just write perl code inside of the conf file to open up your 
file and read it into a variable.

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.

> 
> My Testing
> ========
> 1. Created a tables file "tab.txt" with set of replicating primary key 
> tables.
> 
> 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
> 
> $CLUSTER_NAME = 'firstreplic';
> $LOGDIR = '/var/log/slony';
> $MASTERNODE = 1;
> $DEBUGLEVEL = 2;
> *$TABLEFILE = '/usr/local/pgsql/bin/tab.txt';*
> 
> &add_node(node => 1,host => 'localhost',dbname => 'master',port => 
> 5455,user => 'postgres',password => '');
> &add_node(node => 2,host => 'localhost',dbname => 'slave',port => 
> 5456,user => 'postgres',password => '');

open(INFILE,"<$TABLEFILE");
my $tables='';
while(<INFILE>) {

{
    $line = chomp $_;
    $tables+=$line;
}

> 
> $SLONY_SETS =
> {
>     "set1" =>
>     {
>         "set_id" => 1,
>         "table_id" => 1,
>         "pkeyedtables" =>
>                        * [$TABLEFILE,],*
pkeytables=>$tables  #(replace the above line with this one)
>     }
> };
> 
> Kindly assist me, how to achieve this task.
> 
> Best Regards
> 
> Raghav
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Slony1-general mailing list
> Slony1-general at lists.slony.info
> http://lists.slony.info/mailman/listinfo/slony1-general



More information about the Slony1-general mailing list