diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 5be3ae5e3..b625aeb40 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -70,6 +70,10 @@ + +

Preliminary documentation for 11 unprivileged user backup.

+
+

Build containers from scratch for more accurate testing. Use a prebuilt s3 server container.

diff --git a/doc/xml/user-guide.xml b/doc/xml/user-guide.xml index 3162dec1e..5a565a517 100644 --- a/doc/xml/user-guide.xml +++ b/doc/xml/user-guide.xml @@ -34,6 +34,8 @@ /var/lib/postgresql /var/lib/pgsql + postgres + /usr/share/perl5 /usr/bin @@ -85,6 +87,8 @@ {[pg-path]}/recovery.conf {[pg-path]}/recovery.conf + pg_switch_xlog + u16 co6 @@ -189,11 +193,11 @@ Create <host>{[setup-ssh-host]}</host> host key pair - - mkdir -m 750 -p {[pg-home-path]}/.ssh + + mkdir -m 750 -p {[setup-ssh-user-home-path]}/.ssh - - ssh-keygen -f {[pg-home-path]}/.ssh/id_rsa + + ssh-keygen -f {[setup-ssh-user-home-path]}/.ssh/id_rsa -t rsa -b 4096 -N "" @@ -204,7 +208,7 @@ Copy <host>{[setup-ssh-host]}</host> public key to <host>{[host-repo1]}</host> - ssh root@{[setup-ssh-host]} cat {[pg-home-path]}/.ssh/id_rsa.pub | + ssh root@{[setup-ssh-host]} cat {[setup-ssh-user-home-path]}/.ssh/id_rsa.pub | sudo -u pgbackrest tee -a {[br-home-path]}/.ssh/authorized_keys @@ -214,7 +218,7 @@ ssh root@{[host-repo1]} cat {[br-home-path]}/.ssh/id_rsa.pub | - sudo -u postgres tee -a {[pg-home-path]}/.ssh/authorized_keys + sudo -u {[setup-ssh-user]} tee -a {[setup-ssh-user-home-path]}/.ssh/authorized_keys @@ -223,8 +227,8 @@ Test connection from <host>{[host-repo1]}</host> to <host>{[setup-ssh-host]}</host> - - ssh postgres@{[setup-ssh-host]} + + ssh {[setup-ssh-user]}@{[setup-ssh-host]} -o StrictHostKeyChecking=no ls @@ -232,7 +236,7 @@ Test connection from <host>{[setup-ssh-host]}</host> to <host>{[host-repo1]}</host> - + ssh pgbackrest@{[host-repo1]} -o StrictHostKeyChecking=no ls @@ -266,7 +270,7 @@ - apt-get install sudo ssh wget + apt-get install sudo ssh wget vim -y 2>&1 @@ -294,7 +298,7 @@ - yum install openssh-server openssh-clients sudo wget + yum install openssh-server openssh-clients sudo wget vim -y 2>&1 @@ -321,7 +325,7 @@ - echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' | + echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main 11' | sudo tee -a /etc/apt/sources.list.d/pgdg.list @@ -634,6 +638,17 @@ {[host-pg1]} + + Create <user>{[br-user]}</user> user + + + adduser --ingroup {[pg-group]} --disabled-password --gecos "" {[br-user]} + + + adduser -g{[pg-group]} -n {[br-user]} + + + {[host-pg1]} postgres @@ -1386,8 +1401,8 @@ psql -c " - select pg_create_restore_point('generate WAL'); select pg_switch_xlog(); - select pg_create_restore_point('generate WAL'); select pg_switch_xlog();" + select pg_create_restore_point('generate WAL'); select {[pg-switch-wal]}(); + select pg_create_restore_point('generate WAL'); select {[pg-switch-wal]}();" @@ -1999,10 +2014,10 @@ Create <host>{[host-repo1]}</host> host key pair - + mkdir -m 750 {[br-home-path]}/.ssh - + ssh-keygen -f {[br-home-path]}/.ssh/id_rsa -t rsa -b 4096 -N "" @@ -2010,7 +2025,15 @@ {[host-pg1]} + postgres + {[pg-home-path]} + + @@ -2030,7 +2053,7 @@ {[pg-path]} {[host-pg1]} - postgres + {[br-user]} y 2 @@ -2056,12 +2079,28 @@

Commands are run the same as on a single host configuration except that some commands such as backup and expire are run from the repository host instead of the database host.

