PDA

View Full Version : Error when Backup Postgresql using amanda community



laaw80
February 10th, 2015, 12:05 AM
Dear Expert,



I'm confuse with my problem right now:confused:. I have success backup with amanda for linux and windows client. Now I have to try backup my database server with amanda community. I follow this instruction as my guidance (Amanda Wiki How_To:Use_Amanda_to_Back_Up_PostgreSQL#Amanda_Ser ver_Configuration)

The result when I did this command : amcheck DailySet1 in my amanda server then I get this error :
Amanda Backup Client Hosts Check
--------------------------------
ERROR: ldap.mersi.co.id: Application 'ampgsql': Can't locate Amanda/Constants.pm in @INC (@INC contains: /usr/local/share/perl/5.14.2 /etc/perl /usr/local/lib/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/libexec/amanda/application/ampgsql line 38.
ERROR: ldap.mersi.co.id: Application 'ampgsql': BEGIN failed--compilation aborted at /usr/libexec/amanda/application/ampgsql line 38.
ERROR: ldap.mersi.co.id: Application 'ampgsql': exited with status 2
ERROR: ldap.mersi.co.id: Application 'ampgsql': can't run support command
Client check: 2 hosts checked in 6.655 seconds. 4 problems found.

(brought to you by Amanda 3.3.6)


Still confuse:confused: about what I doing next to solve this problem. I have also search in amanda forum and still don't have the answer.

Please help me the expert:).


Thanks


Regards,
Antonius

martineau
February 10th, 2015, 05:54 AM
Where Amanda/Constants.pm is installed on the client (ldap.mersi.co.id)?

The line 21 of ampgsql should list that path (use lib 'path')

laaw80
February 10th, 2015, 08:54 PM
Hi Martineau,


Thanks for reply. I already find Amanda/Constants.pm file in below location on the client :
/usr/local/share/perl/5.14.2 = not found
/etc/perl = not found
/usr/local/lib/perl/5.14.2 = no perl folder
/usr/lib/perl5 = not found
/usr/share/perl5 = not found
/usr/lib/perl/5.14 = not found
/usr/share/perl/5.14 = found this file constant.pm
/usr/local/lib/site_perl = no site_perl folder

But I found it in my amanda server backup => /usr/local/share/perl5/Amanda/Constants.pm. I put the path based on location Constants.pm in Amanda folder. Then I try to do amcheck DailySet1 but the result still with the same error.

Is there any wrong with my client installation ? I installed the client with this command :
# dpkg -I amanda-backup-server_3.3.3-1Ubuntu1204_amd64.deb
# apt-get install ca-certificates
# dpkg -i amanda-backup-server_3.3.3-1Ubuntu1204_amd64.deb

Then put my server hostname in .amandahosts :
# vi /var/lib/amanda/.amandahosts

alpha.mersi.co.id amandabackup


Below is my server and client configuration
Amanda Server Configuration
You need to add the ampgsql application and a corresponding dumptype to your amanda.conf(5)
define application-tool app_ampgsql {
comment "ampgsql"
plugin "ampgsql"
property "TMPDIR" "/tmp"
}

define dumptype dt_ampgsql {
global # You might need this if you're setting 'auth "bsdtcp"' in your global dumptype settings, for example
program "APPLICATION"
application "app_ampgsql"
}

More information about application properties can be found in the man page (ampgsql(8))
NOTE: The directory specified by TMPDIR needs to have enough free space to store an entire copy of the database

You can then add a disklist(5) entry for the server you want to backup. For example:

foo.example.com bar dt_ampgsql

PostgreSQL Server Configuration
First, create a directory for PostgreSQL to archive WAL files to, commonly a sibling of the postgres data directory. This example uses /var/lib/pgsql/archive. Make sure that the user postmaster (the PostgreSQL server) runs as can create files in /var/lib/pgsql/archive, and that the Amanda user has at least read and execute permissions on the directory, and preferably also write permissions.

You need to edit your server configuration (usually postgresql.conf) to enable continuous archiving. Add the following line:

archive_command = 'test ! -f /var/lib/pgsql/archive/%f && cp %p /var/lib/pgsql/archive/%f'

For PostgreSQL 8.3 and newer, you also need to add

archive_mode = on

NOTE: Amanda will need access to superuser privileges. You can create a new role using the createuser program or CREATE ROLE.

With the postgresql admin user, try:

createuser -s amandabackup -P

Then add this user permission to connect to all databases from local or localhost in pg_hba.conf:

echo "host all amandabackup 127.0.0.1/32 md5" >> pg_hba.conf

Amanda Client Configuration

On the client, you need to add the connection information to your amanda-client.conf(5)

property "PG-DATADIR" "/var/lib/pgsql/data"
property "PG-ARCHIVEDIR" "/var/lib/pgsql/archive"
property "PG-HOST" "/tmp"
property "PG-USER" "amandabackup"
property "PG-PASSFILE" "/etc/amanda/pg_passfile"

PG-DATADIR should be the data/cluster directory for your PostgreSQL server
PG-ARCHIVEDIR should be the directory that your archive_command copies files to
PG-HOST can either be a hostname or a directory. TCP and UNIX sockets are used to connect to the server, respectively
PG-USER determines the user Amanda will connect as. It must have superuser priveleges
PG-PASSFILE is the credentials file that Amanda will use to connect.

The credentials file will need to have a line that matches the connection parameters. Based on the example, the following would be appropriate:

/tmp:*:*:amandabackup:my_backup_password


Note Amanda Server & Client :
Server : alpha.mersi.co.id
Client : ldap.mersi.co.id


Thank you


Regards,
Antonius