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

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

Оглавление

Migration from 1.4.0 to 1.5.0

General information

This document describes the process of migrating the system from version 1.4.0 to version 1.5.0.
Migration includes updating the PostgreSQL and ClickHouse database schemas, as well as transferring data.

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

Before starting the migration, be sure to back up all data as described in Preliminary steps section.

System requirements

Recommended resources for successful migration (based on a system with 3,000 employees, 2,200 passes, and 300 cameras):

  • Free disk space: no less than 25 GB;
  • RAM: no less than 16 GB;
  • Services: PostgreSQL and ClickHouse must be running on the same host;
  • Internet connection: stable (for downloading the migration archive);
  • Installed software: clickhouse-client.

Migration scenarios

Подсказка

Use Migration on the current server scenario if the update is performed on the same server where the system with version 1.3.1 is already running.

Подсказка

Use Migration on a new server scenario, if the migration is performed on a new clean server.

Якорь
presteps
presteps
Preliminary steps

Creating a temporary directory

Create a temporary folder for backup and migration files in the user's home directory:

Блок кода
languagebash
titleCreating a temporary directory
linenumberstrue
mkdir ~/backup
cd ~/backup
mkdir db_migration-1.4.0-1.5.0

Database backup

Before dumping the database, it is necessary to stop the services.

...

Блок кода
languagebash
titleDatabase backup
sudo -u postgres pg_dump core > evi-backup.dump

Then proceed to the Migration on the current server or Migration on a new server step, depending on requirements.

Якорь
current_server
current_server
Migration on the current server

Подсказка

Use this scenario if the update is performed on the same server where the system is already running.

Uploading and unpacking the migration archive

While in the ~/backup folder, run the following commands:

Блок кода
languagebash
titleUploading and unpacking the migration archive
linenumberstrue
wget https://archive.eltex-co.ru/evi-raw/evi-1.5.0/db_migration-1.4.0-1.5.0.tar
tar -xf db_migration-1.4.0-1.5.0.tar -C db_migration-1.4.0-1.5.0
cd db_migration-1.4.0-1.5.0

Removing the current EVI Platform

Блок кода
languagebash
titleRemoving all services of the current version
sudo apt purge evi-core-web evi-core evi-scud evi-live evi-archive evi-analyzer nginx

Preparation for installation

Perform the necessary preliminary steps as described in the Preparation for installation section.

Installing the ClickHouse database

Since the PostgreSQL database is already installed, the next step is to install ClickHouse: see the Installing the database section, ClickHouse database subsection.

Running the migration script

Блок кода
languagebash
titleRunning the migration script
sudo bash migrate.sh <host> <user> <password> <psql_db_name_from> <psql_db_name_to> <psql_port> <ch_def_user_password> <ch_db_name>

...

After successfully executing the migration script, the "Restoring DB done <3" message will appear in the console.

Then proceed to the Verification of configuration files section.

Якорь
new_server
new_server
Migration on a new server

Подсказка

Use this scenario if the migration is performed on a new clean server.

Preparing for installation

Perform the necessary preliminary steps as described in the Preparation for installation section.

Installing the databases

Install and configure PostgreSQL and ClickHouse as described in the Installing the database section.

Creating a backup folder with a backup copy of data

Back up all data as described in the Preliminary steps section.

Transferring prepared files

Copy the backup folder along with all its contents from the source server to the new one.

...

Блок кода
languagebash
cd ~/backup

Creating a user in PostgreSQL

Блок кода
languagebash
titleCreating a user in PostgreSQL
sudo -u postgres psql -c "CREATE USER core; ALTER USER core WITH PASSWORD 'core'; ALTER USER core WITH SUPERUSER;"
Подсказка

If necessary, change the password to a more secure one. 

The examples use the default password and username.

Restoring a database from a dump

Download database of the current version:

...

Подсказка

Ensure that the dump is downloaded correctly.

Downloading and unpacking the migration archive

Блок кода
languagebash
titleDownloading and unpacking the migration archive
linenumberstrue
wget https://archive.eltex-co.ru/evi-raw/evi-1.5.0/db_migration-1.4.0-1.5.0.tar
tar -xf db_migration-1.4.0-1.5.0.tar -C db_migration-1.4.0-1.5.0
cd db_migration-1.4.0-1.5.0

Running the migration script

Блок кода
languagebash
sudo bash migrate.sh <host> <user> <password> <psql_db_name_from> <psql_db_name_to> <psql_port> <ch_def_user_password> <ch_db_name>

...

Then proceed to installing and configuring EVI services, as described in the Ubuntu 22.04.5 LTS section.

Якорь
migration_check
migration_check
Verification of configuration files 

Version 1.5.0 includes changes to the structure and settings of the configuration files, which can be viewed at Platform configuration section.

Verifying the migration result

After completing the migration, perform the following steps:

...