如何设置新的Jenkins从站 [英] How to set up new Jenkins slave

查看:417
本文介绍了如何设置新的Jenkins从站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近继承了一个Jenkins驱动的Java项目,其中主要的开发人员刚刚升级并退出。他已经将Jenkins WAR部署到虚拟服务器上的Tomcat实例上,这就是所谓的构建服务器。

I recently inherited a Jenkins-driven Java project where the primary developer just upped and quit. He had deployed the Jenkins WAR to a Tomcat instance on a virtual server, and that is what was considered to be the "build server".

这个构建服务器有一个slave配置为构建和部署到 myserver.example.com ,另一个虚拟服务器。在周末,系统工作人员退出了 myserver.example.com 虚拟所在的物理服务器,为配置为部署到该从属的任何Jenkins作业生成以下异常:

This build server had a slave configured for building and deploying to myserver.example.com, another virtual server. Over the weekend, the systems staff retired the physical server that the myserver.example.com virtual lived on, producing the following exception for any Jenkins job configured to deploy to that slave:

>

当我点击查看日志了解详情链接,我看到以下控制台输出:

When I click on the "See log for more details" link I see the following console output:

[03/18/13 08:13:31] [SSH] Opening SSH connection to myserver.example.com:22.
java.io.IOException: There was a problem while connecting to myserver.example.com:22
    at com.trilead.ssh2.Connection.connect(Connection.java:755)
    at com.trilead.ssh2.Connection.connect(Connection.java:546)
    at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:650)
    at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:283)
    at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:200)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.NoRouteToHostException: No route to host
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:529)
    at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:342)
    at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:450)
    at com.trilead.ssh2.Connection.connect(Connection.java:699)
... 9 more
[03/18/13 08:13:34] [SSH] Connection closed.

这是有道理的,因为从属( myserver.example.com virtual)is offline。然而,没有真正的Jenkins以前的经验,我不知道什么适当的步骤是配置Jenkins主人来构建/部署这些工作到一个新的奴隶,以及如何设置新的奴隶。例如,我需要在新的从服务器上安装任何东西,或者做任何类型的设置/配置?提前感谢!

This makes sense, since the slave (the myserver.example.com virtual) is offline. However, having no real previous experience with Jenkins, I'm not sure of what the proper steps are for configuring the Jenkins master to build/deploy these jobs to a new slave, and how to set up the new slave. For instance, do I need to install anything on the new slave, or do any kind of setup/config? Thanks in advance!

推荐答案

在Jenkins中添加一个slave非常简单。基本上,如果您使用unix从属设备,则需要SSH访问机器。您还需要安装 Jenkins SSH Slaves插件。找到之后,请转到上的管理Jenkins 选项,然后选择管理节点

Adding a slave in Jenkins is pretty simple. Basically, if you are using a unix slave, you need SSH access to the machine. You also need to have the Jenkins SSH Slaves plugin installed. Once you have that, go to the Manage Jenkins option on your Master and choose Manage Nodes.

这样的步骤是:


  1. 点击新节点
  2. 选择 Dumb Slave ,并为其指定名称(符号,不需要是域名,稍后即可)

  3. 到配置页

  4. 在该节点上填入执行者数(同时进行的进程数量通常不超过分配的数量CPU核心)

  5. 使用Jenkins存储工作文件的完整路径填写远程FS根

  6. 如果您在系统中使用这些标签,则可以选择添加标签(在许多情况下并非必需,但您的项目可能要求节点在特定作业的执行程序池中具有某些标签)

  7. 启动方法下选择在Unix计算机上通过SSH启动从属代理(如果尚未选择)

  8. 将完全限定的域名放在启动方法行下的主机字段中

  1. Click New Node
  2. Select Dumb Slave and give it a name (symbolic, doesn't need to be the domain name, that comes later)
  3. Click OK and proceed to the configuration page
  4. Fill in the # of executors with the number of simultaneous processes you want to run on that node (usually not more than the number of allocated CPU cores)
  5. Fill in the Remote FS Root with the full path to where you want Jenkins to store its working files
  6. Optionally add Labels if you are using those in your system (not necessary in many cases, but your Projects may require nodes have certain labels to be in the pool of executors for specific jobs)
  7. Select Launch slave agents on Unix machines via SSH under Launch Method (if not already selected)
  8. Put the fully-qualified domain name in the Host field which appears under the Launch Method line

有关于在从站上安装的工具的一些假设。如果您有专用工具,可能需要单独安装它们(或者在执行之前查看处理移动工具的插件)。但是,如果你的节点是建立在一个模板,它有所有的构建工具(在你的情况下的java,ant等),那么这将是所有你需要做的事情去。

There are some assumptions about the tools that are installed on the slave. If you have specialized tools, you may need to install them separately (or look at plugins that handle moving tools over immediately prior to execution). However, if your nodes are built off of a template which has all of your build tools on them (java, ant, etc in your case probably), then this will be all you need to do to get things going.

这篇关于如何设置新的Jenkins从站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