I created a new database on Heroku using a follower. After it was 0 commits behind I unfollow the master db and promote it as default.
Seems to be working fine but looks to be read only. When I try to seve a record from the console now I see this error
ActiveRecord::StatementInvalid: PG::Error: ERROR: cannot execute UPDATE in a read-only transaction
Any idea how to solve this?
The replica never actually got promoted. See comments.
You can tell when a replica is following a master server because:
SELECT pg_is_in_recovery();
will return true. This cannot return true in a master server because the only time a master server can be in recovery is when it is still starting up - and then you cannot connect to it, so you can't run that command. That's true as of 9.2 and 9.3beta; this may change in future versions, so if you're reading this and on a newer version check for a dedicated function for checking if the server is a replica.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With