One of the utilities that walctl includes is a script dedicated to creating a copy of the source database. Why don't we just use
pg_basebackup? When dealing with large databases common to high availability systems, we want to copy as little data as possible. The
pg_basebackup utility is a great basic tool, but it always copies every file. The
walctl_clone program that we use in this recipe relies on
Of course, this raises another question: Why not just use
rsync directly? Due to its extensive capabilities,
rsync is inherently dangerous. Did you accidentally transpose the source and target destination parameters? If you did so, you've just erased or corrupted your database master. The
walctl_clone tool wraps
rsync in such a way that it can only retrieve data from a master node. We can stay safe by limiting its use to clone servers.
In this recipe, we'll introduce and invoke the
walctl_clone command, which does a few other useful things on our behalf. Not...