Дерево страниц

Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.
Комментарий: Published by Scroll Versions from space TMIG and version 6.11
Sv translation
languageru

 

Обновление СУБД PostgreSQL с версии 9.4 до версии 9.6 будет вестись в консоли обновляемого сервера.
Процесс обновления может проходить в двух режимах:

  • BACKUP - в этом режиме создается копия всей БД, включая все табличные пространства схемы БД

...

  • IWTM. В качестве хранилища файлов в режиме BACKUP необходимо использовать только:
    • Внешний диск с файловыми системами Ext4, XFS;
    • Удаленное блочное устройство, подключенное по протоколам iSCSI, NFS;
    • Локально подключенное блочное устройство с файловыми системами Ext4, XFS.
    На диске, где размещаются табличные пространства схемы БД

...

  • IWTM, должно быть столько же свободного пространства, сколько уже ими занято;

  • LINK - в этом режиме файлы БД не копируются, а из новых папок создаются жесткие ссылки на файлы старой БД. После установки и запуска новой версии старая перестанет функционировать. Поэтому перед обновлением в режиме LINK необходимо сделать полный бэкап предыдущей базы со всеми табличными пространствами.
    В этом режиме на диске может потребоваться до 100 Мб свободного пространства.

Информация
titleПримечание:

Если вы используете удаленное подключение по протоколу SSH, рекомендуется использовать утилиту Screen. Это позволит избежать проблем в случае разрыва соединения с обновляемым сервером. При отключении от утилиты запущенные в ней процессы не прервутся, что позволит безопасно продолжить обновление Системы.
Важно! Использование Screen особенно рекомендуется при работе с БД и обновлении СУБД.

Основные команды:

  • screen - запустить утилиту;
  • Ctrl+a d - отключиться от screen (вводится в окне screen);
  • screen -ls - вывести список запущенных screen;
  • screen -r - повторно подключиться к screen;
  • screen -r name - подключиться к определенному screen с именем «name»;
  • exit - выйти из screen (вводится в окне screen).

Подготовка к обновлению

  1. Выполните резервное копирование БД.
  2. Перед обновлением СУБД обновите пакеты Traffic Monitor до актуальной версии, вместе с ними будут установлены пакеты с новой версией PostrgreSQL.

...

  1. Для обновления СУБД PostgreSQL до версии 9.6 в Системе должна быть установлена версия 9.4. Проверьте версию установленной СУБД. Для этого:
    1. Введите команду для открытия файлового менеджера:
      mc
    2. Перейдите в директорию /

...

    1. u01/postgres
    2. Выделите файл PG_VERSION,  в котором указана установленная версия СУБД, и нажмите F3 для просмотра его содержимого
      Image Added
    3. Нажмите F3 для закрытия файла.
      Если версия 9.6 уже установлена в Системе, не запускайте обновление СУБД и продолжайте следовать инструкции по обновлению Системы.

      Предупреждение
      titleВажно!

      Если обновление СУБД проходит в рамках обновления Traffic Monitor c версии 6.9 путем переустановки, в файле PG_VERSION будет указана версия 9.6. Продолжите обновление СУБД по инструкции.

  1. Выполните настройку скрипта обновления. Для этого:
    1. Перейдите в директорию /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6
    2. Выделите файл update_from_

...

    1. 9.4_to_

...

    1. 9.6.sh и нажмите F4 для его редактирования

...


...

    1. Image Modified
    2. В зависимости от выбранного режима обновления замените значение параметра UPDATEMODE на BACKUP или LINK (по умолчанию - BACKUP).
    3. Установите значение параметра PARALLEL_DEGREE равным количеству процессорных ядер сервера с БД (по умолчанию - 8). Параметр влияет на скорость процесса обновления.
    4. Нажмите F2.
    5. В открывшемся окне подтвердите сохранение файла, нажав Save.
    6. Нажмите F10.
    7. Нажмите F3 и убедитесь в корректности содержимого файла, затем снова нажмите F3 для закрытия файла.

    8. Введите команду для закрытия файлового менеджера:
      exit
  1. Перед обновлением СУБД должны быть остановлены все сервисы Traffic Monitor. Для этого введите команды:

    1. При установке Traffic Monitor Все-в-одном:

...

    1. iwtm stop
      service iwtm-php-fpm stop
      service nagios stop
      service iwtm-gearmand stop

      service iwtm-consul stop
    1. При распределенной установке Traffic Monitor:
      1. На сервере Traffic Monitor:

...

      1. iwtm stop
        service iwtm-php-fpm stop
        service nagios stop
        service iwtm-gearmand stop
        service iwtm-consul stop
      2. На сервере БД:
        iwtm stop
        service nagios stop
        service iwtm-consul stop

Обновление

  1. Для установки необходимых для обновления пакетов выполните команду:
    yum install postgresql94-server
  2. Введите команду для перехода в нужную директорию

...

  1. :
    cd /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6
  2. Для запуска скрипта обновления выполните команду

...

  1. :
    bash ./update_from_9.4_to_9.6.sh

    Когда обновление установится, на экран будет выведено сообщение: Image Added
  2. После завершения процесса обновления подключитесь к базе данных и проверьте ее работоспособность:
    1. Чтобы подключиться к серверу БД из консоли

...

    1. введите

...

    1. команды:

...

    1. su - iwtm
      psql postgres iwtm -p 5433

    2. Далее введите команды:
      select version();

...


    1. select* from version;

      explain (analyze, buffers) select * from object_comment;
      Команды должны быть выполнены без ошибок.
    2. Для выхода введите команду:
      \q

    3. Введите команду:
      exit

      Информация
      titleПримечание:

      Также эту проверку можно произвести с рабочих станций под управлением Windows. Для этого используйте программу pgAdmin.
      Проверка выполняется теми же командами (

...

    1. шаг b

...

    1. ).

