2017-07-01 309 views
2

我已經在Ubuntu服務器上配置了Jenkins,一切工作正常,差不多2個月,Jenkins正在構建作業並運行測試用例。但最近我增加了測試用例的數量。經過一段時間,我開始拒絕連接,當我通過網絡瀏覽器打開詹金斯。Jenkins拒絕連接端口8080

IP:8080發出錯誤「連接被拒絕」。

我試圖重新啓動詹金斯服務:

sudo service jenkins restart 

它通常重新啓動,不過,詹金斯並沒有在瀏覽器中打開了。

然後我查·詹金斯的默認設置中/etc/default/jenkins

# defaults for jenkins continuous integration server 
# pulled in from the init script; makes things easier. 
NAME=jenkins 

# location of java 
JAVA=/usr/bin/java 

# arguments to pass to java 
JAVA_ARGS="-Djava.awt.headless=true" # Allow graphs etc. to work even when an X server is present 
JAVA_ARGS="-Xmx1024m" 
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address 

PIDFILE=/var/run/$NAME/$NAME.pid 

# user and group to be invoked as (default to jenkins) 
JENKINS_USER=$NAME 
JENKINS_GROUP=$NAME 

# location of the jenkins war file 
JENKINS_WAR=/usr/share/$NAME/$NAME.war 

# jenkins home location 
JENKINS_HOME=/var/lib/$NAME 

# set this to false if you don't want Hudson to run by itself 
# in this set up, you are expected to provide a servlet container 
# to host jenkins. 
RUN_STANDALONE=true 

# log location. this may be a syslog facility.priority 
JENKINS_LOG=/var/log/$NAME/$NAME.log 
#JENKINS_LOG=daemon.info 

# OS LIMITS SETUP 
# comment this out to observe /etc/security/limits.conf 
# this is on by default because http://github.com/jenkinsci/jenkins/commit/2fb288474e980d0e7ff9c4a3b768874835a3e92e 
# reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file 
# descriptors are forced to 1024 regardless of /etc/security/limits.conf 
MAXOPENFILES=8192 

# set the umask to control permission bits of files that Jenkins creates. 
# 027 makes files read-only for group and inaccessible for others, which some security sensitive users 
# might consider benefitial, especially if Jenkins runs in a box that's used for multiple purposes. 
# Beware that 027 permission would interfere with sudo scripts that run on the master (JENKINS-25065.) 
# 
# Note also that the particularly sensitive part of $JENKINS_HOME (such as credentials) are always 
# written without 'others' access. So the umask values only affect job configuration, build records, 
# that sort of things. 
# 
# If commented out, the value from the OS is inherited, which is normally 022 (as of Ubuntu 12.04, 
# by default umask comes from pam_umask(8) and /etc/login.defs 

# UMASK=027 

# port for HTTP connector (default 8080; disable with -1) 
HTTP_PORT=8080 


# servlet context, important if you want to use apache proxying 
PREFIX=/$NAME 

# arguments to pass to jenkins. 
# --javahome=$JAVA_HOME 
# --httpPort=$HTTP_PORT (default 8080; disable with -1) 
# --httpsPort=$HTTP_PORT 
# --argumentsRealm.passwd.$ADMIN_USER=[password] 
# --argumentsRealm.roles.$ADMIN_USER=admin 
# --webroot=~/.jenkins/war 
# --prefix=$PREFIX 

JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT" 

寄託都似乎罰款在此文件中war文件也有給定的位置。

當我重新啓動服務器3-4次後,它又開始打開了。但是這個問題仍然會一再出現。每次打開Jenkins我都必須重新啓動服務器。

有人可以幫助我找到這個問題,並告訴如何解決它。

+0

也許Java虛擬機內存不足或堆棧空間。日誌說什麼? – mbieren

+0

我認爲這是服務器資源問題,你是否有像發生這種問題時的情況? – chenrui

+0

您是否設置了_Manage Jenkins_→_Configure System_→** _ Jenkins位置_ **→_Jenkins URL_正確?如果不匹配,我會看到與您的行爲類似的行爲。 –

回答

0

將交換空間添加到服務器可能會解決問題。

+0

雖然這可能解決問題,但解釋爲什麼這將起作用。 – Vivz

+0

我遇到了同樣的問題,我意識到512MB內存的服務器幾乎已經耗盡。所以創建一個大小爲1GB的交換文件解決了我的情況。 –

+0

是的,它會解決我的問題一段時間,但根本原因不是空間。在我的服務器上,我有多個phantomsJS實例在運​​行,並且它們正在消耗所有的內存,這導致加載jenkins失敗 –

1

運行:

systemctl stop firewalld.service 

,然後再試一次

相關問題