詹金斯拒绝连接端口8080

时间:2017-07-01 07:01:13

标签: linux jenkins

我已经在Ubuntu服务器上配置了Jenkins,一切都运行良好近2个月,Jenkins正在构建工作并运行测试用例。但最近我增加了测试用例的数量。一段时间后,当我通过网络浏览器打开Jenkins时,它开始拒绝连接。

IP:8080发出错误“连接被拒绝”。

我尝试通过以下方式重启Jenkins服务:

sudo service jenkins restart

它正常重启,但jenkins还没有在浏览器上打开。

然后我在/etc/default/jenkins中检查了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"

此文件中的Everthing似乎很好,并且war文件也位于给定位置。

当我重新启动服务器3-4次时,它再次开始打开。但这个问题仍然一次又一次地出现。我每次都要重启服务器才能打开Jenkins。

有人可以帮助我找到这个问题并告诉他们如何解决它。

4 个答案:

答案 0 :(得分:0)

向服务器添加交换空间可以解决问题。

答案 1 :(得分:0)

我在AWS EC2上运行Jenkins时遇到此错误,并尝试从外部(在我的情况下是内部网络的一个实例)进行访问。

当我从Jenkins服务器内部运行curl localhost:8080时,一切都很好,但是当我从内部网络的一个实例中执行相同操作时,我遇到了提到的refused to connect on port 8080错误。

解决方案是vim /etc/sysconfig/jenkins并进行更改:

JENKINS_LISTEN_ADDRESS="127.0.0.1"

收件人:

JENKINS_LISTEN_ADDRESS="0.0.0.0"

答案 2 :(得分:0)

我花了一段时间才弄明白这个。对我来说,它是在更改我的 Windows 密码后开始发生的。解决方案是更新 Jenkins 服务的凭据。

  1. 在 Windows 搜索栏中,输入 services 然后回车。
  2. 然后向下滚动到 Jenkins 并双击它。
  3. 在 Jenkins 属性中,选择选项卡“登录”。
  4. 选中复选框“此帐户”
  5. 更新您的用户名和密码。

瞧!现在 Jenkins web 可以通过 Jenkins 服务连接到 Jenkins 机器了。

答案 3 :(得分:-3)

运行:

from random import SystemRandom

srand = SystemRandom()

num1 = srand.choice(range(10))
num2 = srand.choice(range(10))
num3 = srand.choice(range(10))

print num1, num2, num3

再试一次

相关问题