User Tools

Site Tools


en:migrage-tms

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:migrage-tms [2022/02/14 16:08]
Виталий Журавлев
en:migrage-tms [2025/03/05 14:41] (current)
Виталий Журавлев
Line 1: Line 1:
-FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// 
  
-====== Migration ​DB at TMS ======+====== Migration ​Tvip TMS between servers ​======
  
- 
-  * [[migrationdb#​sozdanie_rezervnoj_kopii_vashej_bazy_dannyj_postgresql|Creating dump your DataBase]] 
-  * [[migrationdb#​kopirovanie_rezervnoj_kopii_bazy_dannyj_postgresql|Копирование резервной копии базы данных]] 
-  * [[migrationdb#​sozdanie_bazy_dannyx|Создание базы данных]] 
-  * [[migrationdb#​sozdanie_bazy_dannyx|Восстановление резервной копии базы данных]] 
-  * [[migrationdb#​razvertyvanie_novogo_tms|Развертывание нового TMS]] 
-  * [[migrationdb#​procedury_posle_migracii|Процедуры после миграции]] 
    
  
 ===== Creating dump your DataBase ===== ===== Creating dump your DataBase =====
  
-Create dump your PostgreSQL ​Database ​with "​**pg_dump**"​ tool \\+Create dump your PostgreSQL ​database ​with "​**pg_dump**"​ tool \\
 <​code>​ <​code>​
-pg_dump -U tvip-tms tvip-tms >  /​backup/​tvip-tms.sql+pg_dump ​--no-owner --exclude-table-data=device_stat_channel ​-U tvip-tms tvip-tms ​ >  /​backup/​tvip-tms.sql
 </​code>​ </​code>​
  
-:!: If you need make dumps of others ​Databases+:!: If you need make dumps of others ​databases
 <​code>​ <​code>​
-pg_dump -U tvip-tms tvip-tms-audit >  /​backup/​tvip-tms-audit.sql +pg_dump ​--no-owner ​-U tvip-tms tvip-tms-audit >  /​backup/​tvip-tms-audit.sql 
-pg_dump -U tvip-tms tvip-tms-vod >  /​backup/​tvip-tms-vod.sql+pg_dump ​--no-owner ​-U tvip-tms tvip-tms-vod >  /​backup/​tvip-tms-vod.sql
 </​code>​ </​code>​
  
-===== Copy dump of Databases ​to new Sever TMS =====+===== Copy dump of databases ​to new TMS server ​=====
  
-Copy Dump of Database ​to new TMS Server ​with "​**scp**"​ tool.+Copy dump of database ​to new TMS server  ​with "​**scp**"​ tool.
 <​code>​ <​code>​
 scp /​backup/​tvip-tms.sql username@host:/​backup/​ scp /​backup/​tvip-tms.sql username@host:/​backup/​
Line 33: Line 25:
  
  
-===== Creatind Database ​ =====+===== Creating database ​ =====
  
 Before install TVIP TMS, you should install PostgreSQL and restore dump of Database.\\ Before install TVIP TMS, you should install PostgreSQL and restore dump of Database.\\
Line 47: Line 39:
 </​code>​ </​code>​
  
-  * Create databasetvip-tms with user: tvip-tms+  * Create ​user tvip-tms and database tvip-tms with owner tvip-tms
 <​code>​ <​code>​
-sudo -u postgres psql +su -c "createuser tvip-tms && createdb -O tvip-tms tvip-tms" postgres
-createuser tvip-tms && createdb -O tvip-tms tvip-tms+
-\q+
 </​code>​ </​code>​
  
  
-:!: If you use other databases then create them:При необходимости создайте дополнительные базы данных+:!: If you use other databases then create them:
 <​code>​ <​code>​
-sudo -u postgres psql +su -c "createdb -O tvip-tms tvip-tms-audit" postgres 
-createdb -O tvip-tms tvip-tms-audit; +su -c "createdb -O tvip-tms tvip-tms-vod" postgres
-createdb -O tvip-tms tvip-tms-vod+
-\q+
 </​code>​ </​code>​
  
-===== Restore the Dump of Database ​===== +===== Restore the dump of database ​===== 
-  * Restore the Dump of Database:+  * Change auth method to postgres: 
 +<​code>​ 
 +sed -i /​etc/​postgresql/​*/​main/​pg_hba.conf -e "​s|local ​  ​all ​            ​all ​                                    ​peer|local ​  ​all ​            ​all ​                                    ​trust|"​ 
 +sed -i /​etc/​postgresql/​*/​main/​pg_hba.conf -e "​s|host ​   all             ​all ​            ​127.0.0.1/​32 ​           md5|host ​   all             ​all ​            ​127.0.0.1/​32 ​           trust|"​ 
 +systemctl reload postgresql  
 +</​code>​ 
 +  * Restore the dump of database:
 <​code>​ <​code>​
 psql -U tvip-tms tvip-tms ​ < /​backup/​tvip-tms.sql psql -U tvip-tms tvip-tms ​ < /​backup/​tvip-tms.sql
Line 72: Line 66:
 <​code>​ <​code>​
 psql -U tvip-tms tvip-tms psql -U tvip-tms tvip-tms
-update device set authkey = ''​;+update device set authkey = null;
 \q \q
 </​code>​ </​code>​
-===== Install new TMS =====+ 
 +=====  ​Creating and restoring a MongoDB backup ===== 
 + 
 +Create a backup copy of the MongoDB database, using the utility **mongodump** 
 + 
 +<​code>​ 
 +mongodump --db images --gzip --archive > /​mongoBackup/​images.dump.gz  
 +</​code>​ 
 + 
 +Install ​the MongoDB database on the new server: 
 + 
 +<​code>​ 
 +# apt install mongodb-org 
 +# systemctl start mongod.service 
 +# systemctl enable mongod.service 
 +</​code>​ 
 + 
 +Restore a MongoDB backup, using the utility **mongorestore** 
 + 
 +<​code>​ 
 +mongorestore --gzip --archive=/​mongoBackup/​images.dump.gz ​  
 +</​code>​ 
 + 
 +:!: If you want to keep statistics, save and restore a backup for the database **content** 
 + 
 +<​code>​ 
 +mongodump --db content --gzip --archive > /​mongoBackup/​content.dump.gz  
 +mongorestore --gzip --archive=/​mongoBackup/​content.dump.gz 
 +</​code>​ 
 + 
 + 
 +===== Deploy ​new TMS =====
  
 Make sure, your server has minimal system requirements \\ Make sure, your server has minimal system requirements \\
Line 81: Line 106:
  
   * Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz   * Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
-  * Минимум ​32 GB ОЗУ +  * Minimum ​32 GB of RAM 
-  * Минимум ​500 GB (свободного места на дискедля минимум ​4000 активных и подключенных устройств.+  * Minimum ​500 GB (free disk spacefor minimum ​4000 active and online devices.
  
 <WRAP center round important 60%> <WRAP center round important 60%>
Line 97: Line 122:
 </​code>​ </​code>​
  
-===== Post migration ===== +===== Post migration ​procedure ​===== 
- +<WRAP center round important 60%> 
-  ​* ​Enable "Allow quick biding​" ​for your Provider \\+Enable "Allow quick binding​" ​option on provider settings. Quick binding option allow authorization device without ask login/​password. 
 +</​WRAP>​
   * Change ip of server or change DNS record to route clients to new TMS.\\   * Change ip of server or change DNS record to route clients to new TMS.\\
en/migrage-tms.1644844109.txt.gz · Last modified: 2022/02/14 16:08 by Виталий Журавлев