備份:confluence每日凌晨2:00都在 /data/atlassian/application-data/confluence/backups/ 下生成備份包,其中包括文檔,附件,用戶
還原:對於較小的包可以直接在web界面上傳,對於大於25M的包,需要上傳到confluence所在服務器的cd /data/atlassian/application-data/confluence/restore ,再還原
備份包的導入有兩種方式: UI界面導入 / 命令行導入
此處主要介紹命令行導入的操作。
服務端命令行插件安裝
插件上傳與安裝,> = 9.0版本
下載:https://marketplace.atlassian.com/apps/10886/atlassian-command-line-interface-cli?hosting=cloud&tab=overview ,get it now
在官網獲取許可證(有30d免費版),並更新
客戶端安裝
官網下載客戶端 >= 9.0版本
下載:https://bobswift.atlassian.net/wiki/spaces/ACLI/pages/16875586/Downloads
(可直接解壓客戶端,執行命令即可導入 java -jar "/usr/local/atlassian-cli-9.0.0/lib/acli-9.0.0.jar" confluence -s https://example.yourconfluenceurl.com --user youruser --password yourpasswd --action restoreExport --file "share-backup-2019_10_30.zip" --debug ,也可按以下方法配置)
cd /usr/local
unzip atlassian-cli-9.0.0-distribution.zip
cd atlassian-cli-9.0.0
mv acli-server.properties acli.properties
cat acli.properties
# Example Server configuration - customize and rename this file to acli.properties
credentials = --user confluenceuser --password confluencepasswd #confluence管理員的用戶名密碼
myjira = jira -s https://jira.examplegear.com ${credentials}
myconfluence = confluence -s https://swiki-confluence.intsig.net ${credentials} #confluence的url
# This defines the default client for actions, choose the most likely used client
default = ${myconfluence} #修改此處
導入備份包命令執行
./acli.sh --action restoreExport --file "backup-2019_07_30.zip" --debug --options noWait
導入完成后,到UI界面驗證導入成功。
confluence自動校驗的問題
目前有9個 license為10人的confluence需要備份校驗,寫成腳本,分別對每一個做導入、最近更新時間、文章數的校驗。
最近更新時間: mysql -u user -pmypassword -Dconfluence -h 127.0.0.1 -e "select MAX(LASTMODDATE) from CONTENT"|tail -n 1
文章數:mysql -u user -pmypassword -h 127.0.0.1 -Dconfluence -e "select count(*) from CONTENT where contenttype='PAGE' and prevver is null and content_status='current'"|tail -n 1
問題:
1.在導入操作中,由於我將由於導入校驗的confluence的license換成試用版無限制的license,造成無法導入成功;
2.在導入操作中,我發現有4個confluence導入后,后續confluence 命令行都無法正常導入,報錯:Could not find indication of a successful start of import processing,后來發現這四個confluence語言都為中文,需要改成 English(UK),可能是語言編碼的問題。