Jenkins Master and Slave Architecture – A Complete Guide

Last updated on Nov 25,2020 69.4K Views

Jenkins Master and Slave Architecture – A Complete Guide

edureka.co

Jenkins is one of the most important tools in DevOps. Jenkins is used in the Continuous Integration stage of DevOps. In this blog, I am going to talk about the Jenkins Master and Slave architecture. The pointers that I will cover are as follows:

So let us begin with our first topic.

What is Jenkins?

Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes. Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. It also allows you to continuously deliver your software by integrating with a large number of testing and deployment technologies.

With Jenkins, organizations can accelerate the software development process through automation. Jenkins integrates development life-cycle processes of all kinds, including build, document, test, package, stage, deploy, static analysis and much more.

Jenkins achieves Continuous Integration with the help of plugins. Plugins allow the integration of Various DevOps stages. If you want to integrate a particular tool, you need to install the plugins for that tool. For example Git, Maven 2 project, Amazon EC2, HTML publisher, etc.

Advantages of Jenkins include:

Jenkins Architecture

Let us have a look at the Jenkins Architecture below diagram depicts the same.

This single Jenkins server was not enough to meet certain requirements like:

To address the above-stated needs, Jenkins distributed architecture came into the picture.

Jenkins Distributed Architecture

Jenkins uses a Master-Slave architecture to manage distributed builds. In this architecture, Master and Slave communicate through TCP/IP protocol.

Jenkins Master

Your main Jenkins server is the Master. The Master’s job is to handle:

Jenkins Slave

A Slave is a Java executable that runs on a remote machine. Following are the characteristics of Jenkins Slaves:

The diagram below is self-explanatory. It consists of a Jenkins Master which is managing three Jenkins Slave.

How Jenkins Master and Slave Architecture works?

Now let us look at an example in which we use Jenkins for testing in different environments like Ubuntu, MAC, Windows, etc.

The diagram below represents the same:

The above image represents the following functions:

How to setup Jenkins Master and Slaves?

  1. Go to the Manage Jenkins section and scroll down to the section of Manage Nodes.

 

 

 

 

2.  Click on New Node

3. Give a name for the node, choose the Permanent Agent option and click on Ok.

4.  Enter the details of the node slave machine. Here no. of executers in nothing but no. of jobs that  this slave can run parallely. Here we have kept it to 2. The Labels for which the name is entered as “Slave1” is what can be used to configure jobs to use this slave machine.Select Usage to Use this node as much as possible. For launch method we select the option of “Launch agent by connecting it to the master”. If this option is not visible then go to Jenkins home page -> Manage Jenkins -> Configure Global Security. Here in the Agents section click on Random and Save it. Now you will find the required option. Enter Custom WorkDir path as the workspace of your slave node. In Availability select “Keep this agent online as much as possible”.Click on Save.

Once you complete the above steps, the new node machine will initially be in an offline state but will come online if all the settings in the previous screen were entered correctly. One can at any time make the node slave machine offline if required.

5. Now since your slave is up and running, lets execute a job on slave. For that I already have an existing job and I will run this job on this slave. Open this job and click on configure. Now here in the General section, click on “Restrict where this project can be run”. Here in Label Expression, enter the name of the slave and save it. Now click on Build now and see the output of this job. Everything is correct you will see the output as Success.

So with this, we have come to the end of this blog on Jenkins Master and Slave Architecture. I hope you have understood all the concepts explained here.

Now that you have understood what Jenkins Master and Slave Architecture is, check out this DevOps training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners to understand what is DevOps and gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Nagios, Ansible, Chef, Saltstack and GIT for automating multiple steps in SDLC.

Got a question for us? Please mention it in the comments section and we will get back to you

Upcoming Batches For DevOps Certification Training Course
Course NameDateDetails
DevOps Certification Training Course

Class Starts on 11th May,2024

11th May

SAT&SUN (Weekend Batch)
View Details
DevOps Certification Training Course

Class Starts on 20th May,2024

20th May

MON-FRI (Weekday Batch)
View Details
DevOps Certification Training Course

Class Starts on 17th June,2024

17th June

MON-FRI (Weekday Batch)
View Details
BROWSE COURSES