【jenkins】 集群

配置从节点

  1. 配置步骤

 

2. 填写节点配置信息

填写节点名称:jenkins-node1-192.168.81.230

执行器数量:5(执行器数量就是执行任务的并发数)

远程工作目录:/home/jenkins(任意目录即可,不存在就会创建)

标签:node1(一定要写清楚)

用法:

  1. use this node as mush as possible   --- 当选择"Use this node as much as possible"时,Jenkins会尽量多地将任务调度到这个节点上执行
  2. only build jobs with label expressions matching this node --- 配置标签一致时,才会调用该节点

启动方式:Launch agent by connecting it to the controller

  1. Launch agent by connecting it to the controller
    • 当选择 "Launch agent by connecting it to the controller" 作为启动方式时,从节点(agent)会主动连接到 Jenkins 主节点(controller)的代理控制器上。这种方式是通过从节点上执行一个命令(通常是 java -jar 命令,用于运行 Jenkins 代理的 JAR 文件)来完成的。
    • 在配置 "Launch agent by connecting it to the controller" 时,通常需要在 Jenkins 主节点上指定代理的监听端口、从节点的 IP 地址或主机名以及连接时所需的凭据等信息。在从节点上,需要下载并运行 Jenkins 代理的 JAR 文件(通常称为 agent.jar 或 jenkins-agent.jar),以便连接到主节点
  2. Launch agents via SSH
    • 使用SSH(Secure Shell)协议连接从节点到Jenkins主节点,提供了加密的通信通道,确保了节点间通信的安全性。
      • 确保从节点上已经安装了SSH服务器,并且主节点可以访问该服务器。
      • 在主节点上安装并配置SSH客户端,以便能够与从节点建立连接。
      • 在主节点的Jenkins配置中,指定从节点的SSH连接信息,包括IP地址、端口、用户名和密码或密钥等。
      • 根据需要配置SSH连接的其他选项,如连接超时时间、重试次数等。

主机写上slave节点的ip地址,然后添加一个凭据,类型就写password即可,填写上用户名密码即可
可用性:

  1. Keep this agent online as much as possible --- Jenkins 会尽量保持该节点处于在线状态,以便能够随时接受和执行构建任务

节点配置

Environment variables 

JAVA_TOOL_OPTIONS   -Dfile.encoding=UTF-8

LANG   zh.CH.UTF-8

path    C:\Windows\System32;D:\program\anacoda;D:\program\anacoda\Scripts;D:\program\anacoda\Library\bin

配置jenkins

posted on 2024-06-27 13:42  彩屏黑白  阅读(5)  评论(0编辑  收藏  举报

导航