一.环境说明
操作系统:centos7
jenkins:2.204
java:1.8
主机名 | IP地址 | 类型 |
---|---|---|
root@jenkins-master | 192.168.1.191 | masters |
root@jenkins-slave01 | 192.168.1.192 | slave01 |
二.部署jenkins服务
# 两台服务器都要部署jenkins服务,部署方式:https://blog.csdn.net/qq_36783142/article/details/104516447
[root@jenkins-master jenkins]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: active (running) since 三 2020-02-26 13:16:41 CST; 8h ago
Docs: man:systemd-sysv-generator(8)
Process: 11571 ExecStop=/etc/rc.d/init.d/jenkins stop (code=exited, status=0/SUCCESS)
Process: 11589 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/jenkins.service
└─11611 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenk...
2月 26 13:16:40 jenkins-master systemd[1]: Stopped LSB: Jenkins Automation Server.
2月 26 13:16:40 jenkins-master jenkins[11571]: Shutting down Jenkins [ 确定 ]
2月 26 13:16:40 jenkins-master systemd[1]: Starting LSB: Jenkins Automation Server...
2月 26 13:16:40 jenkins-master runuser[11594]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
2月 26 13:16:41 jenkins-master jenkins[11589]: Starting Jenkins [ 确定 ]
2月 26 13:16:41 jenkins-master systemd[1]: Started LSB: Jenkins Automation Server.
[root@jenkins-slave01 ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: active (running) since 三 2020-02-26 13:16:35 CST; 8h ago
Docs: man:systemd-sysv-generator(8)
Process: 20287 ExecStop=/etc/rc.d/init.d/jenkins stop (code=exited, status=0/SUCCESS)
Process: 20302 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/jenkins.service
└─20323 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenk...
2月 26 13:16:35 localhost.localdomain systemd[1]: Stopped LSB: Jenkins Automation Server.
2月 26 13:16:35 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
2月 26 13:16:35 localhost.localdomain runuser[20307]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
2月 26 13:16:35 localhost.localdomain systemd[1]: Started LSB: Jenkins Automation Server.
2月 26 13:16:35 localhost.localdomain jenkins[20302]: Starting Jenkins [ 确定 ]
三.在master配置slave
(这里点进slave01进去看看)
(这个表示master和slave连接成功)
四.新建一个job验证构建的操作是在slave上执行的