ruby - Rails Postgresql replication via Octopus gem when in Development env -


apparently when using octopus gem postgres replication should plug , play. can't seem find i'm doing wrong.

this config/shards.yml

octopus:   environments:     - development   replicated: true   development:     slave1:       adapter: postgresql       host: localhost       database: slaveapp_development       username: pguser       password: pgpass 

the ar model provider(i create exact same tables in each app via rake tasks) i'd sync/replicate slave:

class provider < activerecord::base   has_many :products   replicated_model() end 

i boot both apps via rails server , enter masterapp's console , there:

> provider.using(:slave1).create({provider_params...})   #=> works! new record in slave1's db. > provider.using(:master).create({provider_params...})   #=> works partly. creates record in master's db. 

the problem when calling provider.using(:master)... i'm expecting:

1 - create record @ master's db.

2 - replicate same record @ slave1's db. <--- not happening.

that not purpose of octopus gem.

it redirects database requests, depending on whether read or write operation. way can use rails models without thinking current database connection , if fits intended operation.

it not copy data slaves.

to perform actual replication, i.e. data transfer master slaves, have set yourself.

there several options postgresql. if using newer version (9.1+) can use integrated streaming replication in "hot standby" mode. there tutorials on how set up, e.g.

if stuck older version of postgresql have @ alternatives.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -