Repmgr standby clone segmentation fault
Dec 7, 2020
I was trying to simply standby clone. Pretty basic. But I was getting a “segmentation fault”, no further log output.
I didn’t know what a segfault is, so I googled it:
A segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (for example, attempting to write to a read-only location, or to overwrite part of the operating system)
It hit me that prior to running the standby clone that I had run rm -rf $PGDATA
. So, repmgr was trying to standby clone writing into a nonexisting directory. The simple fix was mkdir -p $PGDATA
, and on subsequent runs, using rm -rf $PGDATA/*
instead.