# DevOps 集群安装手册
# 说明
本安装手册适用于 DevOps 集群环境。
集群搭建基于单节点devops安装,相同部分请参考DevOps 安装手册。
# 安装步骤
以双节点为例,进行集群安装说明。
在A B主机分别上安装DevOps,注意user-config.xml数据库连接需要连接同一个数据库。
# 数据库连接配置同一个数据库
cd config/DEVOPS/config
修改配置文件user-config.xml
,配置已经初始化的数据库:
<group name="default">
<configValue key="Database-Type">MySql</configValue>
<configValue key="Jdbc-Type"/>
<configValue key="C3p0-DriverClass">com.mysql.cj.jdbc.Driver</configValue>
<configValue key="C3p0-Url">jdbc:mysql://ip:3306/devops?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai</configValue>
<configValue key="C3p0-UserName">user</configValue>
<configValue key="C3p0-Password">password</configValue>
<configValue key="C3p0-PoolSize">20</configValue>
<configValue key="C3p0-MaxPoolSize">100</configValue>
<configValue key="C3p0-MinPoolSize">10</configValue>
<configValue key="Transaction-Isolation">ISOLATION_DEFAULT</configValue>
<configValue key="Test-Connect-Sql">SELECT count(*) from EOS_UNIQUE_TABLE</configValue>
<configValue key="Retry-Connect-Count">-1</configValue>
<configValue key="C3p0-MaxIdleTime">600</configValue>
<configValue key="C3p0-IdleConnectionTestPeriod">900</configValue>
<configValue key="C3p0-MaxStatements">0</configValue>
<configValue key="C3p0-NumHelperThreads">1</configValue>
</group>
启动A、B主机的devops服务。
# nginx负载
搭建一个nginx服务,配置nginx负载均衡80端口转发至devops服务端口。
nginx配置参考如下:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/css text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
upstream devops {
ip_hash;
server 10.15.15.96:8080; # devops第一个节点
server 10.15.15.248:8080; # devops第二个节点
}
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
client_max_body_size 500m;
proxy_connect_timeout 600s;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
proxy_pass http://devops;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
更新配置后重启nginx服务:
# 平滑重载配置文件(修改配置后使用,无需停止服务)
nginx -s reload
# 停止
nginx -s stop
# 启动
nginx -c /path/to/nginx.conf # 指定配置文件启动
# 重启
nginx -s restart # 先停后启(可能造成短暂中断)
# 持久化配置
访问nginx服务的80端口,登录devops平台,配置持久化参数。
1、Pcm.RootUrl DevOps的根地址 填写nginx 负载均衡访问地址。
2、Engine.PipelineInstanceDetails 流水线实例详情
Engine.PipelineInstanceDetailsPersistenceMode 流水线实例详情持久化方式:local,db,nexus
默认值为:local
这里我们部署集群时,建议配置nexus,用于保证数据的一致性!
需要更新的参数:
Engine.PipelineInstanceDetailsPersistenceMode 流水线实例详情持久化方式
Engine.NexusRepositoryUrl 流水线实例详情存放Nexus仓库URL
Engine.NexusUserName 流水线实例详情存放Nexus仓库用户名
Engine.NexusPassword 流水线实例详情存放Nexus仓库密码
3、Pm.Attachment 附件存储规则
Pm.AttachmentPersistenceMode 附件存储持久化方式:local,db,nexus,比如:db:worktiem:nexus;
默认值为:local
这里我们部署集群时,建议配置nexus,用于保证数据的一致性!
需要更新的参数:
Pm.AttachmentPersistenceMode 附件存储持久化方式
Pm.AttachmentNexusRepositoryUrl 附件存储存放Nexus仓库URL
Pm.AttachmentNexusUserName 附件存储存放Nexus仓库用户名
Pm.AttachmentNexusPassword 附件存储存放Nexus仓库密码
# 日志说明
日志默认存放在安装包的logs目录内 每个devops服务单独存储。
可以通过修改startup.sh脚本里的log_dir来选定日志存放位置
logback_spring.xml里是具体日志文件配置
统一管理日志建议单独配置日志采集系统。
# 特殊说明
当单机DevOps服务已经部署运行且采用的【local】模式,扩展为集群时,需要注意以下问题:
1、原有local存储的持久化数据,这部分数据没有上传到如nexus,只能从本地加载,所以需要拷贝到其他节点; 需要备份【相同路径】到其他节点上,保证原有数据的一致性。后续的数据请配置nexus地址。
2、数据库连接需要保证一致性,所有节点的user-config.xml请和原服务相同。