这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
|
zh:常见问题及解答:如何为astercc系统配置多台php服务器 [2016/05/04 13:37] liuxl [系统详情] |
zh:常见问题及解答:如何为astercc系统配置多台php服务器 [2017/12/12 03:05] (当前版本) |
||
|---|---|---|---|
| 行 9: | 行 9: | ||
| <note> 注:做分布之前,先确保所有服务器的asterCC的版本必须是一样的,其次 安装相同的模块。 </note> | <note> 注:做分布之前,先确保所有服务器的asterCC的版本必须是一样的,其次 安装相同的模块。 </note> | ||
| + | |||
| + | <note important>多台集群服务器,请确保除了CTI上的asterccd进程正常启动外其它服务器该进程停止运行,且设置chkconfig关闭asterccd开机自动启动。mysql上crontab -e内设置的astercc定时任务全部用“#”号注释掉。</note> | ||
| 1.对系统进行分布配置前,首先需要将CTI机器上的数据库备份。 | 1.对系统进行分布配置前,首先需要将CTI机器上的数据库备份。 | ||
| 行 152: | 行 154: | ||
| 同PHP1 | 同PHP1 | ||
| - | <note tip><code> | + | <code> |
| 端口说明:请按实际情况,对/etc/sysconfig/iptables文件中端口进行保留。 | 端口说明:请按实际情况,对/etc/sysconfig/iptables文件中端口进行保留。 | ||
| 21:FTP默认端口 | 21:FTP默认端口 | ||
| 行 175: | 行 177: | ||
| 9000:php默认端口 | 9000:php默认端口 | ||
| 10000:20000:Asterisk中RTP要使用的端口 | 10000:20000:Asterisk中RTP要使用的端口 | ||
| - | </code></note> | + | </code> |
| 行 271: | 行 273: | ||
| CTI机器上,依次执行命令,进行挂载: | 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/ccdata /var/www/html/asterCC/data |
| 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 | ||
| </code> | </code> | ||
| 行 292: | 行 294: | ||
| mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc | mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc | ||
| </code> | </code> | ||
| - | |||
| 11.修改 /etc/php-fpm.d/www.conf 配置文件内容 | 11.修改 /etc/php-fpm.d/www.conf 配置文件内容 | ||
| 行 298: | 行 299: | ||
| <code> | <code> | ||
| [www] | [www] | ||
| - | listen=127.0.0.1 | + | listen=127.0.0.1:9000 |
| listen.allowed_clients=127.0.0.1 | listen.allowed_clients=127.0.0.1 | ||
| </code> | </code> | ||
| + | |||
| + | {{:zh:常见问题及解答:selection_052.png?750|}} | ||
| PHP1机器上: | PHP1机器上: | ||
| 行 322: | 行 325: | ||
| 12-1:在http中添加以下内容: | 12-1:在http中添加以下内容: | ||
| <code> | <code> | ||
| - | http{ | ||
| - | |||
| upstream myphp { | upstream myphp { | ||
| #ip_hash; PHP负载均衡 | #ip_hash; PHP负载均衡 | ||
| 行 329: | 行 330: | ||
| server 192.168.1.70:9000 weight=2; | server 192.168.1.70:9000 weight=2; | ||
| } | } | ||
| - | } | ||
| </code> | </code> | ||
| + | |||
| + | {{:zh:常见问题及解答:selection_050.png?750|}} | ||
| <note> 注:http中server内的listen xxxx default,是指的页面访问的端口号。 </note> | <note> 注:http中server内的listen xxxx default,是指的页面访问的端口号。 </note> | ||
| 行 336: | 行 338: | ||
| 12-2:在location中前面位置添加以下内容,并将默认配置的fastcgi_pass 127.0.0.1:9000; 用#号注释掉: | 12-2:在location中前面位置添加以下内容,并将默认配置的fastcgi_pass 127.0.0.1:9000; 用#号注释掉: | ||
| <code> | <code> | ||
| - | location ~ .*\.(php|php5)?$ | ||
| - | { | ||
| #这个表示login和reload时,使用本机的PHP服务,因此CTI的php-fpm服务是开启的,而且开机自启动 | #这个表示login和reload时,使用本机的PHP服务,因此CTI的php-fpm服务是开启的,而且开机自启动 | ||
| set $target myphp; | set $target myphp; | ||
| 行 348: | 行 348: | ||
| fastcgi_pass $target; | fastcgi_pass $target; | ||
| #fastcgi_pass 127.0.0.1:9000; | #fastcgi_pass 127.0.0.1:9000; | ||
| - | } | ||
| </code> | </code> | ||
| - | <note> 注:PHP1与PHP2机器上,这些配置都不用管,因为PHP1和PHP2上不使用nginx服务,默认fastcgi_pass 均为 127.0.0.1:9000; </note> | + | {{:zh:常见问题及解答:selection_051.png?750|}} |
| + | |||
| + | <note> 注:PHP1与PHP2机器上,这些配置都不用管,因为PHP1和PHP2上不使用nginx服务,默认fastcgi_pass 均为 127.0.0.1:9000; | ||
| 如果只使用1台服务器(如:PHP1)运行PHP服务,而不使用PHP负载均衡,那么,CTI中不需要添加任何的内容。并且,location中第一句set $target myphp; 内容也需要修改成PHP1的地址加端口,即:set $target 192.168.1.61:9000; | 如果只使用1台服务器(如:PHP1)运行PHP服务,而不使用PHP负载均衡,那么,CTI中不需要添加任何的内容。并且,location中第一句set $target myphp; 内容也需要修改成PHP1的地址加端口,即:set $target 192.168.1.61:9000; | ||
| + | </note> | ||
| 行 361: | 行 363: | ||
| 13-1:先拷贝到mount的目录: | 13-1:先拷贝到mount的目录: | ||
| - | cp -Rp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/statistics/agentsxindesk.ctp | + | <code> cp -Rp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/statistics/agentsxindesk.ctp </code> |
| 再执行: | 再执行: | ||
| - | ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp | + | <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> |
| 13-2:拷贝: | 13-2:拷贝: | ||
| - | cp -Rp /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/statistics/database.php | + | <code> cp -Rp /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/statistics/database.php </code> |
| 再执行: | 再执行: | ||
| - | ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php | + | <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:/opt/asterisk/scripts/astercc/identity.astercc 文件,不用做任何操作,但要保证该文件,是最开始CTI机器上mount前备份过的文件。 | ||
| 行 375: | 行 377: | ||
| 13-5:拷贝: | 13-5:拷贝: | ||
| - | cp -Rp /usr/local/conf/hcdesk.conf /opt/asterisk/scripts/astercc/hcdesk.conf | + | <code> cp -Rp /usr/local/conf/hcdesk.conf /opt/asterisk/scripts/astercc/hcdesk.conf </code> |
| 再执行: | 再执行: | ||
| - | ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf | + | <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> |
| 13-6:拷贝: | 13-6:拷贝: | ||
| - | cp -Rp /etc/astercc.conf /opt/asterisk/scripts/astercc/astercc.conf | + | <code> cp -Rp /etc/astercc.conf /opt/asterisk/scripts/astercc/astercc.conf </code> |
| 再执行: | 再执行: | ||
| - | ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf | + | <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> |
| PHP1机器上: | PHP1机器上: | ||
| + | |||
| 13-7:将本机的agentsxindesk.ctp文件备份成agentsxindesk.ctp.bak | 13-7:将本机的agentsxindesk.ctp文件备份成agentsxindesk.ctp.bak | ||
| 备份: | 备份: | ||
| - | mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak。 | + | <code> mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp | + | <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> |
| 13-8:备份: | 13-8:备份: | ||
| - | mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak。 | + | <code> mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php | + | <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-9:将本机的hcdesk.conf文件备份成hcdesk.conf.bak | ||
| 备份: | 备份: | ||
| - | mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak | + | <code> mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf | + | <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> |
| 13-10:将本机的astercc.conf文件备份成astercc.conf.bak | 13-10:将本机的astercc.conf文件备份成astercc.conf.bak | ||
| 备份: | 备份: | ||
| - | mv /etc/astercc.conf /etc/astercc.conf.bak | + | <code> mv /etc/astercc.conf /etc/astercc.conf.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf | + | <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> |
| PHP2机器上: | PHP2机器上: | ||
| + | |||
| 13-11:将本机的agentsxindesk.ctp文件备份成agentsxindesk.ctp.bak | 13-11:将本机的agentsxindesk.ctp文件备份成agentsxindesk.ctp.bak | ||
| 备份: | 备份: | ||
| - | mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak。 | + | <code> mv /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp | + | <code> ln -s /var/www/html/asterCC/statistics/agentsxindesk.ctp /var/www/html/asterCC/app/views/agents/agentsxindesk.ctp </code> |
| 13-12:备份: | 13-12:备份: | ||
| - | mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak。 | + | <code> mv /var/www/html/asterCC/app/config/database.php /var/www/html/asterCC/app/config/database.php.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /var/www/html/asterCC/statistics/database.php /var/www/html/asterCC/app/config/database.php | + | <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-13:将本机的hcdesk.conf文件备份成hcdesk.conf.bak | ||
| 备份: | 备份: | ||
| - | mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak | + | <code> mv /usr/local/conf/hcdesk.conf /usr/local/conf/hcdesk.conf.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf | + | <code> ln -s /opt/asterisk/scripts/astercc/hcdesk.conf /usr/local/conf/hcdesk.conf </code> |
| 13-14:将本机的astercc.conf文件备份成astercc.conf.bak | 13-14:将本机的astercc.conf文件备份成astercc.conf.bak | ||
| 备份: | 备份: | ||
| - | mv /etc/astercc.conf /etc/astercc.conf.bak | + | <code> mv /etc/astercc.conf /etc/astercc.conf.bak </code> |
| 再执行: | 再执行: | ||
| - | ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf | + | <code> ln -s /opt/asterisk/scripts/astercc/astercc.conf /etc/astercc.conf </code> |
| 14.修改一些文件的内容 | 14.修改一些文件的内容 | ||
| + | |||
| CTI机器上: | CTI机器上: | ||
| - | /etc/asterisk/manager.conf 文件中,在文件最后面,添加所在网段的信息如下,然后保存退出,执行命令:asterisk -rx “manager reload” | + | |
| + | /etc/asterisk/manager.conf 文件中,在文件最后面,添加所在网段的信息如下,然后保存退出,执行命令: | ||
| + | <code> asterisk -rx "manager reload" </code> | ||
| + | |||
| + | <code> | ||
| [astercc] | [astercc] | ||
| secret = asterccsecret | secret = asterccsecret | ||
| 行 447: | 行 456: | ||
| read = system,call,agent | read = system,call,agent | ||
| write = system,call,agent,user,config,command,reporting,originate | write = system,call,agent,user,config,command,reporting,originate | ||
| + | </code> | ||
| /etc/astercc.conf 文件中,[asterisk]标签下,server填写CTI的IP | /etc/astercc.conf 文件中,[asterisk]标签下,server填写CTI的IP | ||
| + | <code> | ||
| [asterisk] | [asterisk] | ||
| server = 192.168.1.62 | server = 192.168.1.62 | ||
| 行 454: | 行 465: | ||
| username = astercc | username = astercc | ||
| secret = asterccsecret | secret = asterccsecret | ||
| + | </code> | ||
| 行 459: | 行 471: | ||
| 16.crontab文件内容,执行:crontab -e 进行对其内容的编辑。crontab 中监测启动的程序,互补即可,不要有重复运行的。 | 16.crontab文件内容,执行:crontab -e 进行对其内容的编辑。crontab 中监测启动的程序,互补即可,不要有重复运行的。 | ||
| + | |||
| CTI: | CTI: | ||
| + | |||
| + | <code> | ||
| 30 12 * * * /opt/asterisk/scripts/astercc/processmonitors -d | 30 12 * * * /opt/asterisk/scripts/astercc/processmonitors -d | ||
| 30 20 * * * /opt/asterisk/scripts/astercc/processmonitors -d | 30 20 * * * /opt/asterisk/scripts/astercc/processmonitors -d | ||
| 行 467: | 行 482: | ||
| 10 0 * * * /opt/asterisk/scripts/astercc/agent_report -d | 10 0 * * * /opt/asterisk/scripts/astercc/agent_report -d | ||
| 20 0 * * * /opt/asterisk/scripts/astercc/agentgroup_report -d | 20 0 * * * /opt/asterisk/scripts/astercc/agentgroup_report -d | ||
| + | </code> | ||
| MySQL: | MySQL: | ||
| 行 474: | 行 489: | ||
| PHP1 和 PHP2,两台机器需要根据配置和负载来划分执行哪些脚本,两台机器不要都执行,做到互补以下脚本即可: | PHP1 和 PHP2,两台机器需要根据配置和负载来划分执行哪些脚本,两台机器不要都执行,做到互补以下脚本即可: | ||
| + | <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 | ||
| * 2 * * * /opt/asterisk/scripts/astercc/astcc_backup.sh >/dev/null 2>&1 | * 2 * * * /opt/asterisk/scripts/astercc/astcc_backup.sh >/dev/null 2>&1 | ||
| 行 486: | 行 502: | ||
| * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app asterccfilter >/dev/null 2>&1 | * * * * * /var/www/html/asterCC/cake/console/cake -app /var/www/html/asterCC/app asterccfilter >/dev/null 2>&1 | ||
| * * * * * /opt/asterisk/scripts/astercc/astcc_historydata -d | * * * * * /opt/asterisk/scripts/astercc/astcc_historydata -d | ||
| + | </code> | ||
| 17.mount 挂载的检测,需要添加到crontab中。 | 17.mount 挂载的检测,需要添加到crontab中。 | ||
| CTI: | CTI: | ||
| + | <code> | ||
| */5 * * * * dfccdata=`df |grep ccdata`; [ "X${dfccdata}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdata /var/www/html/asterCC/data`; | */5 * * * * dfccdata=`df |grep ccdata`; [ "X${dfccdata}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdata /var/www/html/asterCC/data`; | ||
| */5 * * * * dfccstatistics=`df |grep ccstatistics`; [ "X${dfccstatistics}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics`; | */5 * * * * dfccstatistics=`df |grep ccstatistics`; [ "X${dfccstatistics}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics`; | ||
| + | </code> | ||
| PHP1: | PHP1: | ||
| + | <code> | ||
| */5 * * * * dfccastspool=`df |grep ccastspool`; [ "X${dfccastspool}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk/`; | */5 * * * * dfccastspool=`df |grep ccastspool`; [ "X${dfccastspool}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastspool /var/spool/asterisk/`; | ||
| */5 * * * * dfastetc=`df |grep etc/asterisk`; [ "X${dfastetc}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastetc /etc/asterisk/`; | */5 * * * * dfastetc=`df |grep etc/asterisk`; [ "X${dfastetc}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastetc /etc/asterisk/`; | ||
| */5 * * * * dfccastlib=`df |grep ccastlib`; [ "X${dfccastlib}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk/`; | */5 * * * * dfccastlib=`df |grep ccastlib`; [ "X${dfccastlib}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk/`; | ||
| */5 * * * * dfccscripts=`df |grep ccscripts`; [ "X${dfccscripts}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc/`; | */5 * * * * dfccscripts=`df |grep ccscripts`; [ "X${dfccscripts}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc/`; | ||
| + | </code> | ||
| PHP2: | PHP2: | ||
| + | <code> | ||
| */5 * * * * dfccdata=`df |grep ccdata`; [ "X${dfccdata}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdata /var/www/html/asterCC/data`; | */5 * * * * dfccdata=`df |grep ccdata`; [ "X${dfccdata}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccdata /var/www/html/asterCC/data`; | ||
| */5 * * * * dfccstatistics=`df |grep ccstatistics`; [ "X${dfccstatistics}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics`; | */5 * * * * dfccstatistics=`df |grep ccstatistics`; [ "X${dfccstatistics}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.61/ccstatistics /var/www/html/asterCC/statistics`; | ||
| 行 510: | 行 531: | ||
| */5 * * * * dfccastlib=`df |grep ccastlib`; [ "X${dfccastlib}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk/`; | */5 * * * * dfccastlib=`df |grep ccastlib`; [ "X${dfccastlib}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccastlib /var/lib/asterisk/`; | ||
| */5 * * * * dfccscripts=`df |grep ccscripts`; [ "X${dfccscripts}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc/`; | */5 * * * * dfccscripts=`df |grep ccscripts`; [ "X${dfccscripts}" = "X" ] && `mount -t cifs -o username=sbu,password=123456 //192.168.1.62/ccscripts /opt/asterisk/scripts/astercc/`; | ||
| + | </code> | ||
| 行 522: | 行 544: | ||
| 正常在CTI上会提示:001,在PHP1上会提示002,在PHP2上会提示003,再重新做授权。在CTI上重启asterccd服务,看是否有报错。 | 正常在CTI上会提示:001,在PHP1上会提示002,在PHP2上会提示003,再重新做授权。在CTI上重启asterccd服务,看是否有报错。 | ||
| - | |||