Why is postgres not respecting the configs passes via config file? - postgresql

Im trying to change postgres settings using the /var/lib/pgsql/12/data/postgresql file.
Specifically the settings wal_level to miniaml or max_wal_senders to 10 in order to restart a broken postgres service, however even after changing the config file, it still outputs the same error message : " WAL streaming (max_wal_senders > 0) requires wal_level "replica" or "logical" "

if anyone runs into a similar issue, the problem was that i initially changed the config from logical to minimal, however seems like performing that change doesnt alter the dependency max_wal_senders to minimal. Upon restarting postgres, the wal_level = minimal is set on an autoconfig file that runs upon start up which will conflict with the "max_wal_senders " on the normal config file. In order to run it we changed the autoconfig file to logical and postgres ran again

Related

postgres 11.4 fails to start when wal_level is set to minimal

I have migrated my data by dumping and reloading it from pg9.3 to pg11.4 which went fine. And I am able to run the new server with default config
The pg11.4 works fine but it fails to restart when I set in postgres.conf to
wal_level = minimal
This same setting works in my 9.3 instance but not in 11.4
Is there any config setting that could conflict with wal_level = minimal ?
It is no problem to start PostgreSQL v11 with wal_level=minimal unless there is another configuration setting that conflicts with it. For example, archive_mode cannot be on, and max_wal_senders has to be 0.
Look into the PostgreSQL log file for the error message, or start PostgreSQL manually with
pg_ctl start -D datadir
to see the message that will tell you the exact reason why the server failed to start.

How to set postgreSQL to use as buffers more RAM than my computer has?

I have a problem. I am learning PostgreSQL and I work with pgAdmin 4v4. At this point, I am trying to set PostgreSQL to use as buffers more RAM than my computer has. I am thinking of using something like SET shared_buffers TO '256MB' but I am not sure if it is correct. Do you have any ideas?
SET shared_buffers TO '256MB'
This will not work because shared_buffers must be set at server start and cannot be changed later, and this is a command you would run after the server is already running. You would have to put the setting in postgresql.conf, or specify it with the -B option to the "postgres" command.
You could also set it through 'alter system' command, and it would take effect at the next restart. However, you could easily make it a setting that will cause your system to fail to start again (indeed, that appears to be your goal...), at which point you can't use 'alter system' to fix it, and will have to dig into the .conf files.

Postgresql 10 replication mode error

I'm trying to setup a basic master slave configuration using streaming replication for postgres 10 and docker
Since the official docker image provides a docker-entrypoint-initdb.d folder for placing initialization scripts i thought it would be a swell idea to start placing my preparation code here.
What i'm trying to do is automate the way the database is restored before starting the slave in standby mode, so i run
rm -rf /var/lib/postgresql/data/* && pg_basebackup 'host=postgres-master port=5432 user=foo password=foo' -D /var/lib/postgresql/data/
and this succeeds.
Then the server is shutdown and restarted as per the docker initialization script, which pops up a message saying
database system identifier differs between the primary and standby
Now I've been sitting online for a while now, and the only 2 explanations i got is that I either have a misconfigured recovery.conf file, which looks like this
standby_mode = 'on'
primary_conninfo = 'host=postgres-master port=5432 user=foo password=foo'
trigger_file = '/tmp/postgresql.trigger'
Where the connection string is the same one i used for the base backup.
The second solution circulating is that the backup command could be messed up, but the only thing i add to the data folder after backup is the recovery.conf file.
Anyone have any idea where i'm messing up?
Should i just go for repmgr and call it a day?
Thanks in advance
To give an answer to my own question, the issue lied in how the dockerfile entrypoint scripts were called. Rather, they would end up starting the instance as a master or slave according to variables that were not properly set by me.

WAL level not sufficient for making an online backup

I have tried to do database replication in linux 7.0 red hat using postgresql.
I refered this URL for Confuring http://blog.terminal.com/postgresql-replication-and-backup-methods/ I completed the the steps upto this step
Configuring the slave server
but the step
Initial replication
when I executed this command in Master
-bash-4.2$ psql -c "select pg_start_backup('initial_backup');"
I got Error Like this
ERROR: WAL level not sufficient for making an online backup
HINT: wal_level must be set to "archive" or "hot_standby" at server start.
So kindly let me know where we are wrong.
On your master PostgreSQL server's configuration file <PG_DATA>/postgresql.conf there is parameter called wal_level it should be set to either "archive" or "hot_standby"
Both said to postgres to keep WAL segmetnts for replication server. The difference between the two is rather simple:
"hot_standby" means that your replication server will allow connections for SELECT statements
"archive" means you don't want that possibility.
More to read in this tutorial on streaming replication
Also keep in mind that change of wal_level property needs server restart to take an effect.

Postgresql 9.0 streaming replication - processes not starting

I have followed the postgresql wiki binary replication tutorial and cannot get the wal_sender and wal_receiver processes to start on the master or slave server. I'm not seeing any relevant information in the log files to help. I'm able to connect via psql from my slave to my master server, so I'm relatively certain the connection configuration for SR has been setup correctly. Any pointers or tips on setting up SR without log shipping would be wonderful.
Assuming you have PG installed and everything the settings are:
On Master:
add to postgres.conf wal_level = hot_standby and max_wal_senders = 5 settings
add to pb_hba.conf host replication [insert uname] [insert slave ip]/32 trust
On Slave:
create recovery.conf file and add standby_mode = 'on' and primary_conninfo = 'host=localhost port=5432 user=eggie5 password=asdf'
Create baseline:
This is the hard part. You need to get a "snapshot" of the master data (directory) and get to to the slave so they start in synch. You can do this any number of ways: see this page for simple instructions: http://eggie5.com/15-setting-up-pg9-streaming-replication
I had the same problem. I traced the problem back to having used the Postgres-9.0 package that Martin Pitt provides (which I have used since Ubuntu 10.10 doesn't have Postgres-9* in it's package repository yet). I'm guessing that he didn't build the package with streaming replication support.
I have then downloaded and installed the binary package that PostgreSQL provides and the streaming replication started to work smoothly.