Apache2 + Tomcat: apache2를 통해 요청을 수신하면 시간 초과 및 프록시 오류가 발생합니다.

Apache2 + Tomcat: apache2를 통해 요청을 수신하면 시간 초과 및 프록시 오류가 발생합니다.

따라서 우리는 Tomcat에서 호스팅되는 solr(검색 애플리케이션)에 요청을 보내기 위해 역방향 프록시로 Apache를 사용합니다.

jboss에 호스팅된 또 다른 서버가 있는데, 이 서버는 바이너리 형식의 데이터를 Apache에 보내고, Apache는 이를 Tomcat에 보내 색인화하고 solr 데이터베이스에 넣습니다. 데이터는 다중 부분 POST 요청으로 전송됩니다. 이 프로세스는 최대 8시간이 걸릴 수 있습니다.

따라서 문제는 우리가 아파치를 통해 데이터를 보낼 때 인덱싱(데이터 전송 부분) 중간에 약 30-40분 동안 jboss(보내는 부분)에서 많은 프록시 및 잘못된 게이트웨이 오류를 받게 된다는 것입니다. data), Tomcat 로그에는 수신된 데이터에 잘못된 EOF가 있다고 표시됩니다. 따라서 데이터가 제대로 전송되지 않은 것은 당연합니다. 그리고 Apache 로그를 보면 다음과 같은 오류가 많이 있습니다.

[Wed Jan 08 16:10:45 2014] [error] [client 10.60.6.6] (70007)The timeout specified has expired: proxy: error reading status line from remote server localhost:8080
[Wed Jan 08 16:10:45 2014] [error] [client 10.60.6.6] proxy: Error reading from remote server returned by /application-path/application-url

그리고 이 오류는:

[Mon Jan 13 11:38:49 2014] [error] (103)Software caused connection abort: proxy: pass request body failed to [::1]:8080 (localhost)
[Mon Jan 13 11:38:49 2014] [error] proxy: pass request body failed to [::1]:8080 (localhost) from 10.3.40.76 ()

이상한 점은 Apache(:80)를 우회하고 데이터를 Tomcat(:8080)으로 직접 보내는 경우 이 문제가 발생하지 않는다는 것입니다. 처음에는 이 문제가 다음과 같아 보일 수 있습니다.이것.

그러나 Tomcat과 Apache에는 연결 유지가 켜져 있지 않습니다.

Timeout 120
KeepAlive Off

<VirtualHost *:80>
  ServerName application.com
  ServerAlias x.application.com
  DocumentRoot /var/www/something/
  ServerAdmin [email protected]

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn
  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{soapAction}i\"" logging
  CustomLog /log/httpd/access.log logging
  ErrorLog /log/httpd/error.log

  ServerSignature On

  RewriteEngine On
  RewriteLogLevel 2

  # ensure that Tomcat sees the original host and port (and not the proxy-host and -port)
  ProxyPreserveHost On

  # Rewrite Rules 
  RewriteRule ^/application-path/(.*) http://localhost:8080/application-path/$1 [P]
</VirtualHost>

그리고 바람둥이에서

<Connector connectionTimeout="10000" port="8080" protocol="HTTP/1.1"
redirectPort="8443" maxThreads="1000" processorCache="1000" maxKeepAliveRequests="1"
keepAliveTimeout="10" socket.soReuseAddress="true" socket.soKeepAlive="true"
compression="on" compressionMinSize="10"
compressableMimeType="text/html,text/xml,text/plain,application/javascript,application/json,text/javascript,text/css"
socket.soLingerOn="false" socket.soLingerTime="0" URIEncoding="UTF-8" />

그리고 궁금해하시는 분들을 위해 말씀드리자면, Apache는 Tomcat보다 시간 초과가 더 길고 둘 다 연결 유지가 꺼져 있으므로 Tomcat이 시간 초과를 반환하지 않는데 Apache가 왜 시간 초과를 반환하는지 이해가 되지 않습니다.

답변1

귀하와 비슷한 문제가 있었습니다. 우리는 iptables를 사용하여 모든 트래픽을 포트 80에서 8080으로 전달함으로써 Apache를 완전히 우회했습니다. 이것이 귀하에게 효과가 있는지 확실하지 않습니다.

Tomcat이 포트 80을 수신하도록 할 수도 있습니다. (80을 수신하는 다른 사이트가 있는지 여부는 확실하지 않습니다.)

관련 정보