系統(tǒng):Centos7.2
confluence版本:6.13
數(shù)據(jù)庫版本:postgresql9.5
用途:confluence作為公司內(nèi)部知識庫,相關(guān)技術(shù)日常文檔都可以放在上面。
1.下載:
(破解包請只適用于個(gè)人實(shí)驗(yàn)):
2.安裝:
[root@elk ~]# ./atlassian-confluence-6.13.2-x64.bin
Installing fontconfig...
..........
..........
作為依賴被安裝:
dejavu-fonts-common.noarch 0:2.33-6.el7
dejavu-sans-fonts.noarch 0:2.33-6.el7
fontpackages-filesystem.noarch 0:1.44-8.el7
完畢!
Unpacking JRE ...
Starting Installer ...
This will install Confluence 6.13.2 on your computer.
OK [o, Enter], Cancel [c]
o
Click Next to continue, or Cancel to exit Setup.
Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (uses default settings) [1],
Custom Install (recommended for advanced users) [2, Enter],
Upgrade an existing Confluence installation [3]
2
Select the folder where you would like Confluence 6.13.2 to be installed,
then click Next.
Where should Confluence 6.13.2 be installed?
[/opt/atlassian/confluence] ##注意安裝home目錄,可更改為自己的
Default location for Confluence data
[/var/atlassian/application-data/confluence] ##注意數(shù)據(jù)目錄,可更改為自己的
Configure which ports Confluence will use.
Confluence requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you will access
Confluence through your browser. The Control port is used to Startup and
Shutdown Confluence.
Use default ports (HTTP: 8090, Control: 8000) - Recommended [1, Enter], Set custom value for HTTP and Control ports [2]
2
HTTP Port Number
[8090]
8080 #可以自己設(shè)定端口,瀏覽器訪問端口
Control Port Number
[8000]
Confluence can be run in the background.
You may choose to run Confluence as a service, which means it will start
automatically whenever the computer restarts.
Install Confluence as Service?
Yes [y, Enter], No [n]
y
Extracting files ...
Please wait a few moments while we configure Confluence.
Installation of Confluence 6.13.2 is complete
Start Confluence now?
Yes [y, Enter], No [n]
n #可以選擇自行啟動(dòng)
Please wait a few moments while Confluence starts up.
Launching Confluence ...
Installation of Confluence 6.13.2 is complete
Your installation of Confluence 6.13.2 is now ready and can be accessed via
your browser.
Confluence 6.13.2 can be accessed at http://localhost:8080
Finishing installation ...
瀏覽器打開 IP:8080
語言可以選擇中文

image.png
選擇產(chǎn)品安裝,下一步

image.png
插件安裝跳過

image.png
根據(jù)步驟打開官網(wǎng)申請?jiān)囉胠icense,注意這一步需要有Atlassian官網(wǎng)賬戶(可以使用google賬戶)

image.png
選擇confluence應(yīng)用,然后輸入web頁面中的license ID,我們試用的是confluence server版本。

image.png
點(diǎn)擊生成license

