Backup & Restore

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Backup & Restore

Postby josh1856 » Thu Jun 03, 2010 10:30 am

How does one go about doing a complete backup of vici and then a restore?

I have tried directly backing up the db via mysql then importing back to an identical server again using mysql commands. It seems that the majority of settings do not import correctly (ie campaign settings, users etc) for instance the users and passwords show up in the db but the settings are all unselected.

thanks in advance.
josh1856
 
Posts: 39
Joined: Thu Mar 18, 2010 12:05 am

Postby mflorell » Thu Jun 03, 2010 10:44 am

ADMIN_backup.pl --help
mflorell
Site Admin
 
Posts: 18339
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby josh1856 » Thu Jun 03, 2010 11:33 am

[root astguiclient]# perl ADMIN_backup.pl --help
allowed run time options:
[--db-only] = only backup the database
[--db-without-logs] = do not backup the log tables in the database
[--conf-only] = only backup the asterisk conf files
[--without-db] = do not backup the database
[--without-conf] = do not backup the conf files
[--without-web] = do not backup web files
[--without-sounds] = do not backup asterisk sounds
[--without-voicemail] = do not backup asterisk voicemail
[--without-crontab] = do not backup crontab
[--ftp-transfer] = Transfer backup to FTP server
[--debugX] = super debug
[--debug] = debug
[-t] = test
[root@vici astguiclient]# perl ADMIN_backup.pl
no command line options set
mkdir: cannot create directory `/var/log/astguiclient/archive/temp': File exists
mysqldump: Got error: 1049: Unknown database 'asterisk' when selecting the database
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
You have new mail in /var/spool/mail/root
[root astguiclient]#

Two more questions...
1.) it appears to have backed up but what does mysqldump: Got error: 1049: Unknown database 'asterisk' when selecting the database mean?
2.) how do you import the data back into vici?

-thanks
jp
josh1856
 
Posts: 39
Joined: Thu Mar 18, 2010 12:05 am

Postby josh1856 » Thu Jun 03, 2010 11:45 am

Ok i figured out part of the issue asterisk DB was actually missing on this server.


[root@vici astguiclient]# perl ADMIN_backup.pl --debugx

----- DEBUG -----


----- SUPER DEBUG -----

/usr/bin/mysqldump --user=cron --password=1234 --lock-tables --flush-logs asterisk | /usr/bin/gzip > /var/log/astguiclient/archive/temp/10.0.0.254asterisk4.gz
/bin/tar cf /var/log/astguiclient/archive/temp/10.0.0.254_CONF_4.tar /etc/astguiclient.conf /etc/zaptel.conf /etc/asterisk
/bin/tar: Removing leading `/' from member names
/bin/tar cf /var/log/astguiclient/archive/temp/10.0.0.254_LINUX_4.tar /etc/my.cnf /etc/crontab_snapshot /etc/hosts /etc/rc.d/rc.local /etc/resolv.conf
/bin/tar: Removing leading `/' from member names
/bin/tar cf /var/log/astguiclient/archive/temp/10.0.0.254_WEB_4.tar /var/www/html
/bin/tar: Removing leading `/' from member names
/bin/tar cf /var/log/astguiclient/archive/temp/10.0.0.254_BIN_4.tar /var/lib/asterisk/agi-bin /usr/share/astguiclient
/bin/tar: Removing leading `/' from member names
/bin/tar cf /var/log/astguiclient/archive/temp/10.0.0.254_SOUNDS_4.tar /var/lib/asterisk/sounds
/bin/tar: Removing leading `/' from member names
/bin/tar cf /var/log/astguiclient/archive/temp/10.0.0.254_VOICEMAIL_4.tar /var/spool/asterisk/voicemail
/bin/tar: Removing leading `/' from member names
/bin/tar cf /var/log/astguiclient/archive/10.0.0.254_ALL_4.tar /var/log/astguiclient/archive/temp
/bin/tar: Removing leading `/' from member names
rm -f /var/log/astguiclient/archive/10.0.0.254_ALL_4.tar.gz
/usr/bin/gzip -9 /var/log/astguiclient/archive/10.0.0.254_ALL_4.tar
rm -fR /var/log/astguiclient/archive/temp
DONE, Exiting...
[root@vici astguiclient]#


