This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:migrage-tms [2022/03/14 14:11] Денис Цыганов [Creating Database] |
en:migrage-tms [2025/03/05 14:41] (current) Виталий Журавлев |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Migration DB at TMS ====== | + | ====== Migration Tvip TMS between servers ====== |
Line 51: | Line 51: | ||
</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 60: | 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> | ||
+ | |||
+ | ===== 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 ===== | ===== Deploy new TMS ===== | ||
Line 86: | Line 123: | ||
===== Post migration procedure ===== | ===== 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.\\ |