octopus gem trying to write to slave instead of master

813 views Asked by At

The following error is being generated on a slave server for a rails 3.2.18 application running gem "ar-octopus" over postgreSQL 9.3.5

 ActiveRecord::StatementInvalid in Devise::SessionsController#create

PG::ReadOnlySqlTransaction: ERROR:  cannot execute UPDATE in a read-only transaction
: UPDATE "users" SET "last_sign_in_at"

The shards.yml fiel is defined to its slave

octopus:
  replicated: true
  fully_replicated: true
  environments:
    - development
    - production
  development:
    shards:
      slave1:
        adapter: postgresql
        host: slave_1_ip_address
        database: app_development
        username: my_user
        password: my_password

and should nominally identify the master from the database.yml file

development:
#  adapter: postgresql
  adapter: postgis
  database: app_development
  username: my_user
  schema_search_path: public

You'll note that the adapter comes in both forms: as this application requires postgis, the master is defined with postgis, and I assume the slave ought to be as well as queries will require it. Still, both forms have been tried and the error stays the same.

Why is octopus not doing what it purports to?

0

There are 0 answers