解决Linux下ArcGIS Server的Tomcat不稳定问题,nginx配置反向代理时的一个小问题

背景:Linux上的ArcGIS Server的Tomcat进程基本上一天崩溃一次,全天在处理rest请求,压力较大。而SOM与SOC压力较小

解决方案:使用多个Web Service,加入另一台nginx反向代理服务器的upstream。

遇到问题:使用了反向代理的缘故,web service handler必须要用arcgis/rest方式暴露服务。所以如何配置tomcat,便成了一个比较重要的问题。

问题处理:在tomcat配置文件server.xml的host标签中加入Context,指明应用根目录。

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
        <Context path="/arcgis/rest" docBase="./arcgis/rest" reloadable="true"/>
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>

这样,就可以像访问arcgis server一样,访问localhost:8080/arcgis/rest了(注意修改每个REST Service Handler的SOM地址)。

在nginx中,配置为:

 

worker_processes auto;
events {
    worker_connections  1024;
    use epoll;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    access_log off;
    sendfile        on;
    keepalive_timeout  65;
    upstream gpsarcgis{
    server SERVER1:6080 max_fails=3;
    server SERVER2:6080 max_fails=3;
    server Server3:6080 max_fails=3;
    server Server4:8081 max_fails=3 weight=3;
    server Server5:8081 max_fails=3 weight=3;
    server Server6 :8081 max_fails=3 weight=3;
    }
    server {
        listen       6080;
        server_name  IP1 IP2;
        charset utf-8;
        location / {
        proxy_pass http://gpsarcgis;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_next_upstream error timeout invalid_header http_500 http_504 http_404;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

 

前三个为ArcGIS Server原始地址和端口,后面为tomcat。打上双保险,舒服多了!

转载于:https://www.cnblogs.com/fortoday/archive/2013/01/08/2851973.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值