I'm new to managing servers, especially postgresql on Ubuntu Server, so bear with me.
I'm trying to synchronize between two databases on two different computers, but I'm not sure what I did wrong, since whatever I tried to do, it seems to have configured the servers into read-only mode.
For example, if I wanted to create a role, I would get:
ERROR: cannot execute CREATE ROLE in a read-only transaction
Or if I want to create a table, I would get an error message:
ERROR: cannot execute CREATE TABLE in a read-only transaction.
I have no idea what to do here, so advice on how to resolve this issue is greatly appreciated.
I'm running PostgreSQL version 9.1 on Ubuntu Server 12.04 for by the way.
Since
SELECT pg_is_in_recovery()
istrue
you're connected to a read-only replica server inhot_standby
mode. The replica configuration is inrecovery.conf
.You can't make it read/write except by promoting it to a master, at which point it will stop getting new changes from the old master server. See the PostgreSQL documentation on replication.
First step is to check whether there is a 'recovery.conf' file in the data directory. If it exists, if you are sure you are on master (not slave) server, rename that file to 'recover.conf.backup'. Then, re-start postgresql server. It should allow you to write new records now.