DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Jenkins in the Age of Kubernetes: Strengths, Weaknesses, and Its Future in CI/CD
  • DORA Metrics: Tracking and Observability With Jenkins, Prometheus, and Observe
  • An Explanation of Jenkins Architecture
  • Implementing CI/CD Pipelines With Jenkins and Docker

Trending

  • The Modern Data Stack Is Overrated — Here’s What Works
  • Unlocking AI Coding Assistants Part 2: Generating Code
  • Java’s Next Act: Native Speed for a Cloud-Native World
  • A Guide to Developing Large Language Models Part 1: Pretraining
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Jenkins Configure Master and Slave Nodes

Jenkins Configure Master and Slave Nodes

Learn about the importance of the master and slave nodes and set up a sample freestyle project.

By 
Krishna Prasad Kalakodimi user avatar
Krishna Prasad Kalakodimi
·
Nov. 19, 19 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
177.9K Views

Join the DZone community and get the full member experience.

Join For Free

matryoshka doll

Take a look at master and slave nodes in Jenkins.

Jenkins Master and Slave Concept

A Jenkins master comes with the basic installation of Jenkins, and in this configuration, the master handles all the tasks for your build system.

You may also enjoy:  Getting Started With Jenkins: The Ultimate Guide

If you are working on multiple projects you may run multiple jobs on each and every project. Some projects need to run on some particular nodes, and in this process, we need to configure slaves. Jenkins slaves connect to the Jenkins master using the Java Network Launch Protocol.

Jenkins Master and Slave Architecture

Jenkins slave and master architecture


The Jenkins master acts to schedule the jobs and assign slaves and send builds to slaves to execute the jobs.

It will also monitor the slave state (offline or online) and getting back the build result responses from slaves and the display build results on the console output. The workload of building jobs is delegated to multiple slaves.

Steps to Configure Jenkins Master and Slave Nodes

  1. Click on Manage Jenkins in the left corner on the Jenkins dashboard.
  2. Click on Manage Nodes.Manage Nodes
  3. Select New Node and enter the name of the node in the Node Name field.
  4. Select Permanent Agent and click the OK button. Initially, you will get only one option, "Permanent Agent." Once you have one or more slaves you will get the "Copy Existing Node" option.Node options
  5. Enter the required information.

Some required fields include:

Name: Name of the Slave. e.g: Test

Description: Description for this slave (optional). e.g: testing slave

# of Executors: Maximum number of Parallel builds Jenkins master perform on this slave. e.g: #2

Remote root directory: A slave needs to have a directory dedicated to Jenkins. Specify the path to this directory on the agent. e.g: /home/

Usage: Controls how Jenkins schedules builds on this node. e.g: Only build jobs with label expressions matching this node.

Launch method: Controls how Jenkins starts this agent. e.g: Launch agent agents via SSH

6. Enter the Hostname in the Host field.

7. Select the Add button to add credentials. and click Jenkins.

8. Enter Username, Password, ID, and Description.Fields to enter

9. Select the dropdown menu to add credentials in the Credentials field.

10. Select the next dropdown to add the Host Key Verification Strategy under Non verifying Verification Strategy.

11. Select Keep this agent online as much as possible in the Availability field.Configuration

12. Click the Save button.

Master and slave


Creating a Freestyle Project and Running on The Slave Machine

  1. Click on Save  and it will redirect to job's view page
  2. On the left pane, click the Build Now button to execute your Pipeline.
  3. We can verify the history of the executed build under the Build History by clicking the build number.
  4. Click on the build number and select Console Output. Here you can see the executed job in the remote host and output.Console output

Creating a Pipeline and Running on The Slave Machine

  1. Click New Item in the top left corner on the dashboard.
  2. Enter the name of your project in the Enter an item name field, and select the Pipeline project, and click OK button.
  3. Enter Description (optional).
  4. Go to the Pipeline section, make sure the Definition field has the Pipeline script option selected.
  5. Copy and paste the following declarative Pipeline script into a script field.
node('test'){
stage('stage1') {
sh '''echo  stage1 steps'''
}
stage('stage2') {
sh '''echo stage2 steps'''
}
stage('stage3') {
sh '''echo stage3 steps'''
}
}

Pipeline

6. Click on Save, it will redirect to the Pipeline view page.

7. On the left pane, click the Build Now button to execute your Pipeline.

8. After Pipeline execution is completed, the Pipeline view will be as shown below.

9. We can verify the history of executed build under the Build History by clicking the build number.

10. Click on build number and select Console Output. Here you can see that the pipeline ran on a slave machine.

Jenkins output

Further Reading


Continuous Delivery With Jenkins Workflow

A Getting Started Guide to Setting up Jenkins

Jenkins (software) master Continuous Integration/Deployment

Opinions expressed by DZone contributors are their own.

Related

  • Jenkins in the Age of Kubernetes: Strengths, Weaknesses, and Its Future in CI/CD
  • DORA Metrics: Tracking and Observability With Jenkins, Prometheus, and Observe
  • An Explanation of Jenkins Architecture
  • Implementing CI/CD Pipelines With Jenkins and Docker

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!