Thread: Pg_auto_failover

Pg_auto_failover

From
Sonam Sharma
Date:
I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing with below :

ERROR Failed to ensure empty directory "//backup" : Permission denied
Error Failed initialise standby server , see above for details.

Where is it located? 

Can someone please help

Fwd: Pg_auto_failover

From
Sonam Sharma
Date:
Can someone please help

---------- Forwarded message ---------
From: Sonam Sharma <sonams1209@gmail.com>
Date: Tue, Sep 24, 2019, 9:11 PM
Subject: Pg_auto_failover
To: pgsql-general <pgsql-general@postgresql.org>


I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing with below :

ERROR Failed to ensure empty directory "//backup" : Permission denied
Error Failed initialise standby server , see above for details.

Where is it located? 

Can someone please help

Re: Pg_auto_failover

From
Rob Sargent
Date:


On Sep 24, 2019, at 10:22 AM, Sonam Sharma <sonams1209@gmail.com> wrote:

Can someone please help

---------- Forwarded message ---------
From: Sonam Sharma <sonams1209@gmail.com>
Date: Tue, Sep 24, 2019, 9:11 PM
Subject: Pg_auto_failover
To: pgsql-general <pgsql-general@postgresql.org>


I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing with below :

ERROR Failed to ensure empty directory "//backup" : Permission denied
Error Failed initialise standby server , see above for details.

Where is it located? 

Can someone please help

What os, what version of postgres. How was it installed


Re: Pg_auto_failover

From
Rob Sargent
Date:

> On Sep 24, 2019, at 9:41 AM, Sonam Sharma <sonams1209@gmail.com> wrote:
>
> I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up
secondaryit's failing with below : 
>
> ERROR Failed to ensure empty directory "//backup" : Permission denied
> Error Failed initialise standby server , see above for details.
>
> Where is it located?
>
> Can someone please help

“//backup” looks like a typo in the configuration


Re: Pg_auto_failover

From
Sonam Sharma
Date:
Hi Rob,
Os : Linux rhel x86_64
Postgres version : 11.2
Installed the rpm of pg_auto_failover and then set up the monitor, primary. Secondary is failing with given error


On Tue, Sep 24, 2019, 10:11 PM Rob Sargent <robjsargent@gmail.com> wrote:


> On Sep 24, 2019, at 9:41 AM, Sonam Sharma <sonams1209@gmail.com> wrote:
>
> I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing with below :
>
> ERROR Failed to ensure empty directory "//backup" : Permission denied
> Error Failed initialise standby server , see above for details.
>
> Where is it located?
>
> Can someone please help

“//backup” looks like a typo in the configuration

Re: Pg_auto_failover

From
Rob Sargent
Date:

> On Sep 24, 2019, at 11:38 AM, Sonam Sharma <sonams1209@gmail.com> wrote:
>
> Hi Rob,
> Os : Linux rhel x86_64
> Postgres version : 11.2
> Installed the rpm of pg_auto_failover and then set up the monitor, primary. Secondary is failing with given error
>

Well //backup is a valid reference to /backup (double slash simply gets reduced to single slash).  Does /backup exist
andif so, is it empty.  Can you find “//backup” (or even “backup”) anywhere in the parts you “set up”? 




Re: Pg_auto_failover

From
Sonam Sharma
Date:
Hi Rob,

I have no where mentioned /backup. I have manually create backup inside / folder to check why it's giving the error.  The /backup folder is empty only.


On Tue, Sep 24, 2019, 11:15 PM Rob Sargent <robjsargent@gmail.com> wrote:


> On Sep 24, 2019, at 11:38 AM, Sonam Sharma <sonams1209@gmail.com> wrote:
>
> Hi Rob,
> Os : Linux rhel x86_64
> Postgres version : 11.2
> Installed the rpm of pg_auto_failover and then set up the monitor, primary. Secondary is failing with given error
>

Well //backup is a valid reference to /backup (double slash simply gets reduced to single slash).  Does /backup exist and if so, is it empty.  Can you find “//backup” (or even “backup”) anywhere in the parts you “set up”?

Re: Pg_auto_failover

From
bricklen
Date:


On Tue, Sep 24, 2019 at 8:41 AM Sonam Sharma <sonams1209@gmail.com> wrote:
I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing with below :

ERROR Failed to ensure empty directory "//backup" : Permission denied
Error Failed initialise standby server , see above for details.

Is the problem literally that the OS user executing the commands does not have sufficient permission to work in that directory? If you are creating your data directory manually in "/", you might want to create a directory under that path that the user executing the commands has sufficient permission to modify (delete, create, write to)

