Jenkins服務器:192.168.10.175
數據備份服務器:192.168.10.164
jenkins服務器報錯不能訪問,插件沒法加載就不能正常獲取代碼,重啓嘗試解決無果,因而採用 以下方案:
將備份的服務器(上面有同步jenkins生產的數據)全新部署新版本的jenkins2.168,測試沒有問題後將域名解析改到新的 192.168.10.164 上,這樣用戶沒有感知就完成了問題修復
訪問報錯:插件不能加載,具體報錯以下
There are dependency errors loading some plugins:
Pipeline: REST API Plugin v2.1
Pipeline: Input Step v2.0 failed to load. Fix this plugin first.
Pipeline: Shared Groovy Libraries v2.4
Pipeline: Groovy v2.14 failed to load. Fix this plugin first.
GitHub Branch Source Plugin v1.10
GitHub plugin v1.14.1 failed to load. Fix this plugin first.
HTML Publisher plugin v1.11
Matrix Project Plugin v1.0 failed to load. Fix this plugin first.
GitHub Organization Folder Plugin v1.5
Pipeline: Groovy v2.14 failed to load. Fix this plugin first.
Pipeline: Build Step v2.3
Pipeline: Supporting APIs v2.6 failed to load. Fix this plugin first.
Pipeline: Stage View Plugin v2.1
Pipeline: REST API Plugin v2.1 failed to load. Fix this plugin first.
Email Extension Template Plugin v1.0
Email Extension Plugin v2.43 failed to load. Fix this plugin first.
Pipeline: Nodes and Processes v2.5
Pipeline: Supporting APIs v2.1 failed to load. Fix this plugin first.
Permissive Script Security Plugin v0.5
You must update Jenkins from v2.19.1 to v2.107.3 or later to run this plugin.
Script Security Plugin v1.58 failed to load. Fix this plugin first.
Email Extension Plugin v2.51
Matrix Project Plugin v1.4 failed to load. Fix this plugin first.
Script Security Plugin v1.60
You must update Jenkins from v2.19.1 to v2.60.3 or later to run this plugin.
Warnings Plug-in v4.56
Static Analysis Utilities v1.77 failed to load. Fix this plugin first.
Jenkins Parameterized Trigger plugin v2.35.2
Conditional BuildStep v1.3.1 failed to load. Fix this plugin first.
Pipeline: Multibranch v2.9
Pipeline: Groovy v2.17 failed to load. Fix this plugin first.
Pipeline: Supporting APIs v2.8
Script Security Plugin v1.21 failed to load. Fix this plugin first.
Static Analysis Utilities v1.79
Matrix Project Plugin v1.4 failed to load. Fix this plugin first.
Pipeline Graph Analysis Plugin v1.2
Pipeline: Groovy v2.2 failed to load. Fix this plugin first.
Jenkins Workspace Cleanup Plugin v0.30
Matrix Project Plugin v1.7.1 failed to load. Fix this plugin first.
Jenkins Git plugin v3.0.0
Matrix Project Plugin v1.7.1 failed to load. Fix this plugin first.
Pipeline: Job v2.7
Pipeline: Supporting APIs v2.2 failed to load. Fix this plugin first.
Pipeline: Input Step v2.1
Pipeline: Supporting APIs v2.2 failed to load. Fix this plugin first.
Jenkins Multijob plugin v1.32
You must update Jenkins from v2.19.1 to v2.31 or later to run this plugin.
Conditional BuildStep v1.3.3 failed to load. Fix this plugin first.
GitLab Plugin v1.4.2
Jenkins Git plugin v2.4.1 failed to load. Fix this plugin first.
Environment Injector Plugin v2.1.6
Matrix Project Plugin v1.7 failed to load. Fix this plugin first.
Matrix Project Plugin v1.7.1
Script Security Plugin v1.13 failed to load. Fix this plugin first.
Pipeline: Groovy v2.19
Script Security Plugin v1.23 failed to load. Fix this plugin first.
Checkstyle Plug-in v3.46
Matrix Project Plugin v1.2.1 failed to load. Fix this plugin first.
Pipeline v2.4
Pipeline: Groovy v2.17 failed to load. Fix this plugin first.
Conditional BuildStep v1.3.6
Matrix Project Plugin v1.0 failed to load. Fix this plugin first.
GitHub plugin v1.22.2
Jenkins Git plugin v2.4.0 failed to load. Fix this plugin first.
備份的腳本:
# 每1小時同步一次jenkins的數據到本機
#05 */1 * * * /bin/bash /opt/rsync_jenkins2_chinasoft_cn_2local.sh >/dev/null 2>&1
# cat /opt/rsync_jenkins2_chinasoft_cn_2local.sh
#!/bin/bash
passfile=/data/www/.rsync/rsyncd.pass
/usr/local/rsync/bin/rsync -avrp -P --password-file=$passfile apache@192.168.10.175::apache/data/jenkins_home/ /data/jenkins_home/
/usr/local/rsync/bin/rsync -avrp -P --password-file=$passfile apache@192.168.10.175::apache/usr/local/worksh/jeninks_task/ /usr/local/worksh/jeninks_task/
部署新版本jenkins的步驟:
1.準備環境和軟件:
a.安裝java1.8.181
b.修改環境變量:
# vim /etc/profile
JENKINS_HOME=/data/jenkins_home
MAVEN_HOME=/usr/local/maven
PATH=$MAVEN_HOME/bin:$PATH
#JAVA_HOME=/usr/local/jdk
JAVA_HOME=/usr/java/jdk1.8.0_181-amd64
#JRE_HOME=/usr/local/jdk/jre
JRE_HOME=/usr/java/jdk1.8.0_181-amd64/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
#JAVA_OPTS='-server -Xms1024m -Xmx1024m XX:PermSize=128M -XX:MaxPermSize=256M'
export JAVA_HOME JRE_HOME PATH CLASSPATH MAVEN_HOME JENKINS_HOME
c.安裝tomcat8.0.53,刪除webapps下面全部文件,並將jenkins2.168.war解壓到tomcat的webapps目錄
2.啓動tomcat,觀察日誌是否正常以前的數據都在,能夠正常登陸
發現報錯,不能訪問git,安裝git命令,git clone能夠正常使用
切換到apache用戶下執行clone一次便可
部分使用apache用戶的須要切換到 apache用戶下執行,輸入yes
[apache@jenkins/usr/local/tomcat]$ ssh -p2019 1.1.1.1
有一些小坑:
注意觀察logs/catalina.out 若是加載的是jre1.7(舊版本就會有問題),必定要是jdk1.8.不然class沒法解析
以下:
startup.VersionLoggerListener.log Java Home: /usr/local/jdk1.7.0_80/jre
3.jenkins.chinaosft.cn 這個入口的proxy_pass要改成 192.168.10.164:8080
4.切換到apache用戶下生成公鑰,在git的web界面配置ssh-key
su apache
ssh-keygen -t rsa
5.部分jenkins任務使用了apache帳號的ssh登陸,須要進行免祕鑰登陸處理
java