This Video Tutorial Explains Master Slave Configuration in Jenkins:
In our previous tutorial, we have learned about Jenkins Plugin, it’s different types, and how to install them.
In this tutorial we will be covering: Distributed Builds, Slave Machines, Configure Jenkins’s Master, Activating slave node.
=> Explore The Simple Jenkins Training Series Here
Table of Contents:
Video Tutorial – Jenkins Master Slave Configuration
Here is a Video Tutorial:
Distributed Builds
One of the best features of Jenkins is distributed builds. It basically allocates the different jobs to various machines. This helps in distributing the load as well as run the build on different environments.
Jenkins follows the master-slave configuration to allow distributed builds. Also, the master is the one in which the Jenkins jar is launched. A slave node can be any machine like Windows OS, Linux, etc. A small jar file is required to launch the slave node.
Slave Machine
To create the slave node follow the below steps:
#1) Log in to Jenkins.
#2) Click on Manage Jenkins and Manage Nodes after that as shown in Figure 1.
#3) Click on New Node as shown in Figure 2.
#4) Type the Node Name, Click on Permanent Agent and then click OK as shown in Figure 3 below.
Figure 3: Figure showing node name, type of node.
#5) Click on the Node created and then click on Configure as shown in Figure 4 below.
#6) Fill in the details for the following fields in the Configure page:
- Name.
- Description.
- The number of executors.
- Create a folder in the slave machine named Jenkins and give the path to it in the Remote root directory.
- Select the desired Usage.
- Select the desired Launch method.
- Select the desired Availability.
A sample example is shown in Figure 5 below.
Figure 5: Figure showing the configured values.
#7) Also, in the Tool Locations section, give the path values of the bin for maven and jdk in slave as shown in Figure 6 below.
#8) Click on Save.
This is how a Slave machine is created and configured.
Configuring Jenkins Master
If the slave machine is setup in a virtual machine then following shows the configuration steps:
#1) Install virtual box plugin:
- Run Jenkins
- Click Manage Jenkins and Manage plugins.
- Click the Available tab.
- Type virtual box plugin in the filter.
- Install the plugin.
#2) In Windows, add ‘C:\Program Files\Oracle\VirtualBox\;’ in Windows Environment Variables. Open the command prompt in Master machine and type:
VBoxManage setproperty websrvauthlibrary null
Vboxwebsrv
#3) Launch the http://localhost:18083 URL after this.
#4) Go to Manage Jenkins->Configure System.
#5) Go to the cloud section and fill in the values for Name and URL fields as shown in Figure 7.
Activating The Slave Node
(i) First, download the agent.jar.
(ii) Next, launch the terminal and type in
java -jar agent.jar -jnlpUrl http://localhost:8080/computer/VirtualNode1/slave-agent.jnlp -secret fc4db39624df7692e0e2b43f77c1343f9f9f804502e8ab2eea770af33f67f9f9 -workDir “/home/kundana/Desktop/Jenkins”
(iii) This will activate the slave node and the connection is established.
Conclusion
In this tutorial, we have learned about distributed builds and its benefits, Slave machine configuration, Configuring Jenkins Master, to set up the connection between master and slave.
=> Visit Here To Learn Jenkins From Scratch