Database Backup Configuration

The configuration for your Database Backup is via the config.ini file which is must be located in the same folder as the backup script. This should take the following form:

Example
[DatabaseConnection]
host = localhost
username = postgres
password = password
port=5432
dbname = template1
 
[BackupCreds]
local_locn = D:/Data/Backup_Local/
remote_locn = D:/Data/Backup_Remote/
pg_dump_path = "C:/Program Files (x86)/PostgreSQL/8.1/bin/pg_dump.exe"
pg_dumpall_path= "C:/Program Files (x86)/PostgreSQL/8.1/bin/pg_dumpall.exe"
days = 1
 
# comment out the email section if email options are not required 
(in that case will output to console only at present)
 
#[Email]
#email_sender = backup@localhost
#email_recip = jo@localhost
#smtp_address = localhost
 
[Output]
outputlevel:INFO

[DatabaseConnection]

host

This will be "localhost" if the script is running on the same server as the database, or the IP address if running on a separate server. In the case of a separate server, please ensure that the database daemon will accept connections from the backup server.

username

This should be a username that has permission to access all the databases you wish to back up.

password

The password for the defined username.

Please Note: pg_dump, the application used to backup the database, does not use this password and when the backup script runs you will be asked for a password to connect to the database.


If you wish to run your backup as a Workflow Scheduled Job then you will need to store the password for the database. As this information is stored in the  %APPDATA% folder you will need to do the following:



  • Enter the password and check the Store password entry.
  • Click OK.

 The password will be stored in plain text in %appdata%\postgresql\pgpass.conf. This will then be used by the pg_dump application.


port

This will probably be 5432 if the default configuration has been used.

dbname

This can be any database on the server, it's just used to query the pg_catalog and return a list of all the available databases. This means that ALL databases will be backed up.

[BackupCreds]

local_locn

The location on the backup server where the PostgreSQL dump should be saved. Please ensure that the folder has access permissions such that the script can access it, and that there is plenty of space for the backup files.

Note: This should use linux folder separators (/) rather than windows (\) and should include the final separator at the end of the path.


remote_locn

If defined, this should be a location on a remote server that can be accessible via a mapped drive path. If defined, then the script will copy the backup file to this location, and remove the local copy. If not required, please leave blank.

Note: This should use also linux folder separators (/) rather than windows (\) and should include the final separator at the end of the path.

pg_dump_path

The full path to the pg_dump executable e.g. pg_dump.exe which would normally be found in the PostgreSQL bin folder.

pg_dumpall_path

The full path to the pg_dumpall executable e.g. pg_dumpall.exe which would normally be found in the PostgreSQL bin folder.

Note 1: If these paths have spaces in, then it will be necessary to use the dos-style short name for the folders. This can be found at the command prompt by changing (cd) to the directory you require and typing:

dir /x

Note 2: This should use also linux folder separators (/) rather than windows (\) and should be surrounded by double-quotes (").


days

The number of days for which backups should be kept before being removed from either the local location or the remote location.

[Email]

If no email configuration is required, or you are running the script as a Workflow Task in iShare Studio, then this section can be commented out. If you are running the script outside iShare Studio and require email notification, then you will need to remove the # signs from each element of this section, including the heading.

email_sender

The email address that the script should use to send emails FROM.

email_recip

The email address of the person to whom the script should send emails TO. In many email configurations this will need to be an email address within the domain of the mail server, not an external address.

smtp_address

The address of the SMTP mail server e.g. localhost.