永中文档在线预览集群部署方案

1,663 阅读2分钟

1.产品介绍

永中文档在线预览软件(Document Conversion Service,简称DCS)是通过解析常用办公文档的格式,提供不同文档格式间的相互转换,实现常用格式文档的阅读等服务。 DCS能直接部署在Windows或Linux网络操作系统上,与Web 服务器、邮件服务器等配合,提供Office文档阅读及批量转换功能。 永中DCS支持阅读和转换的文档格式非常丰富,涵盖微软Office 97~2013、PDF、UOF和OFD等常用文档格式,同时可根据用户需求进行特定格式的合作。

2.集群部署

2.1编译工具及库文件(Linux版)

系统平台:CentOS release 6.6 (Final) 64位。

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

image.png

安装完:

image.png

安装 PCRE

PCRE 作用是让 Nginx 支持 Rewrite 功能。

1、下载PCRE安装包,下载地址:downloads.sourceforge.net/project/pcr…  [root@bogon src]#wget sourceforge.net/projects/pc…

image.png

2、解压安装包:

[root@bogon src]# tar zxvf pcre-8.35.tar.gz

image.png

3、进入安装包目录

[root@bogon src]# cd pcre-8.35

image.png

4、编译安装 

[root@bogon pcre-8.35]#  ./configure

image.png

[root@bogon pcre-8.35]# make && make install

image.png

5、查看pcre版本

[root@bogon pcre-8.35]# pcre-config –version

2.2 nginx安装

1、下载 Nginx,下载地址:nginx.org/download/ng…7.0.tar.gz

[root@bogon src]# wget nginx.org/download/ng…

image.png

2、解压安装包

[root@bogon src]# tar zxvf nginx-1.7.0.tar.gz

image.png

3、进入安装包目录

[root@bogon src]# cd nginx-1.7.0

image.png

4、编译安装

[root@bogon nginx-1.7.0]# ./configure --prefix=/usr/local//nginx --with-http_stub_status_module --with-http_ssl_module

image.png

[root@bogon nginx-1.7.0]#  make

image.png

[root@bogon nginx-1.7.0]# make install

image.png

5、查看nginx版本

[root@bogon nginx-1.6.2]# /usr/local/nginx/sbin/nginx –v

image.png

到此,nginx安装完成。

配置并启动nginx

经过上面的安装步骤和目录设置,nginx的启动程序就是/usr/local/nginx/sbin/nginx,配置文件是/usr/local/nginx/conf/nginx.conf,可在配置文件里修改端口、反向代理路径等

启动nginx的命令为:

1.   /usr/local/nginx/sbin/nginx -t   //测试nginx.conf的配置是否正确  

image.png

2.   /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf  //根据nginx.conf里的配置,启动nginx服务  

image.png

检测是否成功:

curl localhost

image.png

2.3 配置Nginx的负载均衡

基本配置如下:

[root@bogon pcre-8.35]# vim /usr/local/nginx/conf/nginx.conf

……

……

#upstream 表示负载服务器池,定义名字为yozodcs_server的服务器池

upstream yozodcs_server {
server   10.254.244.20:81;
server   10.254.242.40:81;
server   10.254.245.19:81;
server   10.254.243.39:81;

}

 server
{

#监听端口
listen       80;
server_name  10.254.244.20;    nginx服务器IP
index index.html index.htm index.php;    #首页排序

Location /dcs.web/

{

           proxy_pass http://yozodcs;

proxy_next_upstream http_502 http_504 error timeout invalid_header;

      }

}

……

……

 

详细配置请见:

yq.aliyun.com/articles/57…

2.4 linux下nginx的基本部署命令

启动命令:

nginx -c /usr/local/nginx/conf/nginx.conf

查看nginx主进程:

ps -ef | grep nginx 

停止命令:

从容停止Nginx:

kill -QUIT 主进程号 

例如:kill -QUIT 16391

快速停止Nginx:

kill -TERM 主进程号 

强制停止Nginx:

kill -9 主进程号 

3.小结

上述通过利用nginx部署永中文档在线预览集群服务,可以解决单点故障问题,保证服务的稳定运行,提高服务可用性,给客户更好的体验。