Use this scenario if the migration is performed on a new clean server.
Preparation 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.
For data transfer, it is recommended to use the scp utility, which provides secure copying via SSH.
scp -r ~/backup user@remote-server:~
- user — username of the new server;
- remote-server — address of the new server.
After the transfer, switch to the backup folder in the home directory on the new server:
cd ~/backup
Creating 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 with version 1.3.0.
sudo -u postgres createdb core sudo -u postgres psql -d core -f evi-backup.dump
Ensure that the dump is downloaded correctly.
Downloading and unpacking the migration archive
wget https://archive.eltex-co.ru/evi-raw/evi-1.4.0/db_migration-1.3.0-1.4.0.zip unzip db_migration-1.3.0-1.4.0.zip cd db_migration-1.3.0-1.4.0
Running 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>
- host — IP address of the host with PostgreSQL and ClickHouse;
- user — username for the database (will be created if necessary);
- password — user password;
- psql_db_name_from — name of the PostgreSQL database from which the migration is performing;
- psql_db_name_to — name of the PostgreSQL database to which the migration will be performed;
- psql_port — PostgreSQL port;
- ch_def_user_password — password for the ClickHouse user;
- ch_db_name — name of the ClickHouse database to which the migration will be performed.
sudo bash migrate.sh localhost core core core core 5432 core core
After successfully executing the migration script, the message Restoring DB done <3 will appear in the console.
Then proceed to the Installing and configuring EVI services after migration section.