What is the command to import back in?
josh1856
 
Posts: 39
Joined: Thu Mar 18, 2010 12:05 am

Postby gardo » Thu Jun 03, 2010 11:59 am

The restore process needs to be done manually. I don't think there's a script that does the restoration of the backup data automatically yet.
http://goautodial.com
Empowering the next generation contact centers
gardo
 
Posts: 1926
Joined: Fri Sep 15, 2006 10:24 am
Location: Manila, 1004

Postby josh1856 » Fri Jun 04, 2010 7:55 am

what is the restore process exactly?
josh1856
 
Posts: 39
Joined: Thu Mar 18, 2010 12:05 am

Postby williamconley » Fri Jun 04, 2010 8:05 pm

the reverse of the backup in most cases (if it copies file, you put the files BACK using the appropriate tar commands)

for mysql of course, instead of mysqlDUMP you would just use mysql and run the sql script that was created by the mysqldump utility.

most people don't do a FULL restore, but only a partial one and it's usually a moment when they "call in the big guns"

and most of the deep vicidial guys are command line typists ... not to mention the danger of any script in the system that would automatically overwrite your configuration and/or data. ouch.

not like freepbx where you just "pop" a dated backup over top of your data and hit apply.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby udfxrookie » Mon Aug 06, 2012 12:17 am

How do you get the data to show back in vici... all files copied back to where they were how does the data (users, phones, stats, etc.) repopulate? What commands?
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.10-452n build: 14111-0554 | Asterisk 1.8.31.0-vici | 1 AIO Setup Helping local companies startup www.AKAMarketing.net
udfxrookie
 
Posts: 178
Joined: Thu Dec 10, 2009 9:42 am
Location: Florida

Re: Backup & Restore

Postby williamconley » Mon Aug 06, 2012 9:35 am

first use mysqldump to capture your present db (just in case).
Code: Select all
mysqldump asterisk > 2012_08_06_XXXXXXXXXXX.sql
If using a password, you'll need to add "-p" and enter the pass at the prompt.

then drop the existing database and recreate it
Code: Select all
mysql -e "drop database asterisk"
mysql -e "create database asterisk"

then apply the mysql backup to it.
Code: Select all
mysql asterisk < Prior_backup_name.sql

It may be a good idea to reboot. It's definitely a good idea to tell the server to rebuild the conf files under Admin->Servers->(select your server)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby udfxrookie » Mon Aug 06, 2012 5:09 pm

Thank you so much... now previously I was using the ViciBox_Redux.x86_64-3.1.12.iso version and have installed ViciBox_Redux.x86_64-3.1.15.iso now...did I do something wrong or did the features in User Groups get taken away that enabled you to select exactly what "managers" could see? I try limiting managers to their own room's stats but now they can see everthing, looks like the feature or Modify Phone under modify user was taken too? Is there a way to get these functions back?
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.10-452n build: 14111-0554 | Asterisk 1.8.31.0-vici | 1 AIO Setup Helping local companies startup www.AKAMarketing.net
udfxrookie
 
Posts: 178
Joined: Thu Dec 10, 2009 9:42 am
Location: Florida

Re: Backup & Restore

Postby williamconley » Mon Aug 06, 2012 7:06 pm

ViciBOX version does not affect ViciDIAL version. The installer (vicibox) will install whichever version you select during installation.

More important: If you installed a version of the VICIDIAL software different than the version of your backed up database ... you must either restore the rest of your vicidial system (the web code and script code, etc) to match your DB or upgrade your DB to match the Vicidial software you just installed.

Under Admin->System settings, check your DB Schema.

Then in /usr/src/astgcuiclient/[versionChosenDuringInstall-probably trunk]/extras/upgradeXXXX.sql (based on the version you installed) ... check the last db_schema line in the file. If they do not match ... find your db schema in the file, delete everything before it and run everything after it (ie: save it to a new file with only the lines AFTER that one in it ... then execute it just like you did the restore).

