| Both sides previous revisionPrevious revision | |
| en:faq:how_to_configure_multiple_servers [2016/11/09 05:38] – solo | en:faq:how_to_configure_multiple_servers [2016/11/09 05:53] (current) – solo |
|---|
| |
| |
| 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 和 PHP2,两台机器需要根据配置和负载来划分执行哪些脚本,两台机器不要都执行,做到互补以下脚本即可: | PHP1 and PHP2, you just need to make sure these scripts are executed on either one |
| <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> |