Image for post
Image for post
can you blame me for this one?

Let’s put it together, piece by piece, so we have a clear idea of what we’re running on our system and how to configure them.

Apache


Image for post
Image for post


Image for post
Image for post
photo credit: East Bay Times


This article is aimed to help someone that needs to run pg_basebackup. The Postgresql documentation is excellent, and hopefully this will serve as an example of successful usage.

Image for post
Image for post

Problem


Image for post
Image for post

Why is my archive/ directory on my Centos 7 Postgresql 10.4 installation several hundred GibiBytes?

### Here is what the Archiving section of the postgresql.conf file looks like by default:# - Archiving -archive_mode = on              # enables archiving; off, on, or always
# (change requires restart)
archive_command = 'cp %p /var/lib/pgsql/10/archive/%f' # command to use to archive a logfile…


-- execute a pg_dump as root
# pg_dump -U postgres -Fc source-db-name > /directory/path/db-dump-name.dump
  • pg_dump invokes the utility.
  • -U postgres switches the command to be run as the postgres user.
  • -Fc puts the resulting file into a format that can be restored from.
  • > outputs the command to the singular dump file.
  • The synopsis from the official documentation is:
    pg_dump [connection-option...] [option...] [dbname]

Now, Let’s make sure we understand how to create a new blank database instance to restore into.

-- first switch to postgres user
# su - postgres
-- invoke psql interactive terminal
$ psql
-- then create a new blank db
postgres-# CREATE DATABASE…


Let’s take a pg_dump!

Image for post
Image for post

1. Connect to VPN

$ sudo vpnc rsvpn


Image for post
Image for post

1. add necessary repo

# rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm


Image for post
Image for post
-- because sometimes you're not just going from Windows to Linux :-)
you're going from Linux to Linux, and that's cool


TL;DR:
$ sudo su -
# useradd granular
# passwd granular
# usermod -aG wheel granular
$ sudo su -
// this switches to you the become the root user
# useradd granular
// we just created a user named granular
# passwd granular
// after following the prompts, this will set the password for the user…

About

Timothy D Beach

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store