...

  1. Продолжайте следовать инструкции по обновлению Системы

...

  1. .

Удаление бэкапа старой БД

Если использовался режим обновления BACKUP, системой создан бэкап старой БД.

Информация
titleПримечание:

Перед удалением необходимо проверить работоспособность новой версии: убедиться в том, что события загружаются в БД, а также работает поиск по событиям.
На это лучше выделить несколько дней.

Удаление будет вестись в консоли сервера БД. Чтобы удалить бэкап старой БД выполните команды:

  1. Введите команду для перехода в нужную директорию:
    cd /var/log/infowatch/update/

...

  1. postgres96_update_дата

...

  1. где дата - дата обновления.

    В нашем примере:
    cd /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06
  2. Для запуска скрипта удаления выполните команду:
    bash ./delete_old_cluster.sh
  3. Процесс удаления не будет отображаться в консоли и будет успешно завершен, если не выведено сообщение об ошибке. 
Предупреждение
titleВажно!

После удаления бэкапа нельзя будет откатиться к старой версии.

Откат обновления

Информация
titleПримечание:

Откат СУБД используется только для повторного обновления, если в процессе возникла ошибка.

Откат обновления возможен, если:

  • Обновление проводилось в режиме BACKUP

...

  • .
  • Перед обновлением в режиме LINK был создан бэкап вручную.

Откат обновления будет вестись в консоли сервера БД. Для отката обновления необходимо:

  • Если обновление проводилось в режиме BACKUP:
    1. Введите команду для перехода в нужную директорию:
      cd /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6
    2. Для запуска скрипта отката обновления введите команду:
      bash ./update_from_9.4_to_9.6.sh rollback
  • Если обновление проводилось в режиме LINK:
    1. Для остановки сервисов postgresql и pgagent старой и новой версий введите команды:
      service pgagent-9.4 stop
      service pgagent-9.6 stop
      service postgresql-9.4 stop
      service postgresql-9.6 stop
    2. Замените обновленные файлы и директории БД на созданные в результате резервного копирования.
    3. Для запуска сервисов postgresql и pgagent старой версии введите команды:
      service pgagent-9.4 start
      service postgresql-9.4 start

Действия при ошибках

Если возникает ошибка, соберите логи и отправьте их в службу технической поддержки.

Если ошибка возникла:

  • В процессе обновления или при запуске сервисов после обновления:
    1. Логи из папки обновления.
      В нашем примере: /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06
    2. Все логи из папок /u01/postgres*/pg_log.

  • В процессе отката обновления:
    1. Файл с имененм rollback.log из папки логов обновления.
      В нашем примере: /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06
    2. Все логи из папок /u01/postgres*/pg_log.
Sv translation
languageen

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.
Информация
titleNote:

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 

  1. Back up DB.
  2. 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.
  3. 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.

    Предупреждение
    titleImportant!

    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.

  4. Set up the update script. For this purpose:
    1. Go to /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6 directory.
    2. Highlight the file update_from_9.4_to_9.6.sh and press F4 to edit it.
      Image Added
    3. Depending on the mode you've selected replace the value of UPDATEMODE parameter with BACKUP or LINK (by default - BACKUP).
    4. 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.
    5. Press F2.
    6. In the opened window ensure saving the file by clicking Save.
    7. Press  F10.
    8. Press F3 and make sure the file is correct, then press F3 again to close the file.
    9. Enter the command to close file manager:
      exit
  5. Before updating the DBMS all Traffic Monitor services should be stopped. Enter the commands for this purpose:
    1. 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
    2. For Traffic Monitor distributed installation:
      1. On Traffic Monitor server:
           iwtm stop
           service iwtm-php-fpm stop
           service nagios stop
           service iwtm-gearmand stop
           service iwtm-consul stop
      2. On DB server:
           iwtm stop
           service nagios stop
           service iwtm-consul stop

Update

  1. Enter the command to install packages that are required for installation:
    yum install postgresql94-server
  2. Enter the command to go to the required directory:
    cd /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6
  3. 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
  4. After the update process is over, connect to DB and check its working capacity:

     

    1. To connect to DB server from console, enter the command:
      su - iwtm
      psql postgres iwtm -p 5433

    2. Enter the commands:
      select version();
      select* from version;
      explain (analyze, buffers) select * from object_comment;

      The commands have to be executed with no mistakes.

    3. To exit enter the command:
      \q

    4. Enter the command:
      exit

      Информация
      titleNote:

      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).

  5. Follow the System updates instructions.

Old DB backup removal

If BACKUP update mode is used, the System creates an old DB backup.

Информация
titleNote:

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:

  1. 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
  2. Set up the removal script. For this purpose enter the command:
    bash ./delete_old_cluster.sh
  3. The removal process cannot be displayed within the console and is successful in case there is no error message.

    Предупреждение
    titleImportant!

    Once backup is removed, back to remain is impossible.

Update rollback

Информация
titleNote:

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:
    1. Enter the command to go to the required directory: 
      cd /opt/iw/tm5/csw/postgres/scripts/update_from_9.4_to_9.6
    2. 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:
    1. 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
    2. Replace the updated files and DB directories with the ones that were created as the reserved copies.
    3. To start  postgresql and pgagent services of the old version, enter the commands:
      service pgagent-9.4 start
      service postgresql-9.4 start

Error alert

If 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:
    1. Logs from the update folder.
      Example: /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06
    2. All the logs from folders /u01/postgres*/pg_log.
  • During the update rollback:
    1. File named rollback.log from the log update folder.
      Example: /var/log/infowatch/update/postgres96_update_2018-01-29_15:37:06
    2. All the logs from folders u01/postgres*/pg_log.