Code: Select all
mysql asterisk < upgradeXXXX.sql
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby udfxrookie » Mon Aug 06, 2012 7:30 pm

I'm not worried to much about the data, we loaded a spare machine just to grab the data and stats at will, but interested in learning on the new install. So my database schema is 1193 & version 2.2.1 and i can upgrade that to vicidial 4.0 beta 2? :-)
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.10-452n build: 14111-0554 | Asterisk 1.8.31.0-vici | 1 AIO Setup Helping local companies startup www.AKAMarketing.net
udfxrookie
 
Posts: 178
Joined: Thu Dec 10, 2009 9:42 am
Location: Florida

Re: Backup & Restore

Postby williamconley » Mon Aug 06, 2012 10:08 pm

There is no 4.0 beta 2.

But there is 2.6 svn trunk.

Instructions are in the latest code downloaded. Get the code via svn here: http://wiki.vicidial.org/index.php/SVN:howto
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby udfxrookie » Tue Aug 07, 2012 10:26 pm

man ohhh man that didn't go as planned. I did the entire process for the upgrade to get my features back and there were no errors... I didn't restore the backup from
Code: Select all
/usr/share/astguiclient/ADMIN_backup.pl --debugX
and tried to login after running the 2.4 then the 2.6 and saw absolutely nothing. Now I'm extracting the backup, copying the files over... but there is a unique files 5.5.5.5asterisk2.gz that is fairly large, when I extract that file it has no extension rather just the name... is this the .sql database? when I did the backup I didn't get a .sql, just the ALL_2.tar.gz file =(
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.10-452n build: 14111-0554 | Asterisk 1.8.31.0-vici | 1 AIO Setup Helping local companies startup www.AKAMarketing.net
udfxrookie
 
Posts: 178
Joined: Thu Dec 10, 2009 9:42 am
Location: Florida

Re: Backup & Restore

Postby williamconley » Wed Aug 08, 2012 12:11 am

the sql database is compressed using gz and is inside one of the archive files.

the system backs up each "section", and compresses them all. then it combines them into a single large file. so you'll need to decompress and break up that large file into the "sections", and then decompress the asterisk segment which will have your db. if it were not compressed, it would be HUGE (multiple gigabytes quite often).

the system is designed to compress it as small as possible, then send it via FTP to another server for catastrophic restoration (ie: in case your hard drive dies or a tornado takes the building). For this transfer it is very important to have as small a file as possible and only a single backup for each day for ease of filing.

so ... untar and ungzip (tar -xvzf FILENAME) until you find your DB.

in the future, seriously consider confirming the presence and validity of any backup. never assume it'll work, TEST it. otherwise your backup is worthless.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby udfxrookie » Sun Sep 23, 2012 10:58 pm

What happens when you do the restore and everything looks great.... but no lists, they are in the database... but not in the dialer...
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.10-452n build: 14111-0554 | Asterisk 1.8.31.0-vici | 1 AIO Setup Helping local companies startup www.AKAMarketing.net
udfxrookie
 
Posts: 178
Joined: Thu Dec 10, 2009 9:42 am
Location: Florida

Re: Backup & Restore

Postby williamconley » Wed Mar 13, 2013 2:02 pm

you likely did not complete your db upgrade properly. if you skipped some sql commands or didn't run any ... your db is not in sync.

it is also possible you were using a 'non-final' version and upgraded without finalizing your existing install. so if you were in 2.4, but not the LATEST 2.4, it is entirely possible there were some mysql commands at the end of 2.4 you skipped and went straight to 2.6. this happens a lot.

of course, what also happens a lot is that clients simply don't bother upgrading the DB. gotta read the entire UPGRADE doc and understand what you are doing and remember that it was written for "pure release" users. SVN users are expected to "know what they are doing" a bit more.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby mattyou1985 » Thu Aug 04, 2016 3:01 pm

williamconley wrote:first use mysqldump to capture your present db (just in case).
Code: Select all
mysqldump asterisk > 2012_08_06_XXXXXXXXXXX.sql
If using a password, you'll need to add "-p" and enter the pass at the prompt.

then drop the existing database and recreate it
Code: Select all
mysql -e "drop database asterisk"
mysql -e "create database asterisk"

then apply the mysql backup to it.
Code: Select all
mysql asterisk < Prior_backup_name.sql

It may be a good idea to reboot. It's definitely a good idea to tell the server to rebuild the conf files under Admin->Servers->(select your server)


i had to do backup dident i well i tryed a difrent mefford from the one hear and it just got worce to say the least

but thanks to this post i was still able to recover my data using ssh and restore it to a new box now all i need to do is connect a new PBX an ime set to go

o and i had to do the upgrade command noted in a later post but still strate forward

thank you williamconley
mattyou1985
 
Posts: 111
Joined: Tue Apr 19, 2016 3:30 pm

Re: Backup & Restore

Postby donX » Fri Aug 26, 2016 3:14 am

williamconley wrote:first use mysqldump to capture your present db (just in case).
Code: Select all
mysqldump asterisk > 2012_08_06_XXXXXXXXXXX.sql
If using a password, you'll need to add "-p" and enter the pass at the prompt.

then drop the existing database and recreate it
Code: Select all
mysql -e "drop database asterisk"
mysql -e "create database asterisk"

then apply the mysql backup to it.
Code: Select all
mysql asterisk < Prior_backup_name.sql

It may be a good idea to reboot. It's definitely a good idea to tell the server to rebuild the conf files under Admin->Servers->(select your server)


After running these commands, do i need to reinstall vicibox?

Still can't figure out what seems to be happening.

Whenever I edit a Phone entry, it says record is not saved and as per
Code: Select all
trail -f /var/log/apache2/error_log
, whenever I save, here's the log result:
Code: Select all
[Fri Aug 26 17:56:56.440220 2016] [php5:error] [pid 1202] [client 10.54.9.20:52145] PHP Warning:  mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /srv/www/htdocs/vicidial/admin.php on line 30524, referer: http://10.61.5.151/vicidial/admin.php?ADD=31111111111&extension=41004&server_ip=10.61.5.151


As per williamconley, database version matters, since there might be some commands that was missed.
My source sqldump's database version is 10.0.22 and restored it to a 10.1.6 version, I think that's where all hell broke loose.
Another question, is it safe to to create a new SQLDUMP of the 10.0.22 version update it to the latest then restore the same backup? I fear it will cause another issue the same way as the other database i previously restored it's dumpfile to.

Please help!
donX
 
Posts: 50
Joined: Tue May 17, 2016 8:38 am

Re: Backup & Restore

Postby mattyou1985 » Mon Aug 29, 2016 6:53 am

mysqldump asterisk > 2012_08_06_XXXXXXXXXXX.sql << maks a file located @ /root to get to this you need winSCP to acces the file system once in the first location you land at is the /root

then you coppy that file to your pc then connect to a brand new vici box and coppy 2012_08_06_XXXXXXXXXXX.sql (the filenameyou called it) to the /root of the new vicibox

then run putty and run
mysql -e "drop database asterisk"
mysql -e "create database asterisk"

mysql asterisk < 2012_08_06_XXXXXXXXXXX.sql (the file name you called it)

then reboot and login with old vicibox login info

then make your way to System Settings

and look for DB Schema Version: DB Schema mismatch or rong ither way it will say it in red text if thats hapend youll need to do this

williamconley wrote:ViciBOX version does not affect ViciDIAL version. The installer (vicibox) will install whichever version you select during installation.

More important: If you installed a version of the VICIDIAL software different than the version of your backed up database ... you must either restore the rest of your vicidial system (the web code and script code, etc) to match your DB or upgrade your DB to match the Vicidial software you just installed.

Under Admin->System settings, check your DB Schema.

Then in /usr/src/astgcuiclient/[versionChosenDuringInstall-probably trunk]/extras/upgradeXXXX.sql (based on the version you installed) ... check the last db_schema line in the file. If they do not match ... find your db schema in the file, delete everything before it and run everything after it (ie: save it to a new file with only the lines AFTER that one in it ... then execute it just like you did the restore).

Code: Select all
mysql asterisk < upgradeXXXX.sql



and note dowing from 1 current version to another is much eazer than trying to upgrade afer or enen downgrade

hope it helps
mattyou1985
 
Posts: 111
Joined: Tue Apr 19, 2016 3:30 pm

Re: Backup & Restore

Postby mattyou1985 » Tue Aug 30, 2016 8:39 am

williamconley wrote:ViciBOX version does not affect ViciDIAL version. The installer (vicibox) will install whichever version you select during installation.

More important: If you installed a version of the VICIDIAL software different than the version of your backed up database ... you must either restore the rest of your vicidial system (the web code and script code, etc) to match your DB or upgrade your DB to match the Vicidial software you just installed.

Under Admin->System settings, check your DB Schema.

Then in /usr/src/astgcuiclient/[versionChosenDuringInstall-probably trunk]/extras/upgradeXXXX.sql (based on the version you installed) ... check the last db_schema line in the file. If they do not match ... find your db schema in the file, delete everything before it and run everything after it (ie: save it to a new file with only the lines AFTER that one in it ... then execute it just like you did the restore).

Code: Select all
mysql asterisk < upgradeXXXX.sql



just thort ide re explain this

1. Check system_settings, make sure you are at DB Schema Version 1403 or higher
If not, run the instructions for 2.9 to 2.11 before this section.

2. upgrade the MySQL asterisk database(you have two options):
A. Running the upgrade file directly from Linux:
mysql -f --database=asterisk < /usr/src/astguiclient/trunk/extras/upgrade_2.12.sql

B. Going into mysql and executing the upgrade sql file:
mysql
use asterisk
\. /usr/src/astguiclient/trunk/extras/upgrade_2.12.sql
quit


hope this helps
mattyou1985
 
Posts: 111
Joined: Tue Apr 19, 2016 3:30 pm

Re: Backup & Restore

Postby williamconley » Fri Sep 02, 2016 10:29 pm

mattyou1985 wrote:hope this helps

Every bit helps. Even if all you are really doing is storing this for your own personal use "next time" so you can't forget it. LOL It will STILL help someone who may be floundering next week and save them some hair pulling. Keep it up. You might even get a thank you from someone who uses it. 8-)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby donX » Mon Sep 05, 2016 8:26 pm

williamconley wrote:
mattyou1985 wrote:hope this helps

Every bit helps. Even if all you are really doing is storing this for your own personal use "next time" so you can't forget it. LOL It will STILL help someone who may be floundering next week and save them some hair pulling. Keep it up. You might even get a thank you from someone who uses it. 8-)


LOL! Thanks williamconley. This really helped!

1 last question, is it safe to update the current sql version of my old dialer so it wont mess up the new db once i do a restore?
donX
 
Posts: 50
Joined: Tue May 17, 2016 8:38 am

Re: Backup & Restore

Postby williamconley » Mon Sep 05, 2016 9:33 pm

donX wrote:... is it safe to update the current sql version of my old dialer so it wont mess up the new db once i do a restore?

Um ... No? You can't JUST change the sql version ... you have to upgrade the old dialer completely. Modifying the Vicidial code OR the Vicidial database without modifying the other would cause them to NOT match. And that would break it.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Backup & Restore

Postby coolboyabhash » Tue Sep 05, 2017 9:39 am

Is There any video to show how to backup dump file and restore to another computer ( I mean server )
if you have any videos please share wid me i am very thankful of you.
coolboyabhash
 
Posts: 6
Joined: Fri Aug 18, 2017 5:33 pm
Location: NEW DELHI, INDIA

Re: Backup & Restore

Postby williamconley » Tue Sep 05, 2017 10:27 am

This may help. Although you *may* have to click on "video" to get Only Videos.

http://bfy.tw/DkuD
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20019
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Support

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 119 guests