Ruby Rep Configuration While specifying port through tunnel

551 views
Skip to first unread message

Mathew Thomas

unread,
Aug 3, 2011, 9:16:46 AM8/3/11
to rubyrep
I need to setup replication using ruby rep between 2 servers where
direct connectivity does not exist.

So i have set up an ssh tunnel from server A which listens to the 5432
port on server B...
I am able to connect to the database on B from A using psql
command...But ruby rep is not working...

[root@warehouse1 rubyrep-1.2.0]# /usr/local/postgresql-9.0.1/bin/psql -
U postgres -h 127.0.0.1 -p 8738 -d new_vodafone_user_data_oltp -c
"select now()"
now
----------------------------------

2011-08-03 18:48:15.495278+05:30


My configuration is as follows.

RR::Initializer::run do |config|
config.left = {
:adapter => 'postgresql', # or 'mysql'
:database => 'vodafone_rubyrep',
:username => 'postgres',
:password => 'abc',
:host => 'localhost',
:port => '5432'
}

config.right = {
:adapter => 'postgresql',
:database => 'new_vodafone_user_data_oltp',
:username => 'postgres',
:password => 'postgres',
:host => '127.0.0.1',
:port => '8738'
}
config.options[:database_connection_timeout] = 600
config.include_tables 'subscription_pkg'


Error:-

[root@warehouse1 rubyrep-1.2.0]# ./rubyrep --verbose scan -c
vodarep2.conf
Exception caught: no connection to 'right' database
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/session.rb:189:in
`refresh_database_connection'
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/session.rb:158:in
`refresh'
org/jruby/RubyArray.java:1676:in `each'
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/session.rb:158:in
`refresh'
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/session.rb:227:in
`initialize'
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/base_runner.rb:151:in
`session'
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/base_runner.rb:166:in
`execute'
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/base_runner.rb:187:in
`run'
/home/postgres/RubyRep/rubyrep-1.2.0/lib/rubyrep/command_runner.rb:
102:in `run'
./bin/rubyrep:7:in `(root)'


Any help regarding this problem would be much appreciated...

Santhosh Krishna

unread,
Feb 13, 2012, 7:07:43 AM2/13/12
to rub...@googlegroups.com
Hi
I am facing the same problem.
I am sure ruby rep is able to connect to the remote database server because if I configure wrong database name or db password, it gives an error.
However the sync does not seem to work.It fails giving the error "Exception caught: no connection to 'left' database"

Any help would be appreciated...

Thanks 
Santhosh Krishna

Toni Bagur

unread,
Feb 6, 2013, 3:29:50 AM2/6/13
to rub...@googlegroups.com
Hi all, 
I had the same problem. Looking at the stack trace generated by the --verbose option(/rubyrep --verbose scan -c myrubyrep.conf)  I found that there is an undocumented option (database_connection_timeout) that controls the timeout of the database connection. I set it to 2000 in the configuration file and the problem has been solved. 
    config.options[:database_connection_timeout] = 2000
I hope that this solution would help otther people with the same problem because I spent a lot of time to figure this out.

Toni.

Ricardo Emanuel Rozo Sevilla

unread,
Sep 26, 2014, 11:04:31 PM9/26/14
to rub...@googlegroups.com
config.options[:database_connection_timeout] = 2000

Thanks Toni!!! it really works!!
Reply all
Reply to author
Forward
0 new messages