+ + Set permissions required for backup + + + + psql -c " + create user pgbackrest; + grant pg_read_all_settings to pgbackrest; + grant execute on function pg_start_backup(text, boolean, boolean) to pgbackrest; + grant execute on function pg_stop_backup(boolean, boolean) to pgbackrest; + grant execute on function pg_switch_wal() to pgbackrest; + grant execute on function pg_create_restore_point(text) to pgbackrest;" + + + +

Create the stanza in the new repository.

Create the stanza - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} stanza-create @@ -2071,7 +2110,7 @@ Check the configuration - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} check @@ -2079,7 +2118,7 @@ Check the configuration - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} check @@ -2094,7 +2133,7 @@ Backup the {[postgres-cluster-demo]} cluster - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} backup @@ -2133,7 +2172,7 @@ Backup the {[postgres-cluster-demo]} cluster - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} backup @@ -2162,7 +2201,7 @@ Perform a backup with single process - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-type=full backup @@ -2176,7 +2215,7 @@ Perform a backup with multiple processes - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-type=full backup @@ -2184,7 +2223,7 @@ Get backup info for the {[postgres-cluster-demo]} cluster - + {[project-exe]} info timestamp start/stop @@ -2212,7 +2251,7 @@ Attempt a backup - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} backup \: stop file exists for all stanzas @@ -2253,7 +2292,7 @@ Attempt a backup - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} backup \: stop file exists for stanza demo @@ -2292,6 +2331,17 @@ {[host-pg2]}
+ + Create <user>{[br-user]}</user> user + + + adduser --ingroup {[pg-group]} --disabled-password --gecos "" {[br-user]} + + + adduser -g{[pg-group]} -n {[br-user]} + + + {[host-pg2]} postgres @@ -2309,7 +2359,15 @@ {[host-pg2]} + postgres + {[pg-home-path]} + + @@ -2335,7 +2393,7 @@ n -

The demo cluster must be created (even though it will be overwritten restore) in order to create the configuration files.

+

The demo cluster must be created (even though it will be overwritten on restore) in order to create the configuration files.

Create demo cluster @@ -2445,14 +2503,14 @@

So, what went wrong? Since is pulling WAL segments from the archive to perform replication, changes won't be seen on the standby until the WAL segment that contains those changes is pushed from {[host-pg1]}.

-

This can be done manually by calling pg_switch_xlog() which pushes the current WAL segment to the archive (a new WAL segment is created to contain further changes).

+

This can be done manually by calling {[pg-switch-wal]}() which pushes the current WAL segment to the archive (a new WAL segment is created to contain further changes).

- Call <code>pg_switch_xlog()</code> + Call <code>{[pg-switch-wal]}()</code> - psql -c "select *, current_timestamp from pg_switch_xlog()"; + psql -c "select *, current_timestamp from {[pg-switch-wal]}()"; @@ -2597,7 +2655,7 @@
-

Now when a table is created on {[host-pg1]} it will appear on {[host-pg2]} quickly and without the need to call pg_switch_xlog().

+

Now when a table is created on {[host-pg1]} it will appear on {[host-pg2]} quickly and without the need to call {[pg-switch-wal]}().

Create a new table on the primary @@ -2720,11 +2778,11 @@ psql -c " - select pg_create_restore_point('test async push'); select pg_switch_xlog(); - select pg_create_restore_point('test async push'); select pg_switch_xlog(); - select pg_create_restore_point('test async push'); select pg_switch_xlog(); - select pg_create_restore_point('test async push'); select pg_switch_xlog(); - select pg_create_restore_point('test async push'); select pg_switch_xlog();" + select pg_create_restore_point('test async push'); select {[pg-switch-wal]}(); + select pg_create_restore_point('test async push'); select {[pg-switch-wal]}(); + select pg_create_restore_point('test async push'); select {[pg-switch-wal]}(); + select pg_create_restore_point('test async push'); select {[pg-switch-wal]}(); + select pg_create_restore_point('test async push'); select {[pg-switch-wal]}();" @@ -2790,7 +2848,7 @@ {[pg-path]} {[host-pg2]} - postgres + {[br-user]} y @@ -2800,7 +2858,7 @@ Backup the {[postgres-cluster-demo]} cluster from <host>pg2</host> - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} --log-level-console=detail backup backup file {[host-pg1]}|replay on the standby @@ -2956,7 +3014,7 @@ Upgrade the stanza - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-no-online {[dash]}-log-level-console=info stanza-upgrade completed successfully @@ -3030,7 +3088,7 @@ Check configuration - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} check @@ -3040,7 +3098,7 @@ Run a full backup - + {[project-exe]} {[dash]}-stanza={[postgres-cluster-demo]} {[dash]}-type=full backup