How to set-up Master-Slave in Jenkins?

How to set-up Master-Slave in Jenkins?

Pre-Conditions to configure Master & Slave configuration in Jenkins:

  1. Jenkins should be up & running in a local/remote server
  2. User should have admin access to configure Jenkins

Plug-ins to be installed in Jenkins:
Go to Jenkins --> Manage Jenkins --> Manage Plugins --> Available tab--> Search the below plugins & install them
Steps before set-up: 
  1. Go to Jenkins --> Manage Jenkins --> Configure Global Security 
  2. In Agents section,  observe the "TCP port for JNLP agents" section
  3. "TCP port for JNLP agents" should be selected to Fixed with a random number entered in the text-box beside it. 
  4. Click on "Agent Protocols" button 
  5. select the checkbox - "Java Web Start Agent Protocol/4 (TLS encryption)" 
  6. Click on Apply button in the bottom of the Jenkins page and then click on Save button beside it. 
Agents
TCP port for JNLP agents
  
Help for feature: TCP port for JNLP agents
Agent protocols
Accepts connections from remote clients so that they can be used as additional build agents. This protocol is unencrypted.
Deprecated. This protocol is an obsolete protocol, which has been replaced by JNLP2-connect. It is also not encrypted.
Extends the version 1 protocol by adding a per-client cookie, so that we can detect a reconnection from the agent and take appropriate action. This protocol is unencrypted.
Deprecated. This protocol has known stability issues, and it is replaced by JNLP4. It is also not encrypted. See more information in the protocol Errata.JNLP2 Protocol Errata
Extends the version 2 protocol by adding basic encryption but requires a thread per client.
Deprecated. This protocol is unstable. See the protocol documentation for more info. JNLP3 Protocol Errata
A TLS secured connection between the master and the agent performed by TLS upgrade of the socket.

Steps to Set-up:
  1. Go to Jenkins --> Manage Jenkins --> Manage Nodes
  2. By Default, master is found in row 1 of Manage Nodes page in Jenkins
  3. Click on "New Node" on the left menu bar of Manage Nodes page in Jenkins 
  4. Add a node name for slave 
  5. Add a number 2 in "# of Executors" field --> This number can vary based on the number of cores your slave contains. Number can be 2 for a dual-core machine & 4 for a Quad-core machine. 
  6. Add a label to identify this slave machine by label name while configuring in Jobs 
  7. In Usage field, select "Only build jobs with label expressions matching this node", so that we can run on this machine only when job is configured to run in this machine. 
  8. In Launch Method field, select "Launch agent via Java Web Start", to install and connect master to slave via JNLP connection.
  9. In Availability field, select "Keep this agent online as much as possible"
  10. In Node properties, add the following environment variables: Name: BUILD_ID, Value: dontKillMe
  11. Click on Save 
Post-Steps:

  1. Install the above displayed JNLP.exe file in the slave machine generated while adding the slave node in master machine (In Manage Node)
  2. Double click on the JNLP excutable file 
  3. Observe if the Message displays: Connected
Verification: 
The slave should be found displayed in Jenkins Home page on the left side panel. 
Slave details should be mentioned as below. 

 master
1Idle
2Idle
 slave
1Idle
2Idle


About the author of this post:


I am a Software Test Engineer, who is quite passionate about testing, automating and finding bugs. I am from Bangalore, India. 

Feel free to reach me out on suggestions and improvements at My Linkedin Profile

No comments:

Post a Comment

Copyright © 2017 QALEARNINGGUIDE.COM || ALL RIGHTS RESERVED