当前位置: 首页 > 知识库问答 >
问题:

jenkins swarm插件:无法连接到Master。连接被拒绝

子车峰
2023-03-14

我正在使用jenkins swarm插件将从节点连接到主节点。但是,它给出了连接拒绝错误。

version: '3.1'

    services:
      viz:
        image: manomarks/visualizer
        volumes:
          - "/var/run/docker.sock:/var/run/docker.sock"
        ports:
          - "8090:8080"

      master:
        image: myproject-jenkins-master
        ports:
          - "8080:8080"
          - "50000:50000"
        volumes:
          - ./jenkins_home:/var/jenkins_home

      nginx:
        image: myproject-jenkins-nginx
        ports:
          - "80:80"

      linuxagent:
        image: myproject-jenkins-linuxagent
root@d139902be5de:~# curl http://myproject_master:8080
<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2F'/><script>window.location.replace('/login?from=%2F');</script></head><body style='background-color:white; color:white;'>


Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:

Permission you need to have (but didn't): hudson.model.Hudson.Read
 ... which is implied by: hudson.security.Permission.GenericRead
 ... which is implied by: hudson.model.Hudson.Administer
-->

</body></html>                                                                                                                                                                                                                                                                                                            root@d139902be5de:~# 
root@d139902be5de:~# curl http://myproject_nginx      
<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2F'/><script>window.location.replace('/login?from=%2F');</script></head><body style='background-color:white; color:white;'>


Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:

Permission you need to have (but didn't): hudson.model.Hudson.Read
 ... which is implied by: hudson.security.Permission.GenericRead
 ... which is implied by: hudson.model.Hudson.Administer
-->

</body></html>                                                                                                                                                                                                                                                                                                            root@d139902be5de:~# 
root@d139902be5de:~# java -jar swarm-client-3.3.jar -username mandeep -password 12213 -master http://myproject_nginx      
Apr 09, 2017 5:52:44 PM hudson.plugins.swarm.Client main
INFO: Client.main invoked with: [-username mandeep -password 12213 -master http://myproject_nginx]
Apr 09, 2017 5:52:44 PM hudson.plugins.swarm.Client run
INFO: Discovering Jenkins master
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Apr 09, 2017 5:52:44 PM hudson.plugins.swarm.Client run
INFO: Attempting to connect to http://myproject_nginx/ bc1be8e7-eaf0-47ff-8aeb-36f75d6ba081 with ID c84ce43b
Apr 09, 2017 5:52:45 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: d139902be5de-c84ce43b
Apr 09, 2017 5:52:45 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Apr 09, 2017 5:52:45 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://myproject_nginx/]
Apr 09, 2017 5:52:45 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: myproject_nginx
  Agent port:    50000
  Identity:      86:5b:f3:77:84:92:21:87:95:4c:4b:0e:f7:4e:e5:1d
Apr 09, 2017 5:52:45 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Apr 09, 2017 5:52:45 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to myproject_nginx:50000
Apr 09, 2017 5:52:55 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to myproject_nginx:50000 (retrying:2)
java.io.IOException: Failed to connect to myproject_nginx:50000
  at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:243)
  at hudson.remoting.Engine.connect(Engine.java:500)
  at hudson.remoting.Engine.innerRun(Engine.java:364)
  at hudson.remoting.Engine.run(Engine.java:287)
Caused by: java.net.ConnectException: Connection refused
  at sun.nio.ch.Net.connect0(Native Method)
  at sun.nio.ch.Net.connect(Net.java:454)
  at sun.nio.ch.Net.connect(Net.java:446)
  at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
  at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
  at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:204)
  ... 3 more
root@d139902be5de:~# java -jar swarm-client-3.3.jar -username mandeep -password 12213 -master http://myproject_master:8080
Apr 09, 2017 5:57:01 PM hudson.plugins.swarm.Client main
INFO: Client.main invoked with: [-username mandeep -password 12213 -master http://myproject_master:8080]
Apr 09, 2017 5:57:01 PM hudson.plugins.swarm.Client run
INFO: Discovering Jenkins master
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Apr 09, 2017 5:57:01 PM hudson.plugins.swarm.Client run
SEVERE: IOexception occurred
java.net.ConnectException: Connection refused (Connection refused)
  at java.net.PlainSocketImpl.socketConnect(Native Method)
  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
  at java.net.Socket.connect(Socket.java:589)
  at java.net.Socket.connect(Socket.java:538)
  at java.net.Socket.<init>(Socket.java:434)
  at java.net.Socket.<init>(Socket.java:286)
  at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
  at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
  at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
  at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
  at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
  at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
  at hudson.plugins.swarm.SwarmClient.discoverFromMasterUrl(SwarmClient.java:224)
  at hudson.plugins.swarm.Client.run(Client.java:115)
  at hudson.plugins.swarm.Client.main(Client.java:88)

共有1个答案

丁和歌
2023-03-14

对我来说,改变参数的顺序固定了它。请将-master移动到群参数的开头,如下:

java -jar /usr/share/jenkins/swarm-client-3.4.jar -disableSslVerification -master

这将修复我看到的以下错误:

Jul 25, 2017 6:26:23 PM hudson.plugins.swarm.Client run
INFO: Discovering Jenkins master
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for 
further details.
Exception in thread "main" java.lang.IllegalArgumentException: Host 
name may not be null
at org.apache.commons.httpclient.HttpHost.<init>(HttpHost.java:68)
at org.apache.commons.httpclient.HttpHost.<init>(HttpHost.java:107)
at org.apache.commons.httpclient.HttpMethodBase.setURI(HttpMethodBase.java:280)
at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
at hudson.plugins.swarm.SwarmClient.discoverFromMasterUrl(SwarmClient.java:220)
at hudson.plugins.swarm.Client.run(Client.java:114)
at hudson.plugins.swarm.Client.main(Client.java:87)
 类似资料:
  • 问题内容: 在Digitalocean的Ubuntu 16.4中安装了Redis。 我已经通过编辑编辑将默认的redis服务器更改为我在Digitalocean中的IP 那之后,我试着和所有回应这样的: 在127.0.0.1:6379无法连接到Redis的:连接被拒绝 但是如果 我得到: 这正常吗?或者该怎么办? 问题答案: 您应该做什么取决于您希望它如何工作… 如果您希望能够通过任何网络接口连接

  • 问题内容: 我正在尝试使用Flask在Raspberry Pi上运行一个简单的Web服务器。当我运行Flask应用程序时,它说: 在http://127.0.0.1:5000/上运行 但是,当我在笔记本电脑的Chrome中输入此地址时, ERR_CONNECTION_REFUSED 我可以在Raspberry Pi的浏览器上打开127.0.0.1:5000。我需要怎么做才能从另一台计算机连接? 问

  • 每次运行Rails4.0服务器时,都会得到这个输出。 我正在运行小牛OS X10.9,所以我不知道这是不是问题所在。我已经试了我能试的一切,但似乎都没有效果。我已经卸载并安装了postgres和pg gem多次了。 这是我的database.yml文件

  • 我正在尝试运行卡桑德拉,但每次它在连接时都会给出相同的错误...有什么我需要在配置文件或属性文件中编辑的吗? ('无法连接到任何服务器',{'127.0.0.1:9042 ':错误(61,"尝试连接到[('127.0.0.1 ',9042)]。最后一个错误:连接被拒绝")}) 启动cassandra时出错

  • 问题内容: 在ubuntu中尝试此mongo命令时,出现此错误。 我该如何纠正这个问题呢? 问题答案: 谢谢大家,我尝试运行mongo,但它最终没有运行,我发现我的硬盘上没有空间,我清空了一些空间,最后按照与mongodb docs中给出的安装步骤相同的安装步骤重新安装了它,最后重新启动了服务器它正在运行。 https://docs.mongodb.org/manual/tutorial/inst