Updating PostgreSQL DBMS from version 9.4 to version 9.6 is performed in the console of the server which you update. The update process can be performed in two modes: - BACKUP - in this mode entire DB is being copied, including all the IWTM DB scheme tablespaces. In BACKUP mode, it is recommended to store files on the following devices only:
- External disk having file systems Ext4, XFS;
- Remote block device connected via protocols iSCSI, NFS;
- Block device connected locally, having file systems Ext4, XFS.
The disk, where IWTM DB scheme tablespaces are located should contain as much free space as they have already taken; - LINK - in this mode DB files are not being copied and the hard links are created from new folders instead of long-time DB. Once the new version is installed and launched, the old one doesn't operate. That's why before updating the DB in the LINK mode it is required totally backing up the previous DB including all the tablespaces. In this mode you may require up to 100 Mb free space.
| Информация |
|---|
| If you connect remotely via SSH, it is recommended using the Screen utility. Thus you can avoid problems in case of lost connection with updating server. When disconnecting from the utility, all the prcocesses started are not to be interrupted and you may safely continue the System update. Important! Using Screen is highly recommended when working with DB and updating DBMS. Basic commands: screen - start the utility;Ctrl+a d - disconnect from screen (to be input within the screen window);screen -ls - display the list of screen running;screen -r - connect to screen again;screen -r name - connect to specific screen with «name»;exit - exit screen (to be input within the screen window).
|
Prepare for update - Back up DB.
- Before updating the DBMS, Traffic Monitor packages are required updating up to actual version, new version PostgreSQL packages are to be installed along with it.
To successfully update PostgreSQL DBMS to version 9.6, version 9.4 must be installed in the System. Check the version of DBMS installed. For this purpose: a. Enter the command to open the file manager:
mc b. Go to /u01/postgres directory c. Select the file PG_VERSION, where the current DBMS version is specified and press F3 to view the content: Image Added d. Press F3 to close the file. If version 9.6 is already installed in the System, then do not run DBMS update and follow the instruction on updating the System. | Предупреждение |
|---|
| If you are updating DBMS as a part of Traffic Monitor version 6.9 which is being reinstalled, then the PG_VERSION file version is 9.6. Follow the instruction to update the DBMS. |
- Set up the update script. For this purpose:
- Go to
/opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6 directory. - Highlight the file
update_from_9.4_to_9.6.sh and press F4 to edit it.
Image Added - Depending on the mode you've selected replace the value of
UPDATEMODE parameter with BACKUP or LINK (by default - BACKUP). - Set the value of
PARALLEL_DEGREE parameter equal to the number of DB server CPU cores (by default - 8). This parameter influences the update processing speed. - Press F2.
- In the opened window ensure saving the file by clicking Save.
- Press F10.
- Press F3 and make sure the file is correct, then press F3 again to close the file.
- Enter the command to close file manager:
exit
- Before updating the DBMS all Traffic Monitor services should be stopped. Enter the commands for this purpose:
- For Traffic Monitor All-in-one installation:
iwtm stop
service iwtm-php-fpm stop
service nagios stop
service iwtm-gearmand stop
service iwtm-consul stop - For Traffic Monitor distributed installation:
- On Traffic Monitor server:
iwtm stop
service iwtm-php-fpm stop
service nagios stop
service iwtm-gearmand stop
service iwtm-consul stop
- On DB server:
iwtm stop service nagios stop service iwtm-consul stop
Update- Enter the command to install packages that are required for installation:
yum install postgresql94-server - Enter the command to go to the required directory:
cd /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6 - Set up the update script. For this purpose enter the command:
bash ./update_from_9.4_to_9.6.sh
Once the update is over, the following message will be displayed: Image Added
After the update process is over, connect to DB and check its working capacity: To connect to DB server from console, enter the command:
su - iwtm psql postgres iwtm -p 5433 Enter the commands:
select version();
select* from version;
explain (analyze, buffers) select * from object_comment; The commands have to be executed with no mistakes. To exit enter the command:
\q Enter the command:
exit | Информация |
|---|
| Also, this check can be performed on Windows managed computers. pgAdmin should be used for this purpose. The check is to be performed using the same commands (step b). |
- Follow the System updates instructions.
Old DB backup removalIf BACKUP update mode is used, the System creates an old DB backup. | Информация |
|---|
| Before removing the new version, working capacity should be checked: make sure the events are loaded into DB and the events search is active. Few days are required for this purpose. |
Removing is to be performed within the DB server console. To remove old DB backup, enter the command: - Enter the command to go to the required directory:
cd /var/log/infowatch/update/postgres96_update_date where date - update date. Example:
cd /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06 - Set up the removal script. For this purpose enter the command:
bash ./delete_old_cluster.sh The removal process cannot be displayed within the console and is successful in case there is no error message. | Предупреждение |
|---|
| Once backup is removed, back to remain is impossible. |
Update rollback| Информация |
|---|
| DBMS update rollback is used only in case of repeated update, once the error occurred. |
The update rollback is possible, when:
- The update was performed in BACKUP mode;
- Before the update backup was manually created in LINK mode.
The update rollback is to be performed within the DB console. To rollback the update it is required: - If the update was performed in BACKUP mode:
- Enter the command to go to the required directory:
cd /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6 - To run the update rollback script, enter the command:
bash ./update_from_9.4_to_9.6.sh rollback
- If the update was performed in LINK mode:
- To stop
postgresql and pgagent services of old and new versions, enter the commands:
service pgagent-9.4 stop
service pgagent-9.6 stop
service postgresql-9.4 stop
service postgresql-9.6 stop - Replace the updated files and DB directories with the ones that were created as the reserved copies.
- To start
postgresql and pgagent services of the old version, enter the commands:
service pgagent-9.4 start
service postgresql-9.4 start
Error alertIf an error occurs, the logs should be collected and sent to the Service Desk. If an error occurred: - During the update or when the update services were started:
- Logs from the update folder.
Example: /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06 - All the logs from folders
/u01/postgres*/pg_log.
- During the update rollback:
- File named
rollback.log from the log update folder. Example: /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06 - All the logs from folders
u01/postgres*/pg_log.
|