| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| en:faq:how_to_configure_multiple_servers [2016/11/08 03:26] – solo | en:faq:how_to_configure_multiple_servers [2016/11/09 05:53] (current) – solo |
|---|
| <code> mysqldump -uroot -pyour_password astercc10 > astercc_backup.sql </code> | <code> mysqldump -uroot -pyour_password astercc10 > astercc_backup.sql </code> |
| |
| 再在新的mysql数据库服务器(192.168.1.60)上进行备份数据的导入。 | Copy the sql file to your MySQL(192.168.1.60) sever and do import: |
| <code> mysql -uroot -p密码 astercc10 < 备份文件.sql </code> | <code> mysql -uroot -pyour_passwordastercc10 < astercc_backup.sql </code> |
| |
| |
| 2.在MySQL机器上,对CTI、PHP1、PHP2机器进行数据库的授权。 | 2.set privileges on your MySQL server, to make sure you have mysql access on CTI and PHP servers |
| 在 mysql> 下执行如下命令: | Run the following commond on your mysql server |
| | mysql> |
| <code> grant all privileges on astercc10.* to astercc@'192.168.1.%' identified by 'asterccpw'; </code> | <code> grant all privileges on astercc10.* to astercc@'192.168.1.%' identified by 'asterccpw'; </code> |
| |
| | Now you are supposed to have mysql access from 192.168.1.* |
| |
| 3.分别在CTI、PHP1、PHP2三台机器上的/etc/astercc.conf 中,修改:[database]和[statistics]标签下的数据库信息: | 3.update /etc/astercc.conf on the CTI,PHP1,PHP2 servers, section [database] and [statistics]: |
| <code> | <code> |
| [database] | [database] |
| </code> | </code> |
| |
| <note> 注:该conf文件中system的标签下,做什么集群,就将该处修改成什么。 </note> | <note> For cluster option under system, choose what kind of cluster config you want to use</note> |
| |
| |
| 4.在/var/www/html/asterCC/app/config/database.php文件中将文件末尾的 var $default = array数据库信息修改成如下内容: | 4.update php database config /var/www/html/asterCC/app/config/database.php on your php servers |
| |
| class DATABASE_CONFIG { | class DATABASE_CONFIG { |
| ); | ); |
| |
| <note> 注:$test 的内容无需修改。 </note> | <note> You don't need to update $test</note> |
| |
| |
| 5.配置iptables服务,各机器配置完成后执行:service iptables restart | 5.Update firewall config file: /etc/sysconfig/iptables, then do service iptables restart |
| |
| CTI(和Nginx)机器上: | On CTI(Nginx): |
| <code> | <code> |
| *filter | *filter |
| |
| |
| MySQL机器上: | On MySQL: |
| <code> | <code> |
| *filter | *filter |
| |
| |
| PHP1机器上: | On PHP1: |
| <code> | <code> |
| *filter | *filter |
| |
| |
| PHP2机器上: | On PHP2: |
| 同PHP1 | same as PHP1 |
| |
| <note tip><code> | <note tip><code> |
| 端口说明:请按实际情况,对/etc/sysconfig/iptables文件中端口进行保留。 | Port usage: please open correct port on /etc/sysconfig/iptables |
| 21:FTP默认端口 | 21:FTP |
| 22:SSH默认端口 | 22:SSH |
| 80:http默认端口,由于我的机器改成8081了,所以CTI的iptables添加了8081 | 80:http, if you changed http port in nginx, please make sure you set this properly |
| 123:NTP默认端口 | 123:NTP |
| 137:udp samba的端口 | 137:udp samba |
| 138:udp samba的端口 | 138:udp samba |
| 139:tcp samba的端口 | 139:tcp samba |
| 389:tcp samba的端口 | 389:tcp samba |
| 445:tcp samba的端口 | 445:tcp samba |
| 901:tcp samba的端口 | 901:tcp samba |
| 161:SNMP的端口 | 161:SNMP的 |
| 162:SNMP-trap的端口 | 162:SNMP-trap |
| 443:https默认端口 | 443:https |
| 2727:MGCP默认端口 | 2727:MGCP |
| 3306:mysql默认端口 | 3306:mysql |
| 4569:IAX2默认端口 | 4569:IAX2 |
| 5036:IAX1默认端口 | 5036:IAX1 |
| 5038:Asterisk默认端口 | 5038:Asterisk AMI |
| 5060:sip默认端口 | 5060:sip |
| 9000:php默认端口 | 9000:php fpm |
| 10000:20000:Asterisk中RTP要使用的端口 | 10000:20000:Asterisk rtp |
| </code></note> | </code></note> |
| |
| |
| 6.在CTI、PHP1上安装samba服务,执行命令: | 6.Install samba on your CTI and php servers |
| <code> yum install samba </code> | <code> yum install samba </code> |
| |
| |
| 7.安装完成后,分别创建samba用户及密码,如:sbu/123456, | 7.Configure samba username and password, such as: sbu/123456, |
| 先执行: | first: |
| <code> useradd sbu </code> | <code> useradd sbu </code> |
| 再执行,并在提示时输入123456: | then, enter password when it prompts: |
| <code> smbpasswd -a sbu </code> | <code> smbpasswd -a sbu </code> |
| |
| 8.修改samba配置文件 /etc/samba/smb.conf,在smb.conf 文件末尾添加如下内容: | 8.Update samba configure file /etc/samba/smb.conf, append the following lines: |
| |
| CTI机器上: | on CTI server: |
| <code> | <code> |
| [ccastspool] | [ccastspool] |
| </code> | </code> |
| |
| PHP1机器上: | on PHP1 server: |
| <code> | <code> |
| [ccdata] | [ccdata] |
| |
| |
| 9.配置完成后,重启Samba 服务配置生效,执行命令: | 9. restart sambe, execute: |
| <code> service smb restart </code> | <code> service smb restart </code> |
| |
| 10.将samba的文件,相互挂载。(注:挂载之前,请先将本机要mount过来的代码进行备份。比如:在CTI机器上,需要mount PHP1机器上的ccdata 到CTI机器的 /var/www/html/asterCC/data 目录,那么需要在CTI机器上,将/var/www/html/asterCC/data 进行备份,备份过程此处不做详细讲述) | 10. Mount files. (Please do backup first before you mount, let's say you are going to mount ccdata to /var/www/html/asterCC/data, backup your /var/www/html/asterCC/data first) |
| |
| | on CTI server, execute: |
| CTI机器上,依次执行命令,进行挂载: | |
| <code> | <code> |
| mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdate /var/www/html/asterCC/data | mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdate /var/www/html/asterCC/data |
| </code> | </code> |
| |
| PHP1机器上,依次执行命令,进行挂载: | on PHP1, execute: |
| <code> | <code> |
| mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk | mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk |
| </code> | </code> |
| |
| PHP2机器上,依次执行命令,进行挂载: | on PHP2, execute: |
| <code> | <code> |
| mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics | mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics |
| |
| |
| 11.修改 /etc/php-fpm.d/www.conf 配置文件内容 | 11. update php-fpm config file /etc/php-fpm.d/www.conf |
| CTI机器上: | on CTI: |
| <code> | <code> |
| [www] | [www] |
| </code> | </code> |
| |
| PHP1机器上: | on PHP1: |
| <code> | <code> |
| [www] | [www] |
| </code> | </code> |
| |
| PHP2机器上: | on PHP2: |
| <code> | <code> |
| [www] | [www] |
| |
| |
| 12.修改/usr/local/nginx/conf/nginx.conf 配置文件 | 12.update nginx config file /usr/local/nginx/conf/nginx.conf |
| CTI机器上: | |
| |
| 12-1:在http中添加以下内容: | on CTI: |
| | |
| | 12-1: add the following content in http section: |
| <code> | <code> |
| http{ | http{ |
| |
| upstream myphp { | upstream myphp { |
| #ip_hash; PHP负载均衡 | #ip_hash; PHP load balance |
| server 192.168.1.61:9000 weight=2; | server 192.168.1.61:9000 weight=2; |
| server 192.168.1.70:9000 weight=2; | server 192.168.1.70:9000 weight=2; |
| </code> | </code> |
| |
| <note> 注:http中server内的listen xxxx default,是指的页面访问的端口号。 </note> | 12-2:update location section: |
| | |
| 12-2:在location中前面位置添加以下内容,并将默认配置的fastcgi_pass 127.0.0.1:9000; 用#号注释掉: | |
| <code> | <code> |
| location ~ .*\.(php|php5)?$ | location ~ .*\.(php|php5)?$ |
| { | { |
| #这个表示login和reload时,使用本机的PHP服务,因此CTI的php-fpm服务是开启的,而且开机自启动 | #use local server for login and reloadConf action |
| set $target myphp; | set $target myphp; |
| if ($request_uri ~* login) { | if ($request_uri ~* login) { |
| </code> | </code> |
| |
| <note> 注:PHP1与PHP2机器上,这些配置都不用管,因为PHP1和PHP2上不使用nginx服务,默认fastcgi_pass 均为 127.0.0.1:9000; | <note> you don't need to update nginx on PHP1 and PHP2 </note> |
| |
| 如果只使用1台服务器(如:PHP1)运行PHP服务,而不使用PHP负载均衡,那么,CTI中不需要添加任何的内容。并且,location中第一句set $target myphp; 内容也需要修改成PHP1的地址加端口,即:set $target 192.168.1.61:9000; | |
| </note> | |
| |
| | 13. Share licensing |
| |
| 13.授权相关文件的共用 | on CTI: |
| |
| CTI机器上: | 13-1: do backup: |
| |
| 13-1:先拷贝到mount的目录: | |
| <code> cp -Rp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/statistics/agentsxindesk.ctp </code> | <code> cp -Rp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/statistics/agentsxindesk.ctp </code> |
| 再执行: | execute: |
| <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> | <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> |
| |
| 13-2:拷贝: | 13-2:copy: |
| <code> cp -Rp /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/statistics/database.php </code> | <code> cp -Rp /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/statistics/database.php </code> |
| 再执行: | execute: |
| <code> ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php </code> | <code> ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php </code> |
| |
| 13-3:/opt/asterisk/scripts/astercc/identity.astercc 文件,不用做任何操作,但要保证该文件,是最开始CTI机器上mount前备份过的文件。 | 13-3:make sure /opt/asterisk/scripts/astercc/identity.astercc, /opt/asterisk/scripts/astercc/license.astercc are original files before you mount |
| |
| 13-4:/opt/asterisk/scripts/astercc/license.astercc文件, 不用做任何操作,但要保证该文件,是最开始CTI机器上mount前备份过的文件。 | |
| |
| 13-5:拷贝: | |
| <code> cp -Rp /usr/local/conf/hcdesk.conf /opt/asterisk/scripts/astercc/hcdesk.conf </code> | <code> cp -Rp /usr/local/conf/hcdesk.conf /opt/asterisk/scripts/astercc/hcdesk.conf </code> |
| 再执行: | |
| <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> | <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> |
| |
| |
| 13-6:拷贝: | |
| <code> cp -Rp /etc/astercc.conf /opt/asterisk/scripts/astercc/astercc.conf </code> | <code> cp -Rp /etc/astercc.conf /opt/asterisk/scripts/astercc/astercc.conf </code> |
| 再执行: | |
| <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> | <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> |
| |
| |
| PHP1机器上: | on PHP1: |
| |
| 13-7:将本机的agentsxindesk.ctp文件备份成agentsxindesk.ctp.bak | 13-4:backup agentsxindesk.ctp |
| 备份: | |
| <code> mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak </code> | <code> mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak </code> |
| 再执行: | |
| <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> | <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> |
| |
| 13-8:备份: | 13-5: |
| <code> mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak </code> | <code> mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak </code> |
| 再执行: | |
| <code> ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php </code> | <code> ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php </code> |
| |
| |
| 13-9:将本机的hcdesk.conf文件备份成hcdesk.conf.bak | 13-6: backup hcdesk.conf |
| 备份: | |
| <code> mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak </code> | <code> mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak </code> |
| 再执行: | |
| <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> | <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> |
| |
| 13-10:将本机的astercc.conf文件备份成astercc.conf.bak | 13-7:backup astercc.conf |
| 备份: | |
| <code> mv /etc/astercc.conf /etc/astercc.conf.bak </code> | <code> mv /etc/astercc.conf /etc/astercc.conf.bak </code> |
| 再执行: | |
| <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> | <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> |
| |
| |
| PHP2机器上: | on PHP2: |
| |
| 13-11:将本机的agentsxindesk.ctp文件备份成agentsxindesk.ctp.bak | 13-8: bacup agentsxindesk.ctp |
| 备份: | |
| <code> mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak </code> | <code> mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak </code> |
| 再执行: | |
| <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> | <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> |
| |
| 13-12:备份: | 13-8: |
| <code> mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak </code> | <code> mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak </code> |
| 再执行: | |
| <code> ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php </code> | <code> ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php </code> |
| |
| 13-13:将本机的hcdesk.conf文件备份成hcdesk.conf.bak | 13-9: backup hcdesk.conf |
| 备份: | |
| <code> mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak </code> | <code> mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak </code> |
| 再执行: | |
| <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> | <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> |
| |
| 13-14:将本机的astercc.conf文件备份成astercc.conf.bak | 13-10: backup astercc.conf |
| 备份: | |
| <code> mv /etc/astercc.conf /etc/astercc.conf.bak </code> | <code> mv /etc/astercc.conf /etc/astercc.conf.bak </code> |
| 再执行: | |
| <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> | <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> |
| |
| |
| 14.修改一些文件的内容 | 14. update config files |
| |
| CTI机器上: | on CTI: |
| | update /etc/asterisk/manager.conf, so other servers could access asterisk: |
| /etc/asterisk/manager.conf 文件中,在文件最后面,添加所在网段的信息如下,然后保存退出,执行命令: | |
| <code> asterisk -rx "manager reload" </code> | |
| |
| <code> | <code> |
| </code> | </code> |
| |
| /etc/astercc.conf 文件中,[asterisk]标签下,server填写CTI的IP | apply the changes |
| | |
| | <code> asterisk -rx "manager reload" </code> |
| | |
| | |
| | update /etc/astercc.conf |
| <code> | <code> |
| [asterisk] | [asterisk] |
| |
| |
| 15.注意/etc/asterisk 的权限,asterisk:asterisk | 15.make sure /etc/asterisk is owned by asterisk:asterisk |
| |
| 16.crontab文件内容,执行:crontab -e 进行对其内容的编辑。crontab 中监测启动的程序,互补即可,不要有重复运行的。 | 16.update crontab by "crontab -e" |
| |
| CTI: | on CTI: |
| |
| <code> | <code> |
| |
| MySQL: | MySQL: |
| 全删除,不需要执行任何程序。 | remove all crontabe |
| |
| | PHP1 and PHP2, you just need to make sure these scripts are executed on either one |
| PHP1 和 PHP2,两台机器需要根据配置和负载来划分执行哪些脚本,两台机器不要都执行,做到互补以下脚本即可: | |
| <code> | <code> |
| * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app checkonline >/dev/null 2>&1 | * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app checkonline >/dev/null 2>&1 |
| |
| |
| 17.mount 挂载的检测,需要添加到crontab中。 | 17. make sure mount in crontabe |
| CTI: | CTI: |
| <code> | <code> |
| |
| |
| 18.最后, | 18. At last, |
| |
| 在CTI机器上执行: | On CTI server: |
| <code> /opt/asterisk/scripts/astercc/asterccc --RNI </code> | <code> /opt/asterisk/scripts/astercc/asterccc --RNI </code> |
| 在PHP1机器上执行: | On PHP1: |
| <code> /opt/asterisk/scripts/astercc/asterccc --ADI </code> | <code> /opt/asterisk/scripts/astercc/asterccc --ADI </code> |
| 在PHP2机器上执行: | on PHP2: |
| <code> /opt/asterisk/scripts/astercc/asterccc --ADI </code> | <code> /opt/asterisk/scripts/astercc/asterccc --ADI </code> |
| |
| 正常在CTI上会提示:001,在PHP1上会提示002,在PHP2上会提示003,再重新做授权。在CTI上重启asterccd服务,看是否有报错。 | If everything is good, you will see 001 on CTI server, 002 on PHP1, 003 on PHP2, after license is issued, run service asterccd restart on CTI server. |