搭建流程

参考链接:https://www.cnblogs.com/sanduzxcvbnm/p/13809276.html

下载dockerfile并build

http://nas.sunie.top/files/confluence

wget http://nas.sunie.top/files/confluence/Dockerfile
wget http://nas.sunie.top/files/confluence/atlassian-agent.jar

docker build -t confluence:latest .

启动容器

docker run -d --name confluence \
  --restart always \
  -p 9018:8090 \
  -e TZ="Asia/Shanghai" \
  -v /docker/confluence/data:/var/atlassian/confluence \
  confluence:latest

破解许可证

java -jar atlassian-agent.jar \
  -d -m test@test.com -n BAT \
  -p conf -o http://d.sunie.top:9018 \
  -s BMML-PNU5-K0PF-1G8P

注意-p之后一定是conf,否则会出现下面情况:

title

title

创建mysql数据库并连接

CREATE DATABASE confdb CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
set global tx_isolation='READ-COMMITTED';

title

jdbc:mysql://d.sunie.top:3306/confdb?useUnicode=true&characterEncoding=utf8

title

错误处理

innodb_log_file_size

您的 48MB innodb_log_file_size 太小了。 您应该增加 innodb_log_file_size 到 256M

您的 4MB 数据包太小。 您应该增加 max_allowed_packet 到 34M

编辑/etc/mysql/my.cnf

[mysqld]
innodb_log_file_size=512M
max_allowed_packet=128M

注意一定加上[mysqld],否则启动之后重启不了,一重启就立马停止,为了还原,必须创建一个容器数据卷:

root@sunie:/docker# docker volume create mysql
mysql
root@sunie:/docker# docker volume inspect mysql
[
    {
        "CreatedAt": "2021-09-29T15:55:54+08:00",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/mysql/_data",
        "Name": "mysql",
        "Options": {},
        "Scope": "local"
    }
]

title

应该通过以下方式修改:
https://segmentfault.com/a/1190000040109897

见my.cnf配置示例:https://www.cnblogs.com/niunafei/p/12820909.html

Database connection failed

(base) root@sunye:~# mysql -h 152.136.185.123 -P 9049 -uroot -p
Enter password: 
ERROR 2003 (HY000): Can't connect to MySQL server on '152.136.185.123:3306' (111)

远程访问失效,解决:主要上面的P是大写

https://stackoverflow.com/questions/1420839/cant-connect-to-mysql-server-error-111

‘REPEATABLE-READ’ is no longer supported.

title

每次重启都需要:

docker exec -it mysql mysql -uroot -p
set global tx_isolation='READ-COMMITTED';

https://confluence.atlassian.com/confkb/confluence-fails-to-start-and-throws-mysql-session-isolation-level-repeatable-read-is-no-longer-supported-error-241568536.html