Gurjeet Singh singh.gurjeet at gmail.com
Sat Oct 9 20:59:12 PDT 2010
On Sat, Oct 9, 2010 at 11:11 PM, raghavendra t <raagavendra.rao at gmail.com>wrote:

> Thank you Steve,
>
> Let me work and get back with the result.
>
> Regards
> Raghav
>
> On Sun, Oct 10, 2010 at 3:19 AM, Steve Singer <ssinger_pg at sympatico.ca>wrote:
>
>> 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.
>>>
>>>
This is a working code from a setup that I did recently:

"pkeyedtables" => [ eval 'open( fh, "tables"); my $ret; while(<fh>){chomp;
$ret .= "$set_name.$_\|"}; close fh;return split /\|/,$ret;'],

You will need to adapt it to your needs.

Regards,
-- 
gurjeet.singh
@ EnterpriseDB - The Enterprise Postgres Company
http://www.EnterpriseDB.com

singh.gurjeet@{ gmail | yahoo }.com
Twitter/Skype: singh_gurjeet

Mail sent from my BlackLaptop device
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20101009/44ab41bc/attachment.htm 


More information about the Slony1-general mailing list