1. 程式人生 > >Tomcat伺服器提示:The server is temporarily unable to service your request due to maintenance downtime or capacity problems

Tomcat伺服器提示:The server is temporarily unable to service your request due to maintenance downtime or capacity problems

今天網站突然不能訪問了,這裡做一下記錄提示:

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. 
Please try again later. Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

造成原因分析:

一、網站超過了伺服器限制造成的

二、資料庫連線池是否已滿,記憶體是否溢位

解決:

本次記錄造成的原因是,伺服器配置低,Tomcat logs目錄下  catalina.out檔案過大(24M) 造成伺服器 暫停服務

1. 解決辦法:

cd logs

echo > catalina.out #來清空內容

../bin/shutdown.sh #停止服務
../bin/startup.sh #啟動服務

注意:這隻能暫時解決,可能檔案很快又會滿了,當然升級伺服器可能是最靠譜的解決辦法

2. catalina.out日誌level調整

既然日誌檔案catalina.out太大,那就調整它的日誌記錄等級,tomcat日誌等級如下:

SEVERE (highest value) > WARNING > INFO > CONFIG > FINE(預設) > FINER > FINEST (lowest value)

# vim conf/logging.properties
###################
# Handler specific properties.
# Describes specific configuration info for Handlers.
###################
1catalina.org.apache.juli.AsyncFileHandler.level 
= OFF 1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs 1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.

這裡我就直接把它關閉了:1catalina.org.apache.juli.AsyncFileHandler.level = OFF,推薦使用WARNING
然後如第三步的shutdown再startup重啟tomcat使之生效。