需求
需要从旧的jenkins服务器中将部分任务迁移到新的jenkins服务器中
迁移过程
首先需要将config.xml,jobs,workspace,plugins 这四部分内容迁移到新的Jenkins服务器,如果项目较多,任务较多,就统一打包使用scp发送过去即可
代码语言:javascript复制find . -name "yqj*" -o -name "音速*" -print0|tar -czvf /export/data/tar/123.tar.gz --null -T -
这个是将查找到的文件或目录统一打包
如果不想打包,也可以直接scp过去
代码语言:javascript复制find . -name "yqj*" -o -name "音速*" -exec scp -r {} root@172.20.103.9:/ ;
将上述四部分内容拷贝过去之后重启下jenkins即可。
问题
代码语言:javascript复制
at hudson.WebAppMain$3.run(WebAppMain.java:234)
Caused by: org.jvnet.hudson.reactor.ReactorException: java.io.IOException: Unable to read /var/lib/jenkins/config.xml at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:269) at jenkins.InitReactorRunner.run(InitReactorRunner.java:44) at jenkins.model.Jenkins.executeReactor(Jenkins.java:912) at jenkins.model.Jenkins.<init>(Jenkins.java:811) at hudson.model.Hudson.<init>(Hudson.java:82) at hudson.model.Hudson.<init>(Hudson.java:78) at hudson.WebAppMain$3.run(WebAppMain.java:222) Caused by: java.io.IOException: Unable to read /var/lib/jenkins/config.xml at hudson.XmlFile.unmarshal(XmlFile.java:165) at jenkins.model.Jenkins$17.run(Jenkins.java:2561) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282) at jenkins.model.Jenkins$7.runTask(Jenkins.java:901) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: com.thoughtworks.xstream.converters.ConversionException: hudson.security.GlobalMatrixAuthorizationStrategy : hudson.security.GlobalMatrixAuthorizationStrategy
解决 删除两行内容:
vim config.xml authorizationStrategy 删除 securityRealm 删除
删除完成后,重启即可