Can a jenkins agent be configured by multiple controller instances?

7k views Asked by At

I'm trying to have a slave that is hooked up to two masters. However, when I run the Jenkins JNLP I keep getting socket errors. Has anyone had experience with this and been able to work around it?

    C:\Documents and Settings\Administrator>java -jar "C:\Documents and Settings\Adm
inistrator\Desktop\test2-slave.jar" -jnlpUrl http://test2.site.com:8080/com
puter/Slave1/slave-agent.jnlp -secret b4161b716c31a8985d8eb2760fdc6a404693bbf86c
7262973554877759ea1db1
Dec 25, 2013 10:50:16 AM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Dec 25, 2013 10:50:16 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://test2.site.com:8080/]
Dec 25, 2013 10:50:16 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to test2.site.com:7777
Dec 25, 2013 10:50:47 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to test2.site.com:7777 (retrying:2)
java.net.ConnectException: Connection timed out: connect
        at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at hudson.remoting.Engine.connect(Engine.java:333)
        at hudson.remoting.Engine.run(Engine.java:222)

I know that I can connect to the jenkins box on port 8080. (I checked).

1

There are 1 answers

0
AudioBubble On

you need to have two separate jar files and secret keys for two different masters. I am seeing only one in the question. Once you have got you can run them one after other so that same slave makes connection to two different masters. Also it is important to note that you need Java version > 7.