Data Backup and Recovery

Fully utilizing the POSTGRES plugin

tmacfcnit
5,222 Views

Ok, before I really break something....


I Think I have the plug nearly set up. Upon running:

<path>/snapcreator --action quiesce --policy daily --profile POSTGRES

--config POSTGRES --verbose

It tries to run the command:

/bin/su - postgres -c "/usr/bin/psql -d fecru -U postgres --nopassword --single-transaction --file <path>/files/blah.sc

and it fails with return code 0: ERROR: WAL archiving is not active


I have RHEL6, using the POSTGRES rpms from the distro.

I set "archive_mode = on" in /var/lib/pgsql/data/postgresql.conf (and

also in /etc/sysconfig/pgsql/postgresql.conf for kicks)

Looks like I also need to set archive_command?


I am going to try archive_command = 'cp "%p" /mnt/server/archivedir/"%f"'


Does anyone have any other helpful tips when trying to use this plugin?


--tmac

8 REPLIES 8

nkarthik
5,222 Views
did you try after set the "archive_command" option set in postgresql.conf file.
You can do some manual backup and restore testing
backup:
select pg_start_backup('label');
rsh -l root:<filerpassword> filername snap create <postgresvolname> snapshotname
select pg_stop_backup();
Restore:
stop the postgresql [pg_ctl stop]
rsh -l root:<filerpassword> filername snap restore -s snapname postgresvolname
rm $PGDATA/postmaster.pid
pg_ctl start –l /usr/local/pgsql/logfile
Please check and let me know.

tmacfcnit
5,222 Views

Ok, I am closer.

I now see something like this:
<date time code> INFO: Quiescing databases

<date time code> INFO: Quiescing database fecru

<date time code> INFO: Quiescing database jira

<date time code> ERROR: Command [/bin/su - postgres -c "/usr/bin/psql -d jira -U postgres --no-password --single-transaction --file <path>/files/blah.sc"] failed with return code [0] and message [psql:/<path>/files/blah.sc:1: ERROR: a backup is alread in progress

/var/lib/pgsql (nfsv4 mount) is where the database files are.I was told there are 3 databases: fecru, confluence and jira.

Yet, when I put any one of them into "backup" mode (i.e. quiesce) Postgres does not allow me to do the others. Does that mean then, that by placing one of the databases in backup mode, they all get in backup mode?

Thanks

nkarthik
5,222 Views

something wrong in the blah.sc. it has multiple database details inside. can you try manual (mentioned in the previous)with one database and then check the SC.

tmacfcnit
5,222 Views

I am not all to familiar with Postgres. I have a line in the POSTGRES.conf file for the databases:

fecru:postgres;jira:postgres;confluence:postgres

One for each of the databases. I am sure if I widdle that down to just any one of the three, it will be fine. I am curious though, about about the "other" databases?

If I put fecru in to archive mode, does jira & confluence also get put in that state automatically?

Thanks

nkarthik
5,222 Views

No. you can try manually put the fecru into online backup mode and check the writes jira & confluence database.

tmacfcnit
5,222 Views

I do not understand...

you can try manually put the fecru into online backup mode and check the writes jira & confluence database

What do you mean by that? examples?

nkarthik
5,222 Views

1. Try with one database like fecru in blah.sc

2. Manual:

    1. Psql fecru
    2. select
      pg_start_backup(‘
      label’, true)
    3. rsh -l root:<filerpassword> filername snap create
      <postgresvolname> snapshotname
    4. psql jira
    5. do some writes operation in jira [check it works]
    6. Psql fecru
    7. select pg_stop_backup();

Regards,

Karthik   

tmacfcnit
5,222 Views

Some questions on your idea:

psql -d fecri  ---> doesn't this select *only* the fecru database?

when looking at /var/lib/pgsql/data/base I see six directories.

There just happen to be six databases. The three I am dealing with, plus template0, template1 and postgres.

When archive mode is "turned on", wouldn't it be for just the one database, since that is what I selected?

Even if I tried what you asked, How can I tell that the writes to the second database are happening either on the filesystem or in the WAL (write-ahead-log)?

Thanks.

Public