confluence异常关闭恢复

服务器断电后,confluence服务无法启动,报如下错误:

查找资料后确定是由于异常退出导致/var/atlassian/application-data/confluence/confluence.cfg.xml文件为空,启动时无法读取环境信息导致的。由于此文件没有备份(备份的重要性...),所以只能重新初始化此文件。

重新初始化步骤:

1. 备份数据库confluence和Confluence home文件夹

备份 mysql
$ mysqldump -uconfluence -h192.168.2.179 -pconfluence --database confluence | gzip > ./confluence.sql.gz
$ cd /var/atlassian/application-data/
$ ls
confluence
$ mkdir confluence1   #创建一个空目录
$ chown -R confluence.confluence confluence1

2. 新建一个空数据库confluence1,用于创建新的confluence.cfg.xml

MySQL [(none)]> create database confluence1 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
MySQL [(none)]> grant all privileges on confluence1.* to confluence@'%';
MySQL [(none)]> flush privileges;

3. 创建一个新的空的home(confluence1)文件夹。编辑<confluence_install_directory>/confluence/WEB-INF/classes/confluence-init.properties,指向confluence1

$ vim /opt/atlassian/confluence/confluence/WEB-INF/classes/confluence-init.properties
confluence.home = /var/atlassian/application-data/confluence1

4. 重启Confluence

5. 按照安装指导正常配置,在数据库配置页面,指向第二步创建的数据库confluence1

6. 完成设置指导,破解步骤也在此完成。

7. 关闭Confluence

8. 这时就有一个完整的confluence.cfg.xml文件

9. 把这个文件复制到原文件夹中

$ cp -a /var/atlassian/application-data/confluence1/confluence.cfg.xml /var/atlassian/application-data/confluence/confluence.cfg.xml

10. 变更数据库链接到原数据库上

$ vim /var/atlassian/application-data/confluence1/confluence.cfg.xml
...
<property name="hibernate.connection.url">jdbc:mysql://192.168.2.179:3306/confluence</property>
...

11. 变更<confluence_install_directory>/confluence/WEB-INF/classes/confluence-init.properties 将home设置为原程序路径

$ vim /opt/atlassian/confluence/confluence/WEB-INF/classes/confluence-init.properties
confluence.home = /var/atlassian/application-data/confluence

12. 重启Confluence,即恢复之前数据

13. 备份cp -a confluence.cfg.xml{,_bak}

参考资料:

https://www.cnblogs.com/xun0523/p/10716864.html

