Step by step guide to set up master and slave machines on Windows
Note: There is no need to install Jenkins on the slave machine.
- On your master machine go to Manage Jenkins > Manage Nodes.
- New Node --> Enter Node Name.
- Select Dumb Slave --> Press OK.
- Fill out the following:
- Set a number of executors (one or more) as needed.
- Set a Remote FS Root, a home directory for the master on the slave machine.
- For a Windows slave, use something like: "C:\Jenkins\"
- TODO: add details.
- Select the appropriate Usage setting:
- For an additional worker: Utilize this slave as much as possible
- For specialized jobs: Leave this machine for tied jobs only
- Launch Method:
- An easy way to control a Windows slave is by using Launch slave agents via Java Web Start (Recommended for Windows)
- TODO: add steps for other methods.
- Availability --> Keep this slave online as much as possible
- TODO: add details for each option.
- Press OK.
- Now you need to connect your slave machine to the master using the following steps.
- Open a browser on the slave machine and go to the Jenkins master server url (http://yourjenkinsmaster:8080).
- Go to Manage Jenkins > Manage Nodes, Click on the newly created slave machine. You will need to login as someone that has the "Connect" Slave permission if you have configured global security.
- Click on the Launch button to launch agent from browser on slave.
- Run the program.
### If you encounter connection issue, then you could enlarge the popup windows to see the master port used and check your network configuration (firewall, port forward, ...)
- Now you should see the Slave machine connected under Nodes.
- If you want the service to run on start-up of the slave machine do the following (Windows only directions):
- In the Slave agent program running on your slave machine,
- click File --> Install as Windows Service.
Note that this feature requires ".Net Framework 3.5" - Start, type Services and Select the Services program.
- Find Jenkins Slave in the list, Double click to open.
- Select Startup type --> Automatic.
- Go to the Log On tab, change the Log on as to a user of your choice (Special user account Jenkins recommended).
- Make sure that auto login is set for the slave machine for the user account, then the VM (or physical computer) should connect and be available when needed.
Also: take a look at Distributed builds
https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows
slave节点机器配置
创建jenkins用户
用root用户登录slave节点,首先创建jenkins用户,并指定主目录
$ useradd -m jenkins -d /home/jenkins
查看jenkins用户及组的信息
$ id jenkins
uid=500(jenkins) gid=500(jenkins) 组=500(jenkins)
再修改jenkins密码,若不修改是未知的
$ passwd jenkins
再切换到jenkins用户,确保jdk已安装
$ su - jenkins
同时确保slave已安装jdk
$ java -version
且sshd正确运行
$ service --status-all | grep ssh
创建公钥私钥,实现免用户密码登录
使用jenkins用户登录到jenkins master机器
使用jenkins用户登录时若发现连接失败(lost connection),可以先用root用户登录,打开/etc/passwd,找到
jenkins:x:498:499:Jenkins Continuous Integration Server:/var/lib/jenkins:/bin/false
将最后的/bin/false改为/bin/bash,便可以登录。记得使用完改回去,猜测是安全限制。
jenkins用户登录后执行以下命令,生成公私钥
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /var/lib/jenkins/.ssh/id_rsa
将公钥和私钥保存到jenkins主目录下,注意确保.ssh目录和id_rsa都是jenkins用户所拥有或者有可读写权限
然后会要求输入passphrase(密码),这里还是不设置,直接两次enter
进入/var/lib/jenkins/.ssh,使用scp命令将生成的公钥id_rsa.pub拷贝到各个slave节点,并命名为authorized_keys
$ scp id_rsa jenkins@xxx.xxx.xxx.xxx:~/.ssh/authorized_keys
同时要修改authorized_keys的权限,
$ chmod 700 authorized_keys
Jenkins控制台slave配置
回到jenkins控制台,打开以下页面,添加credentials,以下配置页面是添加slave的jenkins用户密码
另一种ssh免密码登录配置(基于公开密钥的认证),可指定jenkins master私钥的路径或者选择第三个From the Jenkins master ~./ssh,我们选择/var/lib/jenkins/.ssh/id_rsa,这是在上一节创建的私钥
创建slave
进入“系统管理>管理节点>新建节点”,输入节点名称,我已经建了一个节点,所以可以选择复制
进入配置页面,按要求填写,credentialsp这里选择用户密码登录,免密码登录需要指定一个属于它的id_rsa。
保存之后,点击Relaunch agent,启动节点
https://segmentfault.com/a/1190000008369457
作为slave的Linux机器为centos系统。
1) Linux 的 Slave机器设置
创建jenkins用户sudo /usr/sbin/useradd -m jenkins -d /home/jenkins;
查看jenkins用户及组的信息id jenkins :
uid=506(jenkins) gid=506(jenkins) groups=506(jenkins) ;
使用sudo /usr/bin/passwd jenkins来设置用户jenkins的密码为0;
切换到用户jenkins环境下su - jenkins;
确保java安装正确:java --version;
确保sshd正确运行: /sbin/service --status-all | grep ssh;
安装ant,在root下运行yum install ant;
2) 在Slave的linux机器上创建public/private key pair:
确保当前用户为jenkins;
执行ssh-keygen来创建public/private key pair,直接enter,表示key将存储在/home/jenkins/.ssh/id_rsa下,再直接enter,表示不设置密码,再次enter确认密码为空;
创建authorized_keys:
cd .ssh
cat id_rsa.pub > authorized_keys
chmod 700 authorized_keys
;
将id_rsa(相当于privatekey)拷贝到jenkins master机器上,例如c:\jenkins\id_rsa下。
3)创建Slave(note),配置如下:
确保jenkins 中ssh slave plugin正确安装,一般默认安装。
然后lunch slave,使得master和slave通过ssh成功连接。其实launch的时候jenkins自动地从http://yourserver:port/jnlpJars/slave.jar拷贝slave.jar到slave,然后运行通过命令java -jar slave.jar来运行slave。
4)在新建的Linux的Slave上运行上节中的JavaHelloWorld(Jenkins 构建JavaHelloWorld),且需要修改JavaHelloWorld job的Label为JavaHelloWorldLinux来使用此slave,运行如下:
完!
http://www.cnblogs.com/itech/archive/2011/11/10/2244690.html
Step by step guide to set up master and slave machines on Windows的更多相关文章
- Step by step guide to set up master and slave machines(转)
Note: There is no need to install Jenkins on the slave machine. On your master machine go to Manage ...
- Tomcat Clustering - A Step By Step Guide --转载
Tomcat Clustering - A Step By Step Guide Apache Tomcat is a great performer on its own, but if you'r ...
- Step by Step use OBD2 Scanner Guide
Learning to use a good automotive OBD2 code reader is one of the best ways you can continually inves ...
- Step by step Dynamics CRM 2011升级到Dynamics CRM 2013
原创地址:http://www.cnblogs.com/jfzhu/p/4018153.html 转载请注明出处 (一)检查Customizations 从2011升级到2013有一些legacy f ...
- [转]Bootstrap 3.0.0 with ASP.NET Web Forms – Step by Step – Without NuGet Package
本文转自:http://www.mytecbits.com/microsoft/dot-net/bootstrap-3-0-0-with-asp-net-web-forms In my earlier ...
- Devops step by step
接着上次分享的devops历程[Followme Devops实践之路], 大家希望能够出一个step by step手册, 那今天我就来和手把手来一起搭建这么一套环境, 演示整个过程! 实验环境需要 ...
- PyTorch in Action: A Step by Step Tutorial
PyTorch in Action: A Step by Step Tutorial PyTorch in Action: A Step by Step Tutorial Installation ...
- Git Step by Step – (8) Git的merge和rebase
前面一篇文章中提到了"git pull"等价于"git fetch"加上"git merge",然后还提到了pull命令支持rebase模式 ...
- Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1)
Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1) AP ...
随机推荐
- 嵌入式C快速翻转一个任何类型的数的二进制位
unsigned char reverse_bits(unsigned char value) { unsigned char answer , i ; answer = 0 ; for(i = 1 ...
- C语言之将无符号字符型转化为ascii码值
这个宏是在linux内核中获取的,主要的功能是能够将一个无符号字符型的参数转化为ASCII码值. ASCII : ASCII 编码里包括了128个字符.用 十进制 0 到 127 来表示 .那就对了 ...
- PS 滤镜——旋转模糊
这里给出灰度图像的模糊算法,彩色图像只要分别对三个通道做模糊即可. %% spin blur % 旋转模糊 clc; clear all; close all; I=imread('4.jpg'); ...
- linux内核中访问共享资源
访问共享资源的代码区域称为临界区,临时以某种互斥机制加以保护.中断屏蔽.原子操作 自旋锁和信号量是Linux设备驱动中可采用的互斥途径. 在单CPU范围内避免竞态的一种简单方法是在进入临界区之前屏蔽系 ...
- SQLSERVER 性能优化之Perfmon指标
Perfmon是Windows系统性能监视程序.用于监视CPU使用率.内存使用率.硬盘读写速度.网络速度等. Processor/%Privileged Time阀值:如果数值持续大于75%就表示存在 ...
- javascript简单介绍
ECMAScript 1.语法 2.变量:只能使用var定义,如果在函数的内容使用var定义,那么它是一个局部变量,如果没有使用var它是一个全局的.弱类型! 3.数据类型:原始数据类型(undefi ...
- c语言 基本运算
计算机的基本能力就是计算,所以一门程序设计语言的计算能力是非常重要的.C语言之所以无所不能,是因为它不仅有丰富的数据类型,还有强大的计算能力.C语言一共有34种运算符,包括了常见的加减乘除运算.这讲就 ...
- 不同场景下使用CSS隐藏元素
使用 CSS 让元素不可见的方法很多,剪裁.定位到屏幕外.明度变化等都是可以的.虽然它们都是肉眼不可见,但背后却在多个维度上都有差别. 元素不可见,同时不占据空间.辅助设备无法访问.不渲染 使用 sc ...
- HttpContext未null处理
public static HttpContext Current { get { if (instance.Value == null) { instance = new ThreadLocal&l ...
- FFPLAY的原理(一)
概要 电影文件有很多基本的组成部分.首先,文件本身被称为容器Container,容器的类型决定了信息被存放在文件中的位置.AVI和Quicktime就 是容器的例子.接着,你有一组流,例如,你经常有的 ...