LightBlog

Jenkins - Master and Slave Architecture


Master:

·         Schedule build jobs.
·         Dispatch builds to the slaves for the actual job execution.
·         Monitor the slaves and record the build results.
·         Master node itself can execute the build if slave node is not configured explicitly in the build job configuration

Slave:

·         Execute build jobs dispatched by the master.

We don’t need to install Jenkins in the slave nodes. We only need to configure slave node properly.

The only requirements are:
·         Configurations and Runtime Environment has to be available on the slave node.
·         Path needs to be configured correctly on Master node for Runtime. Environments or tools used by slave node for execution


Creating Slave machine
I am uing vagrant Ubuntu/trusty64 as slave machine

1.we need to upload the key 'id_rsa.pub' from the master to slave server nodes. We need to upload to each server nodes using command as below.
scp id_rsa vagrant@192.168.0.104:~/.ssh
scp id_rsa.pub vagrant@192.168.0.104:~/.ssh


2.Install Java on Slave
Install the 'software-properties-common' packages and add the java PPA repository
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
java -version


3.Install Maven on Slave
apt-cache search maven
sudo apt-get install maven
mvn -version


4.Add Slave node
Dashboard > Manage Jenkins > Manage Nodes > New Node
·         Name: Slave-01-Ubuntu
·         Remote root directory: /home/vagrant
·         Launch method: Launch slave agent via SSH, type the host ip address 192.168.0.104


Vagrant-Ubuntu Credentials: Credentials > Add, then select added credentials


4.Configure Git, Java, Maven locations in Slave Node
To get Locations of Tools in Ubuntu system run below cmds
vagrant@vagrant-ubuntu-trusty-64:~$ which git
/usr/bin/git
vagrant@vagrant-ubuntu-trusty-64:~$ which java
/usr/bin/java
vagrant@vagrant-ubuntu-trusty-64:~$ which mvn
/usr/bin/mvn

Go To Manage Jenkins > Manage Nodes > Select: Slave Node > Configure > Tool Locations

5.Build the Job, it will run on  Slave node.

Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 comments:

Post a Comment