简体   繁体   English

Jenkins主从配置

[英]Jenkins Master-Slave Configuration

I'm starting to work with Jenkins , I'm a newbie, and I have a question regarding Master-slave configuration . 我开始与Jenkins ,我是新手,并且对Master-slave 配置有疑问。 How's usually used? 通常如何使用? Is it one slave per application ( ie: 3 applications, 3 slaves )? 每个应用程序是否有一个从站ie: 3 applications, 3 slaves )?

PS: If you point me to a good Jenkins tutorial, will be appreciate it PS:如果您将我Jenkins一个不错的Jenkins教程,将不胜感激

First, my recommendation is to disable all the executors on the master and to build only on slaves. 首先,我的建议是禁用主服务器上的所有执行器,并仅在从服务器上构建。

On our Jenkins platform, we are using 7 CentOS slaves (VM) for the Maven builds (one executor per node). 在我们的Jenkins平台上,我们使用7个CentOS从站(VM)进行Maven构建(每个节点一个执行程序)。 These slaves have the same Jenkins label ("build linux" for example). 这些从站具有相同的Jenkins标签(例如,“ build linux”)。 All the Maven projects are restricted to this "build linux" label: https://serverfault.com/questions/359793/tell-jenkins-to-run-a-specific-project-on-a-particular-slave-node 所有Maven项目都限于此“ build linux”标签: https : //serverfault.com/questions/359793/tell-jenkins-to-run-a-specific-project-on-a-particular-slave-node

We also have dedicated slaves per platform (Linux 32bits, Linux 64bits, AIX 6, AIX 7, Windows 2008 R2, Windows 2012). 每个平台我们还具有专用的从属服务器(Linux 32位,Linux 64位,AIX 6,AIX 7,Windows 2008 R2,Windows 2012)。

If you need to deploy your applications on dedicated Application Servers (Tomcat, Weblogic, ...), you can create one slave per platform. 如果需要在专用的应用程序服务器(Tomcat,Weblogic等)上部署应用程序,则可以在每个平台上创建一个从属服务器。

Using Jenkins label is really useful to distribute your builds on the relevant slaves. 使用Jenkins标签对在相关奴隶上分发您的构建非常有用。

First recommendation is to use at least one slave and not use the master for building. 第一个建议是至少使用一个从属设备,而不要使用主设备进行构建。

Read https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds (first answer when googling "jenkins master slave tutorial"). 阅读https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds (谷歌搜索“ jenkins主从教程”时的第一个答案)。

Then, add as much slaves as you want to distribute the load. 然后,根据需要分配尽可能多的从站。 The load does not directly depends on the number of "applications" but on the number of simultaneous builds and available slaves to perform those builds (you may have multiple jobs for a unique application). 负载不直接取决于“应用程序”的数量,而是取决于同时构建的数量和可用的从属来执行那些构建(对于一个唯一的应用程序,您可能有多个作业)。 Typically, you will add slaves if your builds are " pending " for too much time: see https://wiki.jenkins-ci.org/display/JENKINS/Executor+Starvation 通常,如果构建“ pending ”时间过多,您将添加从属:请参阅https://wiki.jenkins-ci.org/display/JENKINS/Executor+Starvation

Tie the jobs to labels rather than directly to the slaves. 将作业绑定到labels而不是直接绑定到从属。

You will obviously have different slaves per build environment. 每个构建环境显然会有不同的从属。

If your build is isolated enough and it is not multi-threaded, then it is also recommended to set about as much executors as core CPU. 如果您的构建足够隔离并且不是多线程的,则还建议设置与核心CPU一样多的执行程序。 That is to make use of the slave resources; 那就是利用从属资源; another solution is to use virtualization, containers (VM, docker...) as slaves with one executor per slave. 另一个解决方案是将虚拟化,容器(VM,docker ...)用作从属设备,每个从属设备都有一个执行程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM