====== How to Migrate AsterCC System ======
===== First:Install AsterCC on New Server =====
Refer to: [[en:download_and_install:installation|AsterCC Installation]]
Note:The **version** and **modules** of new AsterCC must be exactly same as the old one,so you should install the modules correspondingly after installed the system.
===== Second:Obtain New Authorization =====
On the new server,execute command below,then download the identity via clicking "Download Identity" button on [Realtime]->[System Messages]:
/opt/asterisk/scripts/astercc/asterccc --RNI
Then,download the identity of old server without executing command,and send both two identities to Email:support@astercc.org or support@sonicwell.com,explain the situation of your demands.Several minutes later,technical support specialist will reply to you.
{{:en:faq:download_identity_01.png?750|}}
===== Third:Backup/Recover Database =====
For example:We migrate asterCC system from 192.168.1.175 to 192.168.1.146
==== Database Backup ====
Open the menu on the left,click [System]->[Backup Plans]->[Add Backupplan],you will enter plan adding page,as follows:
**Planname**:to identify the backup plan.
**Kept days**:It used to set the retaining duration of the backup file,you can set it according to disk's usage.
{{:en:faq:backup_plans_1.png?750|}}
And in [Advanced],double-click the items which need to backup,there are 10 items in total. Set the "DB Details" refer to following format,or refer to:[[en:module_manual:system:backup_plans|Backup Plans]]
{{:en:faq:backup_plans_2.png?750|}}
After you finished backup,you can "Edit" or "Delete" the plan which has been added on this page.
{{:en:faq:backup_plans_3.png?750|}}
=== Backup the Database on Background ===
First,log in server via ssh:
ssh root@192.168.1.146
Then enter /var/lib/mysql directory,you can find a database file named "astercc10"
cd /var/lib/mysql && ls
Execute command below,start the backup of database after inputing password:
mysqldump -uroot -p astercc10 > astercc20150302.sql
Exception:
1.You should add "-h127.0.0.1" if " ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' " when you login msyql,eg:
mysqldump -h127.0.0.1 -uroot -pastercc astercc10 > astercc20150302.sql
{{:zh:常见问题及解答:本机服务器dns系统有问题.png?750|}}
2.If there is "bash:cd:/var/lib/mysql/:Permission denied" when you execute "cd /var/lib/mysql",you can check and change privilege of mysql:
ll |grep mysql
sudo chmod 755 mysql
{{:zh:常见问题及解答:权限不够修改权限.png?750|}}
==== Database Recovery ====
Log in 192.168.1.175,you can find the backup file named "BF" under /tmp/backup directory:
ssh dev03@192.168.1.175
cd /tmp/backup && ls
{{:zh:常见问题及解答:备份文件1_1_1.png?900|}}
and copy it to / directory on 192.168.1.146 server,execute command below on 192.168.1.175:
scp -r BF.19.2015-02-28-16-08 root@192.168.1.146:/
It it finished until progress rate turn to 100% on the right,as is shown below:
{{:zh:常见问题及解答:备份文件1_1_2.png?545|}}{{:zh:常见问题及解答:备份文件1_1_3.png?240|}}
If it appears warnings as following,you can delete the corresponding contents under ~/.ssh/known_hosts directory.
vim ~/.ssh/known_hosts
Or execute commands below:
ssh-keygen -f "/home/dev03/.ssh/known_hosts" -R 192.168.1.146
{{:zh:常见问题及解答:warning01.png?850|}}
Login 192.168.1.146 server:
ssh root@192.168.1.146
and decompress the .tar.gz archive via executing commands below:
tar -xzvf archive_name.tar.gz
Import the bakckup file of database:
mysql -u root -p astercc10 < archive_name.sql
**Note**:The default archive name is "astercc10". At last,input the password of root in mysql. You can see the information of mysql in /etc/astercc.conf. The "astercc10" is the database name on the new server,archive_name.sql unzip from backup file.
{{:zh:常见问题及解答:备份文件1_1_5.png?850|}}
If the database on the old server use non-default information,we should revise the database information of new server,as follows:
1.Information in /etc/astercc.conf->[database],eg:dbname,password,etc
vim /opt/asterisk/scripts/astercc/astercc.conf
2.Information in /etc/astercc.conf->[statistics],eg:dbname,password,etc
vim /opt/asterisk/scripts/astercc/astercc.conf
3.At the end of /var/www/html/asterCC/app/config/database.php->[class DATABASE_CONFIG]-> [var $default = array],password,database,prefix,etc
vim /var/www/html/asterCC/app/config/database.php
===== Fourth:Copy(or Overwrite) the Config Files of System =====
We selected many system file when backup,the list in [System]->[Backup Plans]->[Add Backupplan]->[Advanced]->[Backupfile]
{{:en:faq:backup_plans_2.png?750|}}
You can see the backup file of system config files (marked by yellow rectangle),we can unzip the .tar package execute below commands:
{{:zh:常见问题及解答:备份的配置文件.png?850|}}
Decompress commands:
tar -xzvf XXXXX.tar.gz
Decompress all archive,then copy(or mv) all files and directories under original location correspondingly, i.e.:
\cp -rpf /BF.19.2015-02-28-16-08/etc/* /etc
\cp -rpf /BF.19.2015-02-28-16-08/var/* /var
\cp -rpf /BF.19.2015-02-28-16-08/opt/* /opt
\cp -rpf /BF.19.2015-02-28-16-08/usr/* /usr
Note:When use "\cp" (not cp) command to copy(or overwrite),there is no any overwrite information. -r:not only copy files,but also directories. -f:force
{{:zh:常见问题及解答:备份文件1_1_6.png?850|}}
=== Copy(or Overwrite) the Config Files of System on Background ===
First,login the 192.168.1.175 server,you can see the backup files under [System]->[Backup Plans]->[Add Backupplan]->[Advanced]->[Backupfile] directory.
scp -rp /var/lib/asterisk/* root@192.168.1.146:/var/lib/asterisk ,(then input the password of user)
scp -rp /var/spool/asterisk/voicemail/* root@192.168.1.146:/var/spool/asterisk/voicemail
scp -rp /var/spool/asterisk/monitor/* root@192.168.1.146:/var/spool/asterisk/monitor
scp -rp /usr/lib/asterisk/* root@192.168.1.146:/usr/lib/asterisk
scp -rp /etc/asterisk/* root@192.168.1.146:/etc/asterisk
scp -rp /etc/dahdi/* root@192.168.1.146:/etc/dahdi
scp -rp /opt/asterisk/scripts/astercc/* root@192.168.1.146:/opt/asterisk/scripts/astercc
scp -rp /var/www/html/asterCC/* root@192.168.1.146:/var/www/html/asterCC
scp -rp /var/lib/sounds/* root@192.168.1.146:/var/lib/sounds
===== Fifth:Reload System =====
After importing database backup and replacing the corresponding files,we need reload system via execute scripts named "reloadconf.sh" under /opt/asterisk/scripts/astercc/ directory:
cd /opt/asterisk/scripts/astercc/
./reloadconf.sh
{{:zh:常见问题及解答:系统重载1.png?850|}}
===== Solution for FAQ =====
If it displays "Permission denied!" after click reloading tip when finished migration of asterCC,you should try execute command below:
chmod 777 /var/www/html/asterCC/cake/console/cake
then restart the asterccd service,you should execute command below if it still "Permission denied!":
chown -R asterisk.asterisk /var/www/html/asterCC/
chown -R asterisk.asterisk /etc/asterisk