В версии AVReg появились консольные утилиты
avreg-backup(8)
и avreg-restore(8)
.
См. также man avreg-backup
$ avreg-backup --help Usage: sudo avreg-backup [OPTIONS] [OUTPUT_(DIR|TARGZ_FILE_PATH)] Options: database access options: -T, --db-type=SQLTYPE SQL server type: "mysql" or "pgsql", default "mysql". -H, --db-host=HOST SQL server hostname, default <empty>(=local). -N, --db-name=DBNAME Database name, default "avreg6_db" -U, --db-user=USER Database user name, default <empty>. -P, --db-passwd=PASSWORD Database user password, default <empty>. data options: -I, --include-tables=LIST List of tables to backup, default: "cameras,users,web_layouts,local_layouts" -E, --exclude-tables=LIST List of excluded of tables to backup --exclude-profiles Exclude /etc/avreg/profiles/* avregd sub-config files. common options: -c, --conf=PATH Path of config file, default "/etc/avreg/avreg.conf". -L, --lock-tables Lock tables. --stop-avreg Stop avreg-sevice if "EVENTS" table is selected. --start-avreg Start avreg-sevice if stopped above. -q, --quiet Be quiet. -h, --help Print usage help and exit. -V, --version Print version and exit. Examples: sudo avreg-backup --include-tables=events local full backup with EVENTS table data sudo avreg-backup -T pgsql -H 1.2.3.4 -U sqlrootuser -P sqlpassword --exclude-profiles remote backup, only conf tables, PostgreSQL server on 1.2.3.4 host
См. также man avreg-restore
$ avreg-restore --help Usage: sudo avreg-restore [OPTIONS] BACKUP_ARCHIVE_ARG Options: database access options: -T, --db-type=SQLTYPE SQL server type: "mysql" or "pgsql", default "mysql". -H, --db-host=HOST SQL server hostname, default <empty>(=local). -N, --db-name=DBNAME Database name, default "avreg6_db" -U, --db-user=USER Database user name, default <empty>. -P, --db-passwd=PASSWORD Database user password, default <empty>. data options: -E, --skip-tables=LIST List of excluded of tables to backup --skip-profiles Exclude /etc/avreg/profiles/* avregd sub-config files. --skip-varlib Do not restore /var/lib/avreg. --skip-all Do not restore any tables, files and profiles. --remove-archive Truncate "events,tree_events" tables and remove all media files into $storage-dir. -f, --force Ignore src/target avreg-common version mismatch. common options: -c, --conf=PATH Path of config file, default "/etc/avreg/avreg.conf". -L, --lock-tables Lock tables. --drop-database Drop target database and sql-users before restoring data. --upgrade-conf Upgrade avreg.conf with new target db-* values. --upgrade-avreg-server Do apt install avreg-server-{DBNAME}. -M, --migrate As --upgrade-conf --upgrade-avreg-server both. -q, --quiet Be quiet. -h, --help Print usage help and exit. -V, --version Print version and exit. Examples: sudo avreg-restore local full backup with EVENTS table data sudo avreg-restore -T pgsql -H 1.2.3.4 -U sqlrootuser -P sqlpassword --exclude-profiles remote backup, only conf tables, PostgreSQL server on 1.2.3.4 host
aveg-common
/etc/avreg/avreg.conf /etc/avreg/avreg-unlink.secret /etc/avreg/avreg-www.secret /etc/avreg/avregd.secret /etc/avreg/avreg-monitor.secret /etc/avreg/avregTRIALKEY-v5
avegd
/etc/avreg/profiles/* /etc/avreg/avreg.conf /etc/default/avregd
aveg-unlink
/etc/cron.d/avreg-unlink
aveg-site
/etc/avreg/site-apache2-user.conf /etc/sudoers /etc/hosts (возможно)
Таблица «user» системной базы mysql содержит имена/пароли/привилегии пользователей-приложений AVReg.
user@host: ~ % mysql -u root mysql mysql> SELECT Host,User FROM user WHERE User LIKE 'avreg%'; +-----------------------+-----------------+ | Host | User | +-----------------------+-----------------+ | % | avreg_wiki_user | | localhost | avreg-monitor | | localhost | avreg-unlink | | localhost | avreg-www | | localhost | avregd | +-----------------------+-----------------+ 7 rows in set (0.00 sec)
Рабочая база данных «avreg5_db» содержит 4 таблицы:
user@host: ~ % mysqlshow -u root avreg6_db Database: avreg6_db +---------------+ | CAMERAS | | EVENTS | | LOCAL_LAYOUTS | | TREE_EVENTS | | USERS | | WEB_LAYOUTS | +---------------+
backup
$ sudo mysqldump \ --defaults-extra-file=/etc/mysql/debian.cnf \ avreg6_db \ CAMERAS USERS LOCAL_LAYOUTS WEB_LAYOUTS \ > /tmp/avreg6_backup.sql
restore
$ sudo mysql --defaults-extra-file=/etc/mysql/debian.cnf \ avreg6_db < /tmp/avreg6_backup.sql