Re: Running psql in a docker container

2024-07-12 Thread felix . quintgz
In the docker-compose.yml file it can be passed in the environment variables.

POSTGRES_INITDB_ARGS: "--encoding=UTF-8"


 On Thursday, July 11, 2024 at 10:58:14 AM GMT-4, H  
wrote:

 I used to successfully run psql server 13 in a CentOS 7 docker container with 
CentOS 7 as the host operating system. I have now upgraded that system to Rocky 
Linux 9 as the host operating system and modifying my container to also use 
Rocky Linux 9 and psql server 16.

I can successfully get the container up and running and can connect to it. 
However, I have not managed to modify the initdb statement to use en_US.UTF-8 
for all databases.

In the old container I used:

su - postgres -c "/usr/pgsql-13/bin/initdb -D /var/lib/pgsql/13/data/ -E 
'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'"

but this does not work with psql 16. I tried:

su - postgres -c "/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data/ -E 
'UTF-8' --lc-lang='en_US'"

and variations thereof with no success.

Any suggestions on what I have missed?

Thank you.




Replication lag in Postgres

2024-07-12 Thread Mukesh Tanuku
Hello everyone.
Firstly thanks to the community members who are addressing all the queries
that are posted. Those give us more insights about the issues/doubts in the
postgres.

I have a question with postgres HA setup.
We are setting up a 2 node postgres cluster with async streaming
replication, we want to define a RPO (Recovery point objective) in case of
primary failure.

How can we best define the RPO in this setup? since it's an async streaming
replication setup there might be a chance of data loss which is
proportional to the replication delay.

Is there any way we can configure the delay duration, like for example to
make sure every 10 mins the standby sync has to happen with primary?

Thank you
Regards
Mukesh T


Re: Replication lag in Postgres

2024-07-12 Thread Laurenz Albe
On Fri, 2024-07-12 at 20:41 +0530, Mukesh Tanuku wrote:
> I have a question with postgres HA setup.
> We are setting up a 2 node postgres cluster with async streaming replication, 
> we want to
> define a RPO (Recovery point objective) in case of primary failure. 
> 
> How can we best define the RPO in this setup? since it's an async streaming 
> replication
> setup there might be a chance of data loss which is proportional to the 
> replication delay. 
> 
> Is there any way we can configure the delay duration, like for example to 
> make sure every
> 10 mins the standby sync has to happen with primary? 

When there is a delay, it is usually because replay at the standby is delayed.
The WAL information is still replicated.  You won't lose that information on
failover; it will just make the failover take longer.

Unless you have a network problem, you should never lose more than a fraction
of a second.

Yours,
Laurenz Albe




Re: Replication lag in Postgres

2024-07-12 Thread Mukesh Tanuku
Thank you for the information Laurenz Albe

On Fri, Jul 12, 2024 at 9:13 PM Laurenz Albe 
wrote:

> On Fri, 2024-07-12 at 20:41 +0530, Mukesh Tanuku wrote:
> > I have a question with postgres HA setup.
> > We are setting up a 2 node postgres cluster with async streaming
> replication, we want to
> > define a RPO (Recovery point objective) in case of primary failure.
> >
> > How can we best define the RPO in this setup? since it's an async
> streaming replication
> > setup there might be a chance of data loss which is proportional to the
> replication delay.
> >
> > Is there any way we can configure the delay duration, like for example
> to make sure every
> > 10 mins the standby sync has to happen with primary?
>
> When there is a delay, it is usually because replay at the standby is
> delayed.
> The WAL information is still replicated.  You won't lose that information
> on
> failover; it will just make the failover take longer.
>
> Unless you have a network problem, you should never lose more than a
> fraction
> of a second.
>
> Yours,
> Laurenz Albe
>