New Tutorials:   TKINTER    KOTLIN    JAVASCRIPT    SASS/SCSS    PL/SQL    Matplotlib    C++ Programs
See the Tutorial List

Jenkins Master Slave Configuration

Jenkins is an awesome Continuous Integration tool which allows you to add multiple slaves as per your project requirement to a central Master server.

In distributed environment, we need different machines for different purposes. For example, we may need machine1(Ubuntu) to run some process and machine2(CentOS) to run some other process. For such distribution, Jenkins Master Slave configuration comes to the rescue.

Let us consider an example to have better understanding about Master Slave configuration in Jenkins.

Considering Machine1 as a master where we deployed Jenkins set up.

  1. Go to url http://localhost:8080 in your browser, if Jenkins runs on localhost. Login using your credentials and click on Manage Jenkins option.
  2. Jenkins Master Slave Configuration

  3. Then click on the option Manage Nodes.
  4. Jenkins Master Slave Configuration

  5. Click on the option New Node in the left menu.
  6. Jenkins Master Slave Configuration

  7. Provide a name for your slave node. For this example, we have named our slave machine as Slave1. Check the option Permanent Agent, and click on OK.
  8. After Clicking OK, following configuration page will appear for machine Slave1.

    Jenkins Master Slave Configuration

    Values for following configurations must be mentioned for setting up the slave machine:

    • Description: The purpose of Node.
    • # of executors: The maximum number of concurrent build that Jenkins may perform on this agent.
    • Remote root directory: The path or directory of the agent machine(example: complete-path/slave1).
    • Launch Method: Select Launch agent via Java Web Start. If you fail to find this option, go to Manage Jenkins → Configure Global Security and make sure that radio button Random is selected for TCP port for JNLP agents and Enable Slave → Master Access Control is checked.
  9. Jenkins Master Slave Configuration

  10. After selecting Launch Method as Launch agent via Java Web Start, save changes. Following page will appear and then Logout of Jenkins.
  11. Jenkins Master Slave Configuration

    Note: Make sure in Manage Jenkins → Configure System, in the field Jenkins URL provide machine name instead of localhost (If not changed then it will consider the name as localhost for all agents while making JNLP and will bound to create error.

    Jenkins Master Slave Configuration

  12. Now, Login Jenkins Slave machine. Go to, Manage Jenkins → Manage Nodes, we will find our created Node Slave1.
  13. Jenkins Master Slave Configuration

  14. Click on it and you will see the following screen:
  15. Jenkins Master Slave Configuration

  16. Then click on Launch, a file named slave-agent.jnlp will be downloaded. Run the slave-agent.jnlp by double clicking on it. Following pop up will appear,
  17. Jenkins Master Slave Configuration

    Click on Run

  18. A new popup window will appear with the message Connected.
  19. Jenkins Master Slave Configuration

  20. To install the slave agent as a window service, click on the File menu option and choose the option Install as a service.
  21. Jenkins Master Slave Configuration

  22. Now, check the browser, you will find that, Agent Slave1 is connected via JNLP agent.
  23. Jenkins Master Slave Configuration