[halo-dev/halo]halo搭建成功,但mysql数据库异常

2024-04-01 441 views
0
是什么版本出现了此问题?

halohub/halo:2.8

使用的什么数据库?

MySQL 8.x

使用的哪种方式部署?

Docker Compose

发生了什么?

采用官方docker-compose.yaml(Halo + MySQL)文件,未做任何修改!!!,成功搭建Halo,网站正常访问,没有异常,但看halo容器运行日志和数据库,发现有报错,数据库里面只有一张“extensions”表!!!???

halo容器报错日志在下方(相关日志输出)

数据库表异常如下: 屏幕截图 2023-08-07 192914

相关日志输出
第一处报错处:
2023-08-07T19:18:47.104+08:00  INFO 7 --- [eReconciler-t-1] r.h.a.e.controller.RequestSynchronizer   : Started request(class run.halo.app.core.extension.Theme) synchronizer.
2023-08-07T19:18:47.106+08:00  INFO 7 --- [         task-1] run.halo.app.search.IndicesInitializer   : Initialized post indices. Usage: StopWatch 'PostIndicesWatch': running time = 854996085 ns; [rebuild] took 854996085 ns = 100%
2023-08-07T19:18:47.367+08:00  WARN 7 --- [rReconciler-t-1] r.h.a.e.controller.DefaultController     : Optimistic locking failure when reconciling request: run.halo.app.core.extension.reconciler.UserReconciler-worker-1/Request[name=admin]
2023-08-07T19:19:36.991+08:00  WARN 7 --- [tReconciler-t-1] r.h.a.e.controller.DefaultController     : Optimistic locking failure when reconciling request: run.halo.app.core.extension.reconciler.PostReconciler-worker-1/Request[name=5152aea5-c2e8-4717-8bba-2263d46e19d5]
2023-08-07T19:19:37.066+08:00  WARN 7 --- [tReconciler-t-1] r.h.a.e.controller.DefaultController     : Optimistic locking failure when reconciling request: run.halo.app.core.extension.reconciler.PostReconciler-worker-1/Request[name=5152aea5-c2e8-4717-8bba-2263d46e19d5]
2023-08-07T19:19:37.864+08:00  INFO 7 --- [tor-tcp-epoll-2] org.wltea.analyzer.dic.Dictionary        : 加载扩展停止词典:org/wltea/analyzer/dic/stopword.dic
2023-08-07T19:19:39.360+08:00 ERROR 7 --- [or-http-epoll-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [e4ad11dd-43] 500 Server Error for HTTP POST "/apis/api.console.halo.run/v1alpha1/plugins/install"
java.lang.IllegalArgumentException: `detail` is required
    at org.springframework.util.Assert.notNull(Assert.java:204) ~[spring-core-6.0.11.jar:6.0.11]
    at org.springframework.web.DefaultErrorResponseBuilder.<init>(DefaultErrorResponseBuilder.java:57) ~[spring-web-6.0.11.jar:6.0.11]
    at org.springframework.web.ErrorResponse.builder(ErrorResponse.java:177) ~[spring-web-6.0.11.jar:6.0.11]
附加信息

官方docker-compose文件,未作任何修改: version: "3"

services: halo: image: halohub/halo:2.8 container_name: halo restart: on-failure:3 depends_on: halodb: condition: service_healthy networks: halo_network: volumes:

  • ./:/root/.halo2 ports:
  • "8090:8090" healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"] interval: 30s timeout: 5s retries: 5 start_period: 30s command:
  • --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo
  • --spring.r2dbc.username=root MySQL 的密码,请保证与下方 MYSQL_ROOT_PASSWORD 的变量值一致。
  • --spring.r2dbc.password=o#DwN&JSa56
  • --spring.sql.init.platform=mysql 外部访问地址,请根据实际需要修改
  • --halo.external-url=http://localhost:8090/ 初始化的超级管理员用户名
  • --halo.security.initializer.superadminusername=admin 初始化的超级管理员密码
  • --halo.security.initializer.superadminpassword=P@88w0rd

    halodb: image: mysql:8.0.31 container_name: halodb restart: on-failure:3 networks: halo_network: command:

  • --default-authentication-plugin=mysql_native_password
  • --character-set-server=utf8mb4
  • --collation-server=utf8mb4_general_ci
  • --explicit_defaults_for_timestamp=true volumes:
  • ./mysql:/var/lib/mysql
  • ./mysqlBackup:/data/mysqlBackup ports:
  • "3306:3306" healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"] interval: 3s retries: 5 start_period: 30s environment: 请修改此密码,并对应修改上方 Halo 服务的 SPRING_R2DBC_PASSWORD 变量值
  • MYSQL_ROOT_PASSWORD=o#DwN&JSa56
  • MYSQL_DATABASE=halo

networks: halo_network:

完整halo容器日志: halo_logs.txt

回答

4

在WSL2 debian系统下和群晖系统下,都会出现这样的问题,其他系统环境未测试

5

那容器日志显示的报错又是什么原因?

8

界面上有任何异常吗? 初始化之后的插件状态是否正常?因为从日志来看,这是在安装初始化插件时抛出的异常,因为乐观锁的原因可能需要重试安装插件和启动插件,直到启动为止。所以如果初始化之后插件状态是正常的,那么就可以忽略掉这个日志。

2023-08-07T19:19:40.675+08:00  INFO 7 --- [nReconciler-t-1] org.pf4j.AbstractPluginManager           : Plugin 'PluginSearchWidget@1.1.0' resolved
2023-08-07T19:19:40.753+08:00  WARN 7 --- [nReconciler-t-1] r.h.a.e.controller.DefaultController     : Optimistic locking failure when reconciling request: run.halo.app.core.extension.reconciler.PluginReconciler-worker-1/Request[name=PluginSearchWidget]
2023-08-07T19:19:40.890+08:00  INFO 7 --- [nReconciler-t-1] org.pf4j.AbstractPluginManager           : Plugin 'PluginSitemap@1.0.2' resolved
2023-08-07T19:19:40.945+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.HaloPluginManager    : Start plugin 'PluginSitemap@1.0.2'
2023-08-07T19:19:40.979+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.BasePlugin           : Initialized plugin PluginSitemap
2023-08-07T19:19:41.064+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.HaloPluginManager    : Start plugin 'PluginSearchWidget@1.1.0'
2023-08-07T19:19:41.077+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.BasePlugin           : Initialized plugin PluginSearchWidget
2023-08-07T19:19:54.312+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.HaloPluginManager    : Start plugin 'PluginCommentWidget@1.7.0'
2023-08-07T19:19:54.330+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.BasePlugin           : Initialized plugin PluginCommentWidget
2023-08-07T19:19:54.459+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.HaloPluginManager    : Start plugin 'PluginFeed@1.1.1'
2023-08-07T19:19:54.480+08:00  INFO 7 --- [nReconciler-t-1] run.halo.app.plugin.BasePlugin           : Initialized plugin PluginFeed

从尾部的日志来看,初始化的插件应该是正常的。

0

默认的那几个插件功能都正常

3

那这就是我上面说的正常表现。