Difference between revisions of "How to backup settings of users in GUI"
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
\`Tables_in_${mydb}\` LIKE 'livepacket%' OR \ | \`Tables_in_${mydb}\` LIKE 'livepacket%' OR \ | ||
\`Tables_in_${mydb}\` LIKE 'register%' OR \ | \`Tables_in_${mydb}\` LIKE 'register%' OR \ | ||
+ | \`Tables_in_${mydb}\` LIKE 'tracker_%' OR \ | ||
\`Tables_in_${mydb}\` LIKE 'cache_number_location' OR \ | \`Tables_in_${mydb}\` LIKE 'cache_number_location' OR \ | ||
\`Tables_in_${mydb}\` LIKE 'contenttype' OR \ | \`Tables_in_${mydb}\` LIKE 'contenttype' OR \ | ||
Line 24: | Line 25: | ||
\`Tables_in_${mydb}\` LIKE 'system' \ | \`Tables_in_${mydb}\` LIKE 'system' \ | ||
"| sed -e "s/^/--ignore-table=${mydb}./" |xargs mysqldump -c --skip-triggers --skip-add-locks --skip-disable-keys --skip-add-drop-table --no-create-info --${mydb} > /tmp/settings.sql | "| sed -e "s/^/--ignore-table=${mydb}./" |xargs mysqldump -c --skip-triggers --skip-add-locks --skip-disable-keys --skip-add-drop-table --no-create-info --${mydb} > /tmp/settings.sql | ||
+ | |||
+ | Because structure of `users` table varies, dump this table with create statements too: | ||
+ | mysqldump voipmonitor users > /tmp/users.sql | ||
== Another way == | == Another way == |
Revision as of 15:02, 30 November 2015
Backup
Recommended way
Run in bash following command to dump only configuration (users/alerts etc. - does not includes CDRs,registers,messages)
mydb='voipmonitor'; mysql ${mydb} -Ne "show tables from voipmonitor where \ \`Tables_in_${mydb}\` LIKE 'alerts_%' OR \ \`Tables_in_${mydb}\` LIKE 'audit_log' OR \ \`Tables_in_${mydb}\` LIKE 'cdr%' AND \ \`Tables_in_${mydb}\` NOT LIKE 'cdr_custom_headers' OR \ \`Tables_in_${mydb}\` LIKE '%country%' OR \ \`Tables_in_${mydb}\` LIKE 'daily_reports_%' OR \ \`Tables_in_${mydb}\` LIKE 'geoip%' OR \ \`Tables_in_${mydb}\` LIKE 'livepacket%' OR \ \`Tables_in_${mydb}\` LIKE 'register%' OR \ \`Tables_in_${mydb}\` LIKE 'tracker_%' OR \ \`Tables_in_${mydb}\` LIKE 'cache_number_location' OR \ \`Tables_in_${mydb}\` LIKE 'contenttype' OR \ \`Tables_in_${mydb}\` LIKE 'files' OR \ \`Tables_in_${mydb}\` LIKE 'fraud_alert_info' OR \ \`Tables_in_${mydb}\` LIKE 'hostname_cache' OR \ \`Tables_in_${mydb}\` LIKE 'message' OR \ \`Tables_in_${mydb}\` LIKE 'rtp_stat' OR \ \`Tables_in_${mydb}\` LIKE 'system' \ "| sed -e "s/^/--ignore-table=${mydb}./" |xargs mysqldump -c --skip-triggers --skip-add-locks --skip-disable-keys --skip-add-drop-table --no-create-info --${mydb} > /tmp/settings.sql
Because structure of `users` table varies, dump this table with create statements too:
mysqldump voipmonitor users > /tmp/users.sql
Another way
Not recommended but can be useful other way to backup GUI settings
Restore
If you wish to restore dumpfile, start with a new db:
mysqladmin create voipmonitor
Let your latest sensor create tables needed for voipmonitor service:
/etc/init.d/voipmonitor restart
Let your GUI create tables needed for GUI, Just login to web GUI with your browser (If you are already logged in, logout first and then 're-login'. (default login is admin / admin)
http://voipmonitor_IP
Remove data from tables that was auto-added in time of creation. (because these data are customizable and was dumped).
mysql voipmonitor -e "SET FOREIGN_KEY_CHECKS = 0; TRUNCATE table tracker_category; TRUNCATE table tracker_priority; TRUNCATE table tracker_status; SET FOREIGN_KEY_CHECKS = 1;"
Restore settings
mysql voipmonitor < /tmp/settings.sql