Can i run master and slave on same machine

8,759 views
Skip to first unread message

Varghese Renny

unread,
Jun 26, 2012, 10:53:33 PM6/26/12
to jenkins...@googlegroups.com

I have a doubt regarding, if multipe jobs are there ,is it better to distribute build on slave or
do it on master itself?
if i can do master and slave? how can i implement this?

Mark Waite

unread,
Jun 27, 2012, 10:26:03 AM6/27/12
to jenkins...@googlegroups.com
The simplest answer to your "Can I run master and slave on the same machine" is "Yes".  The challenging part of the question is "Why?"

The subject line seems to hint that you are considering running a master and a slave on the same machine.  It certainly can be done.  Whether it should be done depends on your reason for wanting to use a slave.

The Jenkins master can run multiple jobs in parallel so long as you allow have enough executors defined on the master node to host your parallel jobs.  If the master machine has enough compute power to perform all the parallel jobs, then executing all the jobs on the master node is simpler because it is easier to administer one machine (the master) than two machines (the master and the slave).

If the master machine does not have enough compute power to perform all the parallel jobs, then additional computers can be added as slave nodes to add compute power.

Another use of master and slave is when different configurations are needed.  For example, I have a master node that is 64 bit Linux and slave nodes for 32 bit Linux, 32 bit Windows, and 64 bit Windows.  I couldn't run that configuration without master and slave setups.

I believe others have used a slave configuration to create a separate configuration even on the same machine.  That is not a technique I've used, but I've considered it, possibly using a slave running in a chroot environment on a Linux machine to simulate a different configuration without actually running on a different machine.

It is also possible to run a master and a slave on the same machine simply by configuring the slave node to use a different home directory than the master node.  I'm not sure why you would do that, but it can be done.

Mark Waite




From: Varghese Renny <varghes...@gmail.com>
To: jenkins...@googlegroups.com
Sent: Tuesday, June 26, 2012 8:53 PM
Subject: Can i run master and slave on same machine

Varghese Renny

unread,
Jun 27, 2012, 11:17:47 AM6/27/12
to jenkins...@googlegroups.com


i have only 5 projects to run.But i run all this project on tomcat server using jenkins. 5 project means 5 web applications which are accessing five different database.So five jenkin job on one tomcat server and i need five other tomcat instance for five application to make up. Since while build is running i have to stop these five tomcat.

For running application on different tomcat  whether i needed to use five slave or slave is only used for distributing build?
Can i create one slave in same machine to run application only?

Mark Waite

unread,
Jun 27, 2012, 11:44:44 AM6/27/12
to jenkins...@googlegroups.com
I'm not a tomcat user, so I can only guess how it might work in the case you're describing.
 
If each of your tomcat servers runs on a different port or ports, and if your master node has sufficient processing power to run all the tomcat and related processes in parallel, then you can run them on the master. 
 
If any of the tomcat servers are required to use the same port as another tomcat server, then you'd need to use a second machine (I think).
 
Wouldn't it be easiest to "try it and see what happens"?  Jenkins is easy to install and run.  I suspect you'll learn faster and discover more if you configure one of your projects on the master node (just enough to see that it works), then configure a second project on the master node, and confirm that it works for both the first job and the second job.  If you detect collisions, that means you either need to resolve the collisions, or use a slave.
 
Mark Waite

giuliano

unread,
Jun 27, 2012, 7:41:59 PM6/27/12
to jenkins...@googlegroups.com
Yes, you can run master(s) and slave(s) on the same machine.

As Mark says though: there are few reasons to do so. I do it so I can control a VM from the slave, including taking snapshots, reverting to snapshots, and doing reboots.

Based on what you say later (5 webapps each of which binds to a different database) you can probably do this all on the master. Provided the master has enough resources. And to make it more complex, there's more than one way to do it ;-> I'll suggest one. Create how ever many executors you want. Bind each to a tomcat and db instance. Each tomcat and db will obviously be listening to different IP addresses or ports. At the start of the job set up tomcat and the db instance to a known state. Then run the application.

Varghese Renny

unread,
Jun 28, 2012, 2:46:51 AM6/28/12
to jenkins...@googlegroups.com

