Error connecting to slave database

134 views
Skip to first unread message

Mike Patterson

unread,
Dec 12, 2013, 11:07:40 PM12/12/13
to rub...@googlegroups.com
I've got 2 postgresql databases, one is version 9.1 which is my master database, and the other is 9.3 (hosted on AWS RDS) which has a copy of my master database a few days out of sync. I'm trying to set up my replication from my 9.1 database to my RDS instance. Rubyrep seems ideal for this task as it seemingly does not require any configuration on the slave databases, as RDS allows for little customization, and no SSH access to the actual machine.

I had no trouble installing rubyrep (I've tried both the jruby version and the ruby gem), but I receive an error message from this query being run on the RDS instance:

https://github.com/rubyrep/rubyrep/blob/master/lib/rubyrep/connection_extenders/postgresql_extender.rb#L102-L108

The error tells me there is no connection:

demo.postgres:[~/rubyrep(master)]$ ./rubyrep --verbose scan -c myrubyrep.conf
db 'left' reachable? false
/home/ubuntu/rubyrep/bin/../lib/rubyrep/table_spec_resolver.rb:92 warning: encoding option is ignored - U
db 'left' reachable? true
db 'right' reachable? false
Exception caught: ActiveRecord::ConnectionNotEstablished: no connection available:         SELECT tablename
        FROM pg_tables
        WHERE schemaname = ANY (current_schemas(false))
arjdbc/jdbc/RubyJdbcConnection.java:725:in `execute_query_raw'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.4/lib/arjdbc/jdbc/adapter.rb:504:in `exec_query_raw'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:435:in `log'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:430:in `log'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.4/lib/arjdbc/jdbc/adapter.rb:504:in `exec_query_raw'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.4/lib/arjdbc/jdbc/adapter.rb:511:in `select_rows'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `select_values'
/home/ubuntu/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.4/lib/arjdbc/postgresql/adapter.rb:1090:in `tables'
/home/ubuntu/rubyrep/bin/../lib/rubyrep/table_spec_resolver.rb:14:in `tables'
/home/ubuntu/rubyrep/bin/../lib/rubyrep/table_spec_resolver.rb:91:in `expand_table_specs'
org/jruby/RubyArray.java:1613:in `each'
/home/ubuntu/rubyrep/bin/../lib/rubyrep/table_spec_resolver.rb:83:in `expand_table_specs'
/home/ubuntu/rubyrep/bin/../lib/rubyrep/table_spec_resolver.rb:58:in `resolve'
/home/ubuntu/rubyrep/bin/../lib/rubyrep/session.rb:45:in `manual_primary_keys'
/home/ubuntu/rubyrep/bin/../lib/rubyrep/session.rb:216:in `connect_database'
/home/ubuntu/rubyrep/bin/../lib/rubyrep/session.rb:180:in `refresh_database_connection'

But I am able to verify that the RDS instance is reachable via psql from the master machine, and I am able to run the query from above through pgadmin and psql, so I am really stumped as to why I receive the error when running a scan.

Has anyone seen anything like this, or have any recommendations for other ways to replicate postgresql? I looked at bucardo, but the setup seems a little more involved, and I'm not sure I want to go down that route yet.

Thanks.
Reply all
Reply to author
Forward
0 new messages