Creating a PostgreSQL Server Backup Set for Linux
There are two options to create a PostgreSQL Server Backup Set for Linux:
For backup set creation on AhsayCBS web console, most backup set preferences may be configured using AhsayCBS except the following:
- backup set encryption key settings
- PostgreSQL login password
After the backup set preferences are setup on the AhsayCBS web console, to complete the backup set creation process the RunConfigurator.sh script will need to be used on the PostgreSQL machine to do the following:
- to setup the backup set encryption key settings
- to export/import the backupSet.xml file to setup the PostgreSQL login password
For backup set creation using command line, most backup set preferences may be configured using the backupSet.xml file.
To complete the backup set creation process after successfully importing the backupSet.xml file, the RunConfigurator.sh script will need to be used on the PostgreSQL machine to setup the backup set encryption key settings.
Create a PostgreSQL Server Backup Set Using AhsayCBS Web Console
Log in to AhsayCBS.
Go to User.
Go to Backup Set then click the "+" button to create a backup set.
Select the “Backup set type” which should be PostgreSQL Backup. Input the “Name”, then select the “Platform” which should be Linux. Update the “Login ID, “Host” and “Port” if needed. Default settings for these are postgres, localhost or 127.0.0.1 and 5432 respectively. Input the “Path to pg_dump” then click the right arrow icon.
Add the backup source in the “Other Selected Source” by clicking the "+" icon e.g. path is PostgreSQL\PostgreSQL1.
To back up all databases in the PostgreSQL machine, use the path PostgreSQL.
Input the path of the source to be backed up. Click the "+" button to add the source. Keep doing this until all the backup source are added.
To exclude a source, you can add it under “Deselected Source” by clicking the "+" button.
Input the path of the source to be excluded from the backup. Click the "+" button to add the deselected source. Keep doing this until all source to be excluded are added. Click the right arrow icon afterwards.
The “Run scheduled backup for this backup set” is turned on by default. If you do not want to create a backup schedule you can turn it off by sliding the lever to the left. This schedule may either be edited or deleted if you want to create your own backup schedule.
It is optional to input the computer name in the “Run scheduled backup on computers named” field since it will be updated once backup set creation is completed in the AhsayOBM client. In Step 12 the computer name can be checked as the Owner.
Click the "+" button to add a new backup schedule. Once done setting the schedule click the "+" then the right arrow icon to proceed.
Select the “Backup Mode” if Concurrent or Sequential. By default, Sequential is selected. In Sequential backup mode, if there are multiple destinations configured in the backup set, AhsayOBM will back up to one destination at a time. In Concurrent backup mode, if there are multiple destinations configured in the backup set, AhsayOBM will backup to all destinations at the same time or concurrently.
For backup sets with multiple destinations, sequential backup mode will take longer compared with concurrent backup mode.
If Concurrent is selected, specify the maximum number of backup destinations.
Click the + button to add a standard and/or predefined destinations.
Select your desired destination. Tick the checkbox and click the + icon to proceed.
Click the Save button to create the Backup Set.
Click on the backup set you just created.
Go to Others and input the path of your temporary directory. It is recommended to check the box beside Remove temporary files after backup to make sure the spooled database files are cleaned up after each backup job to free up space on the temporary drive. Otherwise, if the temporary drive runs out of space the database backup job will not run. You can also change the settings for “Compressions”. Click the Save button once done.
Open ssh session in the Linux machine and execute the RunConfigurator.sh script. The Login Menu will be displayed. Select (1). Login then press Enter to login. Input your “Login Name” and “Password”. Set the encryption setting for the backup set.
# cd /usr/local/obm/bin # sh RunConfigurator.sh Startup Ahsay Online Backup Manager ... Config file found Login Menu ------ (1). Login (2). Change Network Settings (3). Forgot Password (4). Quit ------ Your Choice: 1 Login Name: postgres Password: ************ Please wait while verifying user account with server... Your profile has been downloaded and updated. Encryption setting has not been defined for backup set "PostgreSQL Backup Linux" Do you want to set the encryption setting for this backup set? (Y/N) ? Y Enable Encryption (Y/N) ? Y Choose Encryption Type ------------ (1). Default (2). User password (3). Custom ------------ Your Choice: 2
Export the backup set to XML by selecting (3). Export Backup Set Setting to XML.
Main Menu ------ (1). List Backup Sets (2). Delete Backup Set (3). Export Backup Set Settings to XML (4). Import Backup Set Settings from XML (5). Generate new Backup Set Settings Template (6). Change Language [English] (7). Update Profile Settings (8). Quit --------- Your Choice: 3 Choose your backup set to generate XML file ------------------------------------------- (1). PostgreSQL Backup (2). PostgreSQL Backup Linux ------------------------------------------- Your Choice: 2 XML file successfully exported to /root/.obm/config/backupSet.xml
Optional: Exit from the Main Menu, you can check the details of the XML file by using an editor like vi.
# cd /root/.obm/config # vi backupSet.xml <xml version="1.0" encoding="UTF-8"?> <Setting> <!--This is the backup set setting--> <Key name="Backup Set Setting" allowMultiple="Y"> <!--Backup set ID (Read Only) --> <Value data="1730788094246" name="ID" type="string" /> <!--Backup set type (Read Only) --> <Value data="PostgreSQL" name="Type" type="string" /> <!--Backup set name --> <Value data="PostgreSQL Backup Linux" name="Name" type="string" /> <!--Temporary directory for storing backup files --> <Value data="/temp" name="Temporary Working Directory" type="string"/>
Please refer to PostgreSQL Backup Set XML Template (with Explanation) for details.
Import the backup set by selecting (4). Import Backup Set Setting from XML. Confirm overwrite of file.
Main Menu --------- (1). List Backup Sets (2). Delete Backup Set (3). Export Backup Set Settings to XML (4). Import Backup Set Settings from XML (5). Generate new Backup Set Settings Template (6). Change Language [English] (7). Update Profile Settings (8). Quit --------- Your Choice: 4 Reading xml... Reading xml...Done Verifying destination 'AhsayCBS'... Backup Set ' PostgreSQL Backup Linux ' already exist. Confirm overwrite? (Y/N) ? Y XML imported, uploading to server... XML successfully uploaded to server
Check in AhsayCBS web console if “Encryption” setting was successfully added.
Create a PostgreSQL Server Backup Set Using Command Line
To create a PostgreSQL database backup set, select (5). Generate new Backup Set Settings Template from the menu.
Main Menu --------- (1). List Backup Sets (2). Delete Backup Set (3). Export Backup Set Settings to XML (4). Import Backup Set Settings from XML (5). Generate new Backup Set Settings Template (6). Change Language [English] (7). Update Profile Settings (8). Quit --------- Your Choice: 5
Select (6). PostgreSQL Database to generate a PostgreSQL Server Backup Set template file to /root/.obm/config directory.
Choose a template from a backup set type ---------------------------------------- (1). File (2). Linux Bare Metal (3). MySQL Data Base (4). MariaDB (5). Oracle Database Server (6). PostgreSQL Database (7). Tibero Database Server ---------------------------------------- Your Choice: 6 XML file successfully exported to /root/.obm/config/backupSet.xml Main Menu --------- (1). List Backup Sets (2). Delete Backup Set (3). Export Backup Set Settings to XML (4). Import Backup Set Settings from XML (5). Generate new Backup Set Settings Template (6). Change Language [English] (7). Update Profile Settings (8). Quit --------- Your Choice:
Configuring PostgreSQL Backup Set Settings.
To configure the PostgreSQL backup set setting you need to edit the /root/.obm/config/backupSet.xml file using a text editor, for example vi.
You can either quit the RunConfigurator.sh script or open a new ssh session to edit the backupSet.xml file.
Before importing the backupSet.xml file please remove any unused destinations and backup schedule settings. Otherwise, the following error will be displayed “Failed to import XML file (Reason: Value of name is empty!)” when trying to import the backupSet.xml file.
Importing the updated backupSet.xml file to AhsayOBM.
After you have edited the backupSet.xml file with your chosen backup settings you need to import the settings back to AhsayOBM, so they can be uploaded to the AhsayCBS backup server to create the backup set.
For example: to create a new PostgreSQL backup set called “PostgreSQL Backup Linux” with encryption enabled and default encryption settings.
Main Menu --------- (1). List Backup Sets (2). Delete Backup Set (3). Export Backup Set Settings to XML (4). Import Backup Set Settings from XML (5). Generate new Backup Set Settings Template (6). Change Language [English] (7). Update Profile Settings (8). Quit --------- Your Choice: 4 New backup set created. Enable Encryption (Y/N) ? Y Choose Encryption Type ---------------------- (1). Default (2). User password (3). Custom ---------------------- Your Choice: 1 XML imported, uploading to server... XML successfully uploaded to server
Verify the Backup Set Settings
To verify the uploaded backup set settings are correct select (1). List Backup Sets and then select the backup set you wish to verify, for example backup set named “PostgreSQL Backup Linux”.
Main Menu --------- (1). List Backup Sets (2). Delete Backup Set (3). Export Backup Set Settings to XML (4). Import Backup Set Settings from XML (5). Generate new Backup Set Settings Template (6). Change Language [English] (7). Update Profile Settings (8). Quit --------- Your Choice: 1 Select a Backup Set to show more details ---------------------------------------- (1). PostgreSQL Backup (2). PostgreSQL Backup Linux ---------------------------------------- Your Choice: 2 Name : PostgreSQL Backup Linux Owner : pgsql16-u22 Type : PostgreSQL Selected Source : PostgreSQL/PostgreSQL1 Destination Name : AhsayCBS, Type: OBS Encryption Key : 123 Encryption Algorithm : AES Encryption Mode : CBC Encryption Key Length : 256
- We would like to stress that it is very important to keep a separate record of your encryption key in a safe place, as you will not be able to restore your data without the correct key.
- If you re-install AhsayOBM or install AhsayOBM on another machine, the encryption key will be required for restoring data from the backup set.