%23%23%23%23%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%96%AD%E7%94%B5%E5%90%8E%EF%BC%8Cconfluence%E6%9C%8D%E5%8A%A1%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%EF%BC%8C%E6%8A%A5%E5%A6%82%E4%B8%8B%E9%94%99%E8%AF%AF%EF%BC%9A%0A%0A!%5Bbfa42b2156e72fd76f545cef6c5d343e.png%5D(en-resource%3A%2F%2Fdatabase%2F1517%3A1)%0A%0A%0A%3E%20%E6%9F%A5%E6%89%BE%E8%B5%84%E6%96%99%E5%90%8E%E7%A1%AE%E5%AE%9A%E6%98%AF%E7%94%B1%E4%BA%8E%E5%BC%82%E5%B8%B8%E9%80%80%E5%87%BA%E5%AF%BC%E8%87%B4%60%2Fvar%2Fatlassian%2Fapplication-data%2Fconfluence%2Fconfluence.cfg.xml%60%E6%96%87%E4%BB%B6%E4%B8%BA%E7%A9%BA%EF%BC%8C%E5%90%AF%E5%8A%A8%E6%97%B6%E6%97%A0%E6%B3%95%E8%AF%BB%E5%8F%96%E7%8E%AF%E5%A2%83%E4%BF%A1%E6%81%AF%E5%AF%BC%E8%87%B4%E7%9A%84%E3%80%82%E7%94%B1%E4%BA%8E%E6%AD%A4%E6%96%87%E4%BB%B6%E6%B2%A1%E6%9C%89%E5%A4%87%E4%BB%BD(%E5%A4%87%E4%BB%BD%E7%9A%84%E9%87%8D%E8%A6%81%E6%80%A7...)%EF%BC%8C%E6%89%80%E4%BB%A5%E5%8F%AA%E8%83%BD%E9%87%8D%E6%96%B0%E5%88%9D%E5%A7%8B%E5%8C%96%E6%AD%A4%E6%96%87%E4%BB%B6%E3%80%82%0A%0A%0A%E9%87%8D%E6%96%B0%E5%88%9D%E5%A7%8B%E5%8C%96%E6%AD%A5%E9%AA%A4%EF%BC%9A%0A%0A%23%23%23%201.%20%E5%A4%87%E4%BB%BD%E6%95%B0%E6%8D%AE%E5%BA%93confluence%E5%92%8CConfluence%20home%E6%96%87%E4%BB%B6%E5%A4%B9%0A%60%60%60%0A%E5%A4%87%E4%BB%BD%20mysql%0A%24%20mysqldump%20-uconfluence%20-h192.168.2.179%20-pconfluence%20--database%20confluence%20%7C%20gzip%20%3E%20.%2Fconfluence.sql.gz%0A%24%20cd%20%2Fvar%2Fatlassian%2Fapplication-data%2F%0A%24%20ls%0Aconfluence%0A%24%20mkdir%20confluence1%20%20%20%23%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E7%A9%BA%E7%9B%AE%E5%BD%95%0A%24%20chown%20-R%20confluence.confluence%20confluence1%0A%60%60%60%0A%23%23%23%202.%20%E6%96%B0%E5%BB%BA%E4%B8%80%E4%B8%AA%E7%A9%BA%E6%95%B0%E6%8D%AE%E5%BA%93confluence1%EF%BC%8C%E7%94%A8%E4%BA%8E%E5%88%9B%E5%BB%BA%E6%96%B0%E7%9A%84confluence.cfg.xml%0A%60%60%60%0AMySQL%20%5B(none)%5D%3E%20create%20database%20confluence1%20DEFAULT%20CHARACTER%20SET%20utf8%20COLLATE%20utf8_bin%3B%0AMySQL%20%5B(none)%5D%3E%20grant%20all%20privileges%20on%20confluence1.*%20to%20confluence%40'%25'%3B%0AMySQL%20%5B(none)%5D%3E%20flush%20privileges%3B%0A%60%60%60%0A%23%23%23%203.%20%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E6%96%B0%E7%9A%84%E7%A9%BA%E7%9A%84home(confluence1)%E6%96%87%E4%BB%B6%E5%A4%B9%E3%80%82%E7%BC%96%E8%BE%91%3Cconfluence_install_directory%3E%2Fconfluence%2FWEB-INF%2Fclasses%2Fconfluence-init.properties%EF%BC%8C%E6%8C%87%E5%90%91confluence1%0A%60%60%60%0A%24%20vim%20%2Fopt%2Fatlassian%2Fconfluence%2Fconfluence%2FWEB-INF%2Fclasses%2Fconfluence-init.properties%0Aconfluence.home%20%3D%20%2Fvar%2Fatlassian%2Fapplication-data%2Fconfluence1%0A%60%60%60%0A%23%23%23%204.%20%E9%87%8D%E5%90%AFConfluence%0A%23%23%23%205.%20%E6%8C%89%E7%85%A7%E5%AE%89%E8%A3%85%E6%8C%87%E5%AF%BC%E6%AD%A3%E5%B8%B8%E9%85%8D%E7%BD%AE%EF%BC%8C%E5%9C%A8%E6%95%B0%E6%8D%AE%E5%BA%93%E9%85%8D%E7%BD%AE%E9%A1%B5%E9%9D%A2%EF%BC%8C%E6%8C%87%E5%90%91%E7%AC%AC%E4%BA%8C%E6%AD%A5%E5%88%9B%E5%BB%BA%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93confluence1%0A%23%23%23%206.%20%E5%AE%8C%E6%88%90%E8%AE%BE%E7%BD%AE%E6%8C%87%E5%AF%BC%2C%E7%A0%B4%E8%A7%A3%E6%AD%A5%E9%AA%A4%E4%B9%9F%E5%9C%A8%E6%AD%A4%E5%AE%8C%E6%88%90%E3%80%82%0A%23%23%23%207.%20%E5%85%B3%E9%97%ADConfluence%0A%23%23%23%208.%20%E8%BF%99%E6%97%B6%E5%B0%B1%E6%9C%89%E4%B8%80%E4%B8%AA%E5%AE%8C%E6%95%B4%E7%9A%84confluence.cfg.xml%E6%96%87%E4%BB%B6%0A%23%23%23%209.%20%E6%8A%8A%E8%BF%99%E4%B8%AA%E6%96%87%E4%BB%B6%E5%A4%8D%E5%88%B6%E5%88%B0%E5%8E%9F%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%AD%0A%60%60%60%0A%24%20cp%20-a%20%2Fvar%2Fatlassian%2Fapplication-data%2Fconfluence1%2Fconfluence.cfg.xml%20%2Fvar%2Fatlassian%2Fapplication-data%2Fconfluence%2Fconfluence.cfg.xml%0A%60%60%60%0A%23%23%23%2010.%20%E5%8F%98%E6%9B%B4%E6%95%B0%E6%8D%AE%E5%BA%93%E9%93%BE%E6%8E%A5%E5%88%B0%E5%8E%9F%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%8A%0A%60%60%60%0A%24%20vim%20%2Fvar%2Fatlassian%2Fapplication-data%2Fconfluence1%2Fconfluence.cfg.xml%0A...%0A%3Cproperty%20name%3D%22hibernate.connection.url%22%3Ejdbc%3Amysql%3A%2F%2F192.168.2.179%3A3306%2Fconfluence%3C%2Fproperty%3E%0A...%0A%60%60%60%0A%23%23%23%2011.%20%E5%8F%98%E6%9B%B4%3Cconfluence_install_directory%3E%2Fconfluence%2FWEB-INF%2Fclasses%2Fconfluence-init.properties%20%E5%B0%86home%E8%AE%BE%E7%BD%AE%E4%B8%BA%E5%8E%9F%E7%A8%8B%E5%BA%8F%E8%B7%AF%E5%BE%84%0A%60%60%60%0A%24%20vim%20%2Fopt%2Fatlassian%2Fconfluence%2Fconfluence%2FWEB-INF%2Fclasses%2Fconfluence-init.properties%0Aconfluence.home%20%3D%20%2Fvar%2Fatlassian%2Fapplication-data%2Fconfluence%0A%60%60%60%0A%23%23%23%2012.%20%E9%87%8D%E5%90%AFConfluence%2C%E5%8D%B3%E6%81%A2%E5%A4%8D%E4%B9%8B%E5%89%8D%E6%95%B0%E6%8D%AE%0A%23%23%23%2013.%20%E5%A4%87%E4%BB%BD%60cp%20-a%20confluence.cfg.xml%7B%2C_bak%7D%60%0A%0A%23%23%23%20%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99%3A%0A%5Bhttps%3A%2F%2Fwww.cnblogs.com%2Fxun0523%2Fp%2F10716864.html%5D(https%3A%2F%2Fwww.cnblogs.com%2Fxun0523%2Fp%2F10716864.html)%0A
posted @ 2020-05-18 19:05  dance_man  阅读(2089)  评论(0编辑  收藏  举报