Re: Pg_auto_failover

From
Sonam Sharma
Date:
My user has permission to touch inside the Fs. 
I am not getting why it is checking for /backup.

Any suggestions on this , what else I can check

On Wed, Sep 25, 2019, 12:15 AM bricklen <bricklen@gmail.com> wrote:


On Tue, Sep 24, 2019 at 8:41 AM Sonam Sharma <sonams1209@gmail.com> wrote:
I was setting up pg_auto_failover. Have successfully set up and monitor and primary instance. While setting up secondary it's failing with below :

ERROR Failed to ensure empty directory "//backup" : Permission denied
Error Failed initialise standby server , see above for details.

Is the problem literally that the OS user executing the commands does not have sufficient permission to work in that directory? If you are creating your data directory manually in "/", you might want to create a directory under that path that the user executing the commands has sufficient permission to modify (delete, create, write to)

Re: Pg_auto_failover

From
Paul Jungwirth
Date:
On 9/25/19 8:55 AM, Sonam Sharma wrote:
> My user has permission to touch inside the Fs.
> I am not getting why it is checking for /backup.
> 
> Any suggestions on this , what else I can check

In addition to the code already linked to, I would look at 

https://github.com/citusdata/pg_auto_failover/blob/1290edd0bab54c627f577cf4462bd16a56b20a1a/src/bin/pg_autoctl/pgctl.c#L429-L437

You see that pg_auto_failover is trying to `mkdir -p $pgdata/../backup` 
(where pgdata is a C variable, not a shell/environment variable). You 
might want to read through the rest of that code to see where pgdata is 
coming from, and see if it's being set correctly. Do you really want 
/backup at the root level?

Clearly whatever user is running pg_basebackup doesn't have permission 
to make that directory. But maybe that's okay and the directory should 
be somewhere else.

-- 
Paul              ~{:-)
pj@illuminatedcomputing.com



Re: Pg_auto_failover

From
Sonam Sharma
Date:
Thanks Paul, I am able to set up. Does pg_auto_failover only works on v10 and v11. 
I am having 9.5 on production.

On Wed, Sep 25, 2019, 11:40 PM Paul Jungwirth <pj@illuminatedcomputing.com> wrote:
On 9/25/19 8:55 AM, Sonam Sharma wrote:
> My user has permission to touch inside the Fs.
> I am not getting why it is checking for /backup.
>
> Any suggestions on this , what else I can check

In addition to the code already linked to, I would look at
https://github.com/citusdata/pg_auto_failover/blob/1290edd0bab54c627f577cf4462bd16a56b20a1a/src/bin/pg_autoctl/pgctl.c#L429-L437

You see that pg_auto_failover is trying to `mkdir -p $pgdata/../backup`
(where pgdata is a C variable, not a shell/environment variable). You
might want to read through the rest of that code to see where pgdata is
coming from, and see if it's being set correctly. Do you really want
/backup at the root level?

Clearly whatever user is running pg_basebackup doesn't have permission
to make that directory. But maybe that's okay and the directory should
be somewhere else.

--
Paul              ~{:-)
pj@illuminatedcomputing.com


Re: Pg_auto_failover

From
Rene Romero Benavides
Date:

On Sat, Sep 28, 2019 at 8:44 AM Sonam Sharma <sonams1209@gmail.com> wrote:
Thanks Paul, I am able to set up. Does pg_auto_failover only works on v10 and v11. 
I am having 9.5 on production.

On Wed, Sep 25, 2019, 11:40 PM Paul Jungwirth <pj@illuminatedcomputing.com> wrote:
On 9/25/19 8:55 AM, Sonam Sharma wrote:
> My user has permission to touch inside the Fs.
> I am not getting why it is checking for /backup.
>
> Any suggestions on this , what else I can check

In addition to the code already linked to, I would look at
https://github.com/citusdata/pg_auto_failover/blob/1290edd0bab54c627f577cf4462bd16a56b20a1a/src/bin/pg_autoctl/pgctl.c#L429-L437

You see that pg_auto_failover is trying to `mkdir -p $pgdata/../backup`
(where pgdata is a C variable, not a shell/environment variable). You
might want to read through the rest of that code to see where pgdata is
coming from, and see if it's being set correctly. Do you really want
/backup at the root level?

Clearly whatever user is running pg_basebackup doesn't have permission
to make that directory. But maybe that's okay and the directory should
be somewhere else.

--
Paul              ~{:-)
pj@illuminatedcomputing.com




--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/