This is an old revision of the document!


How to Migrate AsterCC System

First:Install AsterCC on New Server

Refer to: 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.

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.

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:Backup Plans

备份完成后,在[添加备份计划]页面,会出现刚才备份的信息,可以对其进行[编辑]和[删除]操作

用代码实现数据库的备份

首先登录服务器:

 ssh root@192.168.1.146 
然后再到mysql目录下,ls一下可以看到有个名叫“astercc10”的目录,这就是数据库。 转到mysql目录的命令:
 cd /var/lib/mysql 
再执行数据库备份命令:
 mysqldump -uroot -p astercc10 > astercc20150302.sql 
最后输入数据库密码,即可进行数据库备份。 假若不想单独输入密码,直接将密码放到备份命令里,可执行备份命令:
 mysqldump -uroot -pastercc astercc10 > astercc20150302.sql 

说明:

1.在登录自己本机服务器的数据库时,假如出现 “ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' ”,则需要加上 -h127.0.0.1,即:

 mysqldump -h127.0.0.1 -uroot -pastercc astercc10 > astercc20150302.sql 

2.假如在 cd /var/lib/mysql 时权限不够可以修改权限:

 sudo chmod 755 mysql 
查看具体有哪些权限:
 ll |grep mysql 

3.在 mysqldump -h127.0.0.1 -u root -p astercc10 > astercc20150302.sql 数据备份命令中,astercc10:是数据库的名字,astercc20150302.sql:是数据库备份文件

数据库恢复

登录175服务器,在 /tmp/backup 下找到刚才备份的文件:BF。命令:

 ssh dev03@192.168.1.175 
然后再转到backup目录下
 cd /tmp/backup 
然后 ls 一下即可查看到备份好的文件最下面绿框中的即是。

并将其复制到新的服务器146上的根目录(/)下面,命令:

 scp -r BF.19.2015-02-28-16-08 root@192.168.1.146:/ 
输入146服务器的密码,待右侧全为100%了,也就复制完毕了。

假如出现warning,如下图。需要执行命令,并删除里面相应信息,输入YES即可。

 vim ~/.ssh/known_hosts 
或者执行下面红框里的内容,如: ssh-keygen -f “/home/dev03/.ssh/known_hosts” -R 192.168.1.146

登录146服务器:

 ssh root@192.168.1.146
再找到刚才复制的备份文件并将其解压缩,其中对于.tar.gz类文件解压,命令如下,其中XXXX是压缩文件的名:
 tar -xzvf XXXX.tar.gz 
然后将解压出来的数据库备份文件 导入数据库:
 mysql -u root -p astercc10 < XXXX.sql
此处XXXX为:astercc10,如下图。最后输入新服务器数据库的密码,默认的是:astercc。其中astercc10是146新服务器上的数据库名字,astercc10.sql是解压出来的数据库备份文件,这样一来,数据库就被迁移导入了。

到这一步,还没有完全结束,假如老服务器数据库没使用默认的数据库信息,则 需要对新服务器配置文件进行3处手动修改:

1.对astercc.conf→[database]中的相应信息进行修改,比如:dbname、password等等

 vim /opt/asterisk/scripts/astercc/astercc.conf 

2.对astercc.conf→[statistics]中的相应信息进行修改,比如:dbname、password等等

 vim /opt/asterisk/scripts/astercc/astercc.conf 

3.对database.php 最后面的 class DATABASE_CONFIG 中 default下的password、database等进行修改

 vim /var/www/html/asterCC/app/config/database.php 

Fourth:复制(覆盖)系统配置文件

首先,我们在备份时选择了很多系统文件,即在[系统设置]→[备份计划管理]→[添加/编辑 备份计划]→[高级资料]→[备份内容]

备份好的系统配置文件是可以查看到的(黄框内的文件),我们将其解压(以 “_etc_” 开头的压缩包为例):

解压命令:

 tar -xzvf XXXXX.tar.gz 
将三条记录都解压,会出现一个叫 etc 的文件夹,解压完后有四个文件夹,将其四个及其目录下的所有文件夹、文件复制到新的服务器“相应”位置, 即:
\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 

需要说明的是:\cp是在复制时,不提示覆盖信息用的,-r是有关目录的操作,-p是除复制源文件的内容外,还将把其修改时间和访问权限也复制到新文件中,-f是强行操作 慎重使用。

用代码实现即时性系统配置文件的转移(覆盖)

首先登录登录原来服务器(192.168.1.175),找到[系统设置]→[备份计划管理]→[添加/编辑 备份计划]→[高级资料]→[备份内容]下备份的文件及目录。

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 

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 

en/faq/how_to_migrate_astercc_system.1449298570.txt.gz · Last modified: (external edit)
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki