011. jenkins 备份
Jenkins目录介绍
1. 主配置文件: /etc/sysconfig/jenkins
2. Jenkins主目录: /var/lib/jenkins/
[root@node1 plugins]# ll /var/lib/jenkins/
total 227060
-rw------- 1 jenkins jenkins 788 Dec 25 16:25 com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.xml
-rw------- 1 jenkins jenkins 365 Dec 25 16:25 com.dabsquared.gitlabjenkins.GitLabPushTrigger.xml
-rw------- 1 jenkins jenkins 1822 Dec 25 16:25 config.xml
-rw------- 1 jenkins jenkins 172 Dec 25 16:25 hudson.model.UpdateCenter.xml
-rw------- 1 jenkins jenkins 370 Dec 25 16:25 hudson.plugins.git.GitTool.xml
-rw------- 1 jenkins jenkins 1712 Dec 25 15:07 identity.key.enc
-rw------- 1 jenkins jenkins 94 Dec 25 15:07 jenkins.CLI.xml
-rw-r--r-- 1 jenkins jenkins 4 Dec 25 15:38 jenkins.install.InstallUtil.lastExecVersion
-rw-r--r-- 1 jenkins jenkins 4 Dec 25 15:38 jenkins.install.UpgradeWizard.state
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 15:07 jobs
drwxr-xr-x 4 jenkins jenkins 37 Dec 25 16:25 logs
-rw------- 1 jenkins jenkins 907 Dec 25 16:25 nodeMonitors.xml
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 15:07 nodes
drwxr-xr-x 117 jenkins jenkins 12288 Dec 25 16:23 plugins
-rw-r--r-- 1 root root 232436856 Oct 4 2018 plugins.tar.gz
-rw------- 1 jenkins jenkins 129 Dec 25 16:25 queue.xml.bak
-rw------- 1 jenkins jenkins 64 Dec 25 15:07 secret.key
-rw-r--r-- 1 jenkins jenkins 0 Dec 25 15:07 secret.key.not-so-secret
drwx------ 4 jenkins jenkins 4096 Dec 25 15:41 secrets
-rw-r--r-- 1 jenkins jenkins 0 Dec 25 16:32 ThinBackup Worker Thread.log
drwxr-xr-x 2 jenkins jenkins 182 Dec 25 16:25 updates
drwxr-xr-x 2 jenkins jenkins 24 Dec 25 15:07 userContent
drwxr-xr-x 3 jenkins jenkins 19 Dec 25 15:07 users
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 16:25 workflow-libs
3. Jenkins程序包: /usr/lib/jenkins/jenkins.war
4. jenkins程序包: /var/cache/jenkins/
[root@node1 plugins]# ll /var/cache/jenkins/
total 4
drwxr-xr-x 10 jenkins jenkins 4096 Dec 25 15:07 war
5. Jenkins程序目录: /var/cache/jenkins/
6. Jenkins日志目录: /var/log/jenkins/
[root@node1 plugins]# rpm -ql jenkins
/etc/init.d/jenkins #启动文件
/etc/logrotate.d/jenkins #日志相关文件
/etc/sysconfig/jenkins #jenkins主配置文件
/usr/lib/jenkins #Jenkins主目录 它是由/etc/sysconfig/jenkins 配置决定的. 同时备份时也可以备份此目录
#包括启动端口,主目录 都是这个配置文件决定的.
/usr/lib/jenkins/jenkins.war #Jenkins程序包 在升级的时候,将新版本的war包替换这个war包就完成了升级.
/usr/sbin/rcjenkins #Jenkins的二进制文件目录
/var/cache/jenkins #Jenkins 运行程序时解压出的文件
/var/lib/jenkins #Jenkins主目录
/var/log/jenkins #Jenkins日志目录.
#Jenkins主目录重要配置文件和目录:
[root@node1 jenkins]# ll /var/lib/jenkins/
total 227060
-rw------- 1 jenkins jenkins 788 Dec 25 16:25 com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.xml
-rw------- 1 jenkins jenkins 365 Dec 25 16:25 com.dabsquared.gitlabjenkins.GitLabPushTrigger.xml
-rw------- 1 jenkins jenkins 1822 Dec 25 16:25 config.xml
-rw------- 1 jenkins jenkins 172 Dec 25 16:25 hudson.model.UpdateCenter.xml
-rw------- 1 jenkins jenkins 370 Dec 25 16:25 hudson.plugins.git.GitTool.xml
-rw------- 1 jenkins jenkins 1712 Dec 25 15:07 identity.key.enc
-rw------- 1 jenkins jenkins 94 Dec 25 15:07 jenkins.CLI.xml
-rw-r--r-- 1 jenkins jenkins 4 Dec 25 15:38 jenkins.install.InstallUtil.lastExecVersion
-rw-r--r-- 1 jenkins jenkins 4 Dec 25 15:38 jenkins.install.UpgradeWizard.state
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 15:07 jobs
drwxr-xr-x 4 jenkins jenkins 37 Dec 25 16:25 logs #日志目录
-rw------- 1 jenkins jenkins 907 Dec 25 16:25 nodeMonitors.xml
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 15:07 nodes
drwxr-xr-x 117 jenkins jenkins 12288 Dec 25 16:23 plugins
-rw-r--r-- 1 root root 232436856 Oct 4 2018 plugins.tar.gz
-rw------- 1 jenkins jenkins 129 Dec 25 16:25 queue.xml.bak
-rw------- 1 jenkins jenkins 64 Dec 25 15:07 secret.key
-rw-r--r-- 1 jenkins jenkins 0 Dec 25 15:07 secret.key.not-so-secret
drwx------ 4 jenkins jenkins 4096 Dec 25 15:41 secrets
-rw-r--r-- 1 jenkins jenkins 0 Dec 25 16:44 ThinBackup Worker Thread.log
drwxr-xr-x 2 jenkins jenkins 182 Dec 25 16:25 updates
drwxr-xr-x 2 jenkins jenkins 24 Dec 25 15:07 userContent
drwxr-xr-x 3 jenkins jenkins 19 Dec 25 15:07 users #Jenkins用户配置目录,用户加密的密码也在这
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 16:25 workflow-libs
#用户配置文件:
/var/lib/jenkins/users/admin/config.xml
Jenkins简单粗暴备份
[root@node1 jenkins]# ll
total 227060
-rw------- 1 jenkins jenkins 788 Dec 25 16:25 com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.xml
-rw------- 1 jenkins jenkins 365 Dec 25 16:25 com.dabsquared.gitlabjenkins.GitLabPushTrigger.xml
-rw------- 1 jenkins jenkins 1822 Dec 25 16:25 config.xml
-rw------- 1 jenkins jenkins 172 Dec 25 16:25 hudson.model.UpdateCenter.xml
-rw------- 1 jenkins jenkins 370 Dec 25 16:25 hudson.plugins.git.GitTool.xml
-rw------- 1 jenkins jenkins 1712 Dec 25 15:07 identity.key.enc
-rw------- 1 jenkins jenkins 94 Dec 25 15:07 jenkins.CLI.xml
-rw-r--r-- 1 jenkins jenkins 4 Dec 25 15:38 jenkins.install.InstallUtil.lastExecVersion
-rw-r--r-- 1 jenkins jenkins 4 Dec 25 15:38 jenkins.install.UpgradeWizard.state
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 15:07 jobs
drwxr-xr-x 4 jenkins jenkins 37 Dec 25 16:25 logs
-rw------- 1 jenkins jenkins 907 Dec 25 16:25 nodeMonitors.xml
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 15:07 nodes
drwxr-xr-x 117 jenkins jenkins 12288 Dec 25 16:23 plugins
-rw-r--r-- 1 root root 232436856 Oct 4 2018 plugins.tar.gz
-rw------- 1 jenkins jenkins 129 Dec 25 16:25 queue.xml.bak
-rw------- 1 jenkins jenkins 64 Dec 25 15:07 secret.key
-rw-r--r-- 1 jenkins jenkins 0 Dec 25 15:07 secret.key.not-so-secret
drwx------ 4 jenkins jenkins 4096 Dec 25 15:41 secrets
-rw-r--r-- 1 jenkins jenkins 0 Dec 25 16:49 ThinBackup Worker Thread.log
drwxr-xr-x 2 jenkins jenkins 182 Dec 25 16:25 updates
drwxr-xr-x 2 jenkins jenkins 24 Dec 25 15:07 userContent
drwxr-xr-x 3 jenkins jenkins 19 Dec 25 15:07 users
drwxr-xr-x 2 jenkins jenkins 6 Dec 25 16:25 workflow-libs
直接打包 /var/lib/jenkins 就可以了:
tar zcf jenkins_$(date +%F).tar.gz /var/lib/jenkins

微信赞赏

支付宝赞赏

【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 继承的思维:从思维模式到架构设计的深度解析
· 如何在 .NET 中 使用 ANTLR4
· 后端思维之高并发处理方案
· 理解Rust引用及其生命周期标识(下)
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· 35岁程序员的中年求职记:四次碰壁后的深度反思
· 当职场成战场:降职、阴谋与一场硬碰硬的抗争
· ShadowSql之.net sql拼写神器
· Excel百万数据如何快速导入?
· 无需WebView,Vue也能开发跨平台桌面应用