Backup and migration Tvip TMS to another server

Creating a backup of PostgreSQL database

You can backup the database using the pg_dump utility:

pg_dump --no-owner  -U tvip-tms tvip-tms  >  /backup/tvip-tms.sql

Hint

With the --exclude-table-data parameter, you can exclude tables that do not require backup to reduce the backup file size and speed up the recovery process:

pg_dump --no-owner --exclude-table-data=device_stat_channel -U tvip-tms tvip-tms  >  /backup/tvip-tms.sql

Backup additional databases if necessary:

pg_dump --no-owner -U tvip-tms tvip-tms-audit >  /backup/tvip-tms-audit.sql
pg_dump --no-owner -U tvip-tms tvip-tms-vod >  /backup/tvip-tms-vod.sql

Copy the database backup using the scp utility:

scp /backup/tvip-tms.sql username@host:/backup/

Recovery from a PostgreSQL Database Backup

Ensure that the system meets the minimum TVIP TMS requirements.

Before installing TVIP TMS, you must install the database and restore the data from a backup.

Set and check that the locale selected is: [*] en_US.UTF-8 UTF-8. If necessary, add the locales you need.

sudo apt -y install postgresql

Create a database with the name tvip-tms and the user tvip-tms:

su -c "createuser tvip-tms && createdb -O tvip-tms tvip-tms" postgres

If necessary, create additional databases:

su -c "createdb -O tvip-tms tvip-tms-audit" postgres
su -c "createdb -O tvip-tms tvip-tms-vod" postgres

Change the postgres access settings:

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|"
sed -i /etc/postgresql/*/main/pg_hba.conf -e "s|host    all             all             127.0.0.1/32            scram-sha-256|host    all             all             127.0.0.1/32            trust|"
systemctl reload postgresql

Recovery the database backup:

psql -U tvip-tms tvip-tms  < /backup/tvip-tms.sql

If necessary, restore additional databases as well:

psql -U tvip-tms tvip-tms-vod  < /backup/tvip-tms-vod.sql
psql -U tvip-tms tvip-tms-audit  < /backup/tvip-tms-audit.sql

Reset the value for auth key:

psql -U tvip-tms tvip-tms
update device set authkey = null;
\q

Set TVIP TMS.

Attention

To migrate devices without requiring a login and password, enable the Allow Quick Binding option in the provider settings.

If necessary, change the ip address of your TVIP TMS server or redirect DNS to a new TVIP TMS server.

Creating and restoring a MongoDB backup

Warning

Creating a backup copy of MongoDB database is mandatory if you need to migrate or create a backup copy of VOD database. Otherwise images associated with VOD database content (movie posters, screenshots of episodes, etc.) will be missing in the system after import.

Create a backup of the MongoDB database, using the mongodump utility:

mongodump --db images --gzip --archive > /mongoBackup/images.dump.gz

Install the MongoDB database on the new server:

apt install mongodb-org
systemctl start mongod.service
systemctl enable mongod.service

Restore the MongoDB backup, using the mongorestore utility:

mongorestore --gzip --archive=/mongoBackup/images.dump.gz

Note

If you need to save the statistics, save and restore a backup for the content database:

mongodump --db content --gzip --archive > /mongoBackup/content.dump.gz
mongorestore --gzip --archive=/mongoBackup/content.dump.gz