For running slave, first i need to setup jenkins instance on slave machine. After installing jenkins on slave machine
then slave will automatically act as master right?
Is there any UI for slave machine? or we are just using machine power?
Can anyone suggest some url regarding this ?

What makes jenkins UI seperate from Slave jenkins UI?

PLEASE REPLY..
THANKS IN ADVANCE





Mandeville, Rob

unread,
Jun 28, 2012, 12:42:41 PM6/28/12
to jenkins...@googlegroups.com

You don’t need to set up a Jenkins server instance on the slave machine.  You will need to set up a slave instance, and that will connect to the Jenkins server.  There are several ways to launch slaves, documented at https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds.

 

Slaves don’t have their own UI; you configure them with the Jenkins server.  Depending on the launch method, either the Jenkins server will connect to the remote machine and launch a slave, or the remote machine will launch a slave to connect to the Jenkins server to get its configuration.  Either way, the slave is running on the remote machine and will consume the resources of that machine, _not_ the resources of the machine the Jenkins server is running on.  The server process will send it marching orders (inexpensive) and collect and store the output logs in real time (expensive, depending on how much output your jobs are writing).

 

If your slave is just doing command-line type stuff (running scripts, Maven builds, Ant jobs, etc.), any method of launching the slave will do.  If your slave is launching and/or interacting with GUIs (often done in Windows testing), you will have to be careful to launch the slave in such a way that it can take over the GUI.  The page above suggests using Java Web Start (JLNP).

 

Hope this helps!

 

--Rob Mandeville

 

From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of Varghese Renny
Sent: Thursday, June 28, 2012 2:47 AM
To: jenkins...@googlegroups.com
Subject: Re: Can i run master and slave on same machine

 

The information in this message is for the intended recipient(s) only and may be the proprietary and/or confidential property of Litle & Co., LLC, and thus protected from disclosure. If you are not the intended recipient(s), or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication is prohibited. If you have received this communication in error, please notify Litle & Co. immediately by replying to this message and then promptly deleting it and your reply permanently from your computer.

Huzz Sto

unread,
Sep 26, 2017, 11:38:57 AM9/26/17
to Jenkins Users
can Jenkins master and slave run on different network. or they both have to be on the same network.

Mark Waite

unread,
Sep 26, 2017, 3:44:43 PM9/26/17
to jenkins...@googlegroups.com
On Tue, Sep 26, 2017 at 9:38 AM Huzz Sto <huzz...@gmail.com> wrote:
can Jenkins master and slave run on different network. or they both have to be on the same network.


So long as master and agent can communicate, they can run on separate networks.

Mark Waite
 
On Tuesday, June 26, 2012 at 10:53:33 PM UTC-4, Varghese Renny wrote:

I have a doubt regarding, if multipe jobs are there ,is it better to distribute build on slave or
do it on master itself?
if i can do master and slave? how can i implement this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/96487999-807f-46da-b466-9a0a762166ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nehal Abdelhafez

unread,
Aug 6, 2018, 12:42:55 AM8/6/18
to Jenkins Users

can you just tell me how i can run master and slave on the same machine i have install and run a master and i cant make the slave join it gives error "file avaliable " thanks in advance

Amit Ghatwal

unread,
Aug 6, 2018, 4:35:20 AM8/6/18
to Jenkins Users
I have set up a single machine to run as jenkins- master+slave successfully many a times , been able to deploy jobs successfully as well  on the machine at "Remote root directory" for the added slave node .Every job deployed creates a folder with the job name .  Can you elaborate more on where exactly ur getting this message - 'file available" , any launch methods which is giving this message - JNLP, SSH , webstart, etc. ?

Mark Waite

unread,
Aug 6, 2018, 8:30:46 AM8/6/18
to jenkins...@googlegroups.com
Refer to https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows or https://stackoverflow.com/questions/24962504/adding-a-slave-to-jenkins  or http://scmquest.com/jenkins-master-slave-setup-and-configuration-with-screenshots/ or http://scmquest.com/jenkins-windows-slave-configuration-with-screenshots/ .

If those don't solve the issue you're seeing, you'll need to provide more details about the error "file available", including the steps you took with precede that error and the alternatives you've tried to resolve the error.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages