Octopus stone trying to write to subordinate instead of master

On the slave, the following error is generated for rails app 3.2.18 running the gem "ar-octopus" versus 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 fix is shards.yml

determined by his subordinates

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 will notice that the adapter comes in both forms: since this application requires postgis, the master is defined using postgis, and I suppose the slave should be the same as the requests will require it. However, both forms have been tried and the error remains the same.

Why doesn't the octopus do what it claims to do?

+3


source to share





All Articles