image.png
輸入license后,選擇數(shù)據(jù)庫,我們試用postgresql外置數(shù)據(jù)庫(Mysql數(shù)據(jù)庫要選擇5.6版本以上,Mysql5.6版本對confluence有bug,參考:https://confluence.atlassian.com/doc/supported-platforms-207488198.html)

image.png

image.png
數(shù)據(jù)庫使用JDBC

image.png
輸入數(shù)據(jù)庫相關(guān)信息:

image.png
點(diǎn)擊下一步,confluence會(huì)自動(dòng)連接數(shù)據(jù)庫并初始化數(shù)據(jù),該過程有點(diǎn)長,注意數(shù)據(jù)庫要配置可以遠(yuǎn)程訪問。

image.png
完成后點(diǎn)擊完成就可以使用confluence了。
3.破解:
將[confluence-home]/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.4.1.jar拷貝出來
并將破解插件atlassian-extras-decoder-v2-3.2.jar放到此目錄下
重啟confluence服務(wù)即可。
4.注意點(diǎn):
1 confluence官方推薦使用普通用戶confluence啟動(dòng)應(yīng)用,所以啟動(dòng)的時(shí)候機(jī)器將[confluence-home]目錄授權(quán)給confluence用戶并啟動(dòng)服務(wù)
2 啟動(dòng)的時(shí)候會(huì)有一個(gè)協(xié)同編輯端口8091,注意如果這個(gè)端口起不來,confluence應(yīng)用不能正常使用
5.啟動(dòng)&關(guān)閉
啟動(dòng)
[confluence-home]/bin/start-confluence.sh
關(guān)閉
[confluence-home]/bin/stop-confluence.sh
6.優(yōu)化
JVM內(nèi)存優(yōu)化:
錯(cuò)誤示范:
#vim/opt/atlassian/confluence/bin/catalina.sh
CATALINA_OPTS="-server-Xms8192m-Xmx8192m-XX:PermSize=1024m-XX:MaxPermSize=1024m
這樣配置confluence有時(shí)候不會(huì)識別
正確:
Vim /opt/atlassian/confluence/bin/[setenv.sh](http://setenv.sh)
CATALINA_OPTS="-Xms16384m -Xmx16384m -XX:+UseG1GC ${CATALINA_OPTS}”
#add heap dump logs
CATALINA_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/confluence/logs ${CATALINA_OPTS}”
JVM線程調(diào)優(yōu)
(48 10 10 )官方標(biāo)配,不建議更改
vim /opt/atlassian/confluence/conf/ server.xml
maxThreads="48" minSpareThreads="10"
enableLookups="false” coacceptCount="10" debug="0" URIEncoding="UTF-8”\
JVM數(shù)據(jù)庫參數(shù)調(diào)優(yōu)
官方標(biāo)配,不建議更改
vim /data/confluence/confluence.cfg.xml
<property name="hibernate.c3p0.max_size">60</property>
7.wiki添加access.log日志
參考:[https://confluence.atlassian.com/confkb/audit-confluence-using-the-tomcat-valve-component-223216846.html](https://confluence.atlassian.com/confkb/audit-confluence-using-the-tomcat-valve-component-223216846.html)
添加(注意添加的位置,如果位置不對服務(wù)有可能無法啟動(dòng)):
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="/data/WIKI-Access-logs" encoding="utf-8" prefix="access_log." fileDateFormat="yyyyMMdd" suffix=".log" pattern="%t %{X-AUSERNAME}o "%{User-Agent}i" %a %h %m %r %b %s %I" />
例子:
<Server port="8000" shutdown="SHUTDOWN" debug="0">
<Service name="Tomcat-Standalone">
<Connector port="8080" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol" />
<Connector port="8081" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol" />
<Engine name="Standalone" defaultHost="localhost" debug="0">
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4">
<Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
<!-- Logger is deprecated in Tomcat 5.5\. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->
<Manager pathname="" />
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" />
</Context>
<Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0" reloadable="false" useHttpOnly="true">
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" />
</Context>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="/data/WIKI-Access-logs" encoding="utf-8" prefix="access_log." fileDateFormat="yyyyMMdd" suffix=".log" pattern="%t %{X-AUSERNAME}o "%{User-Agent}i" %a %h %m %r %b %s %I" />
</Host>
</Engine>
8.備份
參考:https://confluence.atlassian.com/conf613/configuring-backups-964961326.html
注意:xml備份時(shí)不保證XML備份一致,因?yàn)樵趥浞葸^程中可能會(huì)更新數(shù)據(jù)庫。當(dāng)生成具有不一致性的XML備份時(shí),Jira不會(huì)報(bào)告任何警告或錯(cuò)誤消息,并且此類XML備份將在還原過程中失敗。在Jira處于活動(dòng)狀態(tài)時(shí),本機(jī)數(shù)據(jù)庫備份工具提供了更加一致和可靠的存儲(和恢復(fù))數(shù)據(jù)的方法。
confluence:默認(rèn)情況下,每天凌晨2:00進(jìn)行xml備份,默認(rèn)備份路徑為 <shared-home>/backups。此備份是完全備份,可直接恢復(fù)。但是此備份方法僅適用于小型站點(diǎn)。
我目前采用的是【xml備份】+【附件備份+數(shù)據(jù)庫備份+家目錄備份】兩種方式共同使用。
備份腳本如下:
#!/usr/bin/env bash
#wiki備份腳本
#20190306 by chy
remote_IP=192.168.1.203
LogFile=/root/scripts/logs/wiki-backup.log
##wiki將xml完整備份到203遠(yuǎn)程機(jī)器上,并將log輸出到/root/scripts/log/wiki-backup.log中
confluence_dir=/confluence/data/backups/
confluence_remote=/backup/atlassian/confluence/
WIKIBegin=`date +"%Y-%m-%d %H:%M:%S"`
/usr/bin/rsync -avz --progress $confluence_dir root@$remote_IP:$confluence_remote
WIKIEnd=`date +"$%Y-%m-%d %H:%M:%S"`
echo wiki_backup_start:$WIKIBegin end:$WIKIEnd >> $LogFile
##wiki將附件備份到203遠(yuǎn)程機(jī)器上,并將log輸出到wiki-backup.log中
confluence_dir_a=/confluence/data/attachments
confluence_remote_a=/backup/attachments/confluence/
WIKI_a_Begin=`date +"%Y-%m-%d %H:%M:%S"`
/usr/bin/rsync -avz --progress $confluence_dir_a root@$remote_IP:$confluence_remote_a
WIKI_a_End=`date +"$%Y-%m-%d %H:%M:%S"`
echo wiki_backup_start:$WIKI_a_Begin end:$WIKI_a_End >> $LogFile
##wiki將數(shù)據(jù)庫備份到203遠(yuǎn)程機(jī)器上,并將log輸出到wiki-backup.log中
confluence_dir_pg=/backup/pgBackup/confluence
confluence_remote_pg=/backup/database/confluence/
WIKI_pg_Begin=`date +"%Y-%m-%d %H:%M:%S"`
/usr/bin/rsync -avz --progress $confluence_dir_pg root@$remote_IP:$confluence_remote_pg
WIKI_pg_End=`date +"$%Y-%m-%d %H:%M:%S"`
echo wiki_backup_start:$WIKI_pg_Begin end:$WIKI_pg_End >> $LogFile