halo-dev / halo

强大易用的开源建站工具。
https://www.halo.run
GNU General Public License v3.0
33.94k stars 9.69k forks source link

群晖 docker-compose 部署 halo2.2.1 报错 #3389

Closed lipanpan-hub closed 1 year ago

lipanpan-hub commented 1 year ago

是什么版本出现了此问题?

2.2.1

使用的什么数据库?

PostgreSQL

使用的哪种方式部署?

Docker-Compose

在线站点地址

No response

发生了什么?

ash-4.4# cat docker-compose.yml 
version: "3"

services:
  halo:
    image: halohub/halo:2.2.1
    container_name: halo2pg
    restart: on-failure:3
    depends_on:
      halodb:
        condition: service_healthy
    networks:
      halo_network:
    volumes:
      - ./halo2:/root/.halo2
    ports:
      - "8091:8090"
    command:
      - --spring.r2dbc.url=r2dbc:pool:postgresql://halodb:65432/halo
      - --spring.r2dbc.username=halo
      # PostgreSQL 的密码,请保证与下方 POSTGRES_PASSWORD 的变量值一致。
      - --spring.r2dbc.password=openpostgresql
      - --spring.sql.init.platform=postgresql
      # 外部访问地址,请根据实际需要修改
      - --halo.external-url=http://192.168.31.52:8091/
      # 初始化的超级管理员用户名
      - --halo.security.initializer.superadminusername=admin
      # 初始化的超级管理员密码
      - --halo.security.initializer.superadminpassword=P@88w0rd
  halodb:
    image: postgres:latest
    container_name: halo2db
    restart: on-failure:3
    networks:
      halo_network:
    volumes:
      - ./db:/var/lib/postgresql/data
    ports:
      - "65432:5432"
    healthcheck:
      test: [ "CMD", "pg_isready" ]
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      - POSTGRES_PASSWORD=openpostgresql
      - POSTGRES_USER=halo
      - POSTGRES_DB=halo
      - PGUSER=halo

networks:
  halo_network:

数据库能起来 halo起来之后重启三次 然后halo容器终止 用 mysql 测试 部署同样的问题
不使用数据库容器 仅使用 docker run 运行halo 2.2.1容器 则能够正常运行和使用

相关日志输出

Version: 2.2.1
2023-02-24T17:07:53.143+08:00  INFO 7 --- [           main] run.halo.app.Application                 : Starting Application v2.2.1 using Java 17.0.6 with PID 7 (/application/BOOT-INF/classes started by root in /application)
2023-02-24T17:07:53.146+08:00  INFO 7 --- [           main] run.halo.app.Application                 : No active profile set, falling back to 1 default profile: "default"
2023-02-24T17:07:54.537+08:00  INFO 7 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-02-24T17:07:54.538+08:00  INFO 7 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.
2023-02-24T17:07:54.727+08:00  INFO 7 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 180 ms. Found 1 R2DBC repository interfaces.
2023-02-24T17:07:55.434+08:00  INFO 7 --- [           main] c.g.j.r.m.MysqlConnectionFactoryProvider : set jasync.mysql.CLIENT_FOUND_ROWS=true
2023-02-24T17:07:56.492+08:00  INFO 7 --- [           main] org.pf4j.DefaultPluginStatusProvider     : Enabled plugins: []
2023-02-24T17:07:56.494+08:00  INFO 7 --- [           main] org.pf4j.DefaultPluginStatusProvider     : Disabled plugins: []
2023-02-24T17:07:56.497+08:00  INFO 7 --- [           main] org.pf4j.DefaultPluginManager            : PF4J version 3.9.0 in 'deployment' mode
2023-02-24T17:07:58.499+08:00  INFO 7 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 4 endpoint(s) beneath base path '/actuator'
2023-02-24T17:07:58.941+08:00  WARN 7 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/R2dbcInitializationConfiguration.class]: Failed to execute database script
2023-02-24T17:07:58.944+08:00  INFO 7 --- [           main] r.h.a.e.c.DefaultControllerManager       : Shutting down 0 controllers...
2023-02-24T17:07:58.944+08:00  INFO 7 --- [           main] r.h.a.e.c.DefaultControllerManager       : Shutdown 0 controllers.
2023-02-24T17:07:58.945+08:00  INFO 7 --- [           main] r.h.a.e.controller.DefaultController     : Disposing controller garbage-collector-controller
2023-02-24T17:07:58.945+08:00  INFO 7 --- [           main] r.h.a.e.controller.DefaultController     : Controller garbage-collector-controller is disposed
2023-02-24T17:07:58.946+08:00  WARN 7 --- [pool-5-thread-1] run.halo.app.metrics.VisitLogWriter      : VisitLogWrite thread [pool-5-thread-1] interrupted
2023-02-24T17:07:58.977+08:00  INFO 7 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-02-24T17:07:58.997+08:00 ERROR 7 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/autoconfigure/sql/init/R2dbcInitializationConfiguration.class]: Failed to execute database script
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[spring-beans-6.0.4.jar:6.0.4]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-6.0.4.jar:6.0.4]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.4.jar:6.0.4]
        at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-3.0.2.jar:3.0.2]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.2.jar:3.0.2]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.2.jar:3.0.2]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.2.jar:3.0.2]
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150) ~[spring-boot-3.0.2.jar:3.0.2]
        at run.halo.app.Application.main(Application.java:28) ~[classes/:2.2.1]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[application/:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:95) ~[application/:na]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[application/:na]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[application/:na]
Caused by: org.springframework.r2dbc.connection.init.UncategorizedScriptException: Failed to execute database script
        at org.springframework.r2dbc.connection.init.DatabasePopulator.lambda$populate$4(DatabasePopulator.java:65) ~[spring-r2dbc-6.0.4.jar:6.0.4]
        at reactor.core.publisher.Mono.lambda$onErrorMap$27(Mono.java:3749) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.Mono.lambda$onErrorResume$29(Mono.java:3839) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoUsingWhen$ResourceSubscriber.onError(MonoUsingWhen.java:203) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.Operators.error(Operators.java:198) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoError.subscribe(MonoError.java:53) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.Mono.subscribe(Mono.java:4444) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxRetry$RetrySubscriber.onError(FluxRetry.java:95) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.pool.AbstractPool$Borrower.fail(AbstractPool.java:475) ~[reactor-pool-1.0.0.jar:1.0.0]
        at reactor.pool.SimpleDequePool.lambda$drainLoop$9(SimpleDequePool.java:429) ~[reactor-pool-1.0.0.jar:1.0.0]
        at reactor.core.publisher.FluxDoOnEach$DoOnEachSubscriber.onError(FluxDoOnEach.java:186) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onError(FluxMapFuseable.java:340) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onError(FluxContextWrite.java:121) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoSingle$SingleSubscriber.onError(MonoSingle.java:150) ~[reactor-core-3.5.2.jar:3.5.2]
        at io.r2dbc.postgresql.util.FluxDiscardOnCancel$FluxDiscardOnCancelSubscriber.onError(FluxDiscardOnCancel.java:97) ~[r2dbc-postgresql-1.0.0.RELEASE.jar:1.0.0.RELEASE]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.Operators.error(Operators.java:198) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoError.subscribe(MonoError.java:53) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.Mono.subscribe(Mono.java:4444) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoDelayUntil$DelayUntilCoordinator.onError(MonoDelayUntil.java:200) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:142) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoCreate$DefaultMonoSink.error(MonoCreate.java:201) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.netty.resources.NewConnectionProvider$DisposableConnect.onError(NewConnectionProvider.java:154) ~[reactor-netty-core-1.1.2.jar:1.1.2]
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:241) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:315) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.Operators.error(Operators.java:198) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.MonoError.subscribe(MonoError.java:53) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.Mono.subscribe(Mono.java:4444) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.netty.transport.TransportConnector$MonoChannelPromise.tryFailure(TransportConnector.java:587) ~[reactor-netty-core-1.1.2.jar:1.1.2]
        at reactor.netty.transport.TransportConnector$MonoChannelPromise.setFailure(TransportConnector.java:541) ~[reactor-netty-core-1.1.2.jar:1.1.2]
        at reactor.netty.transport.TransportConnector.lambda$doConnect$7(TransportConnector.java:265) ~[reactor-netty-core-1.1.2.jar:1.1.2]
        at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:118) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.fulfillConnectPromise(AbstractEpollChannel.java:674) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:693) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:567) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:489) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:397) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
        Suppressed: java.lang.Exception: #block terminated with an error
                at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99) ~[reactor-core-3.5.2.jar:3.5.2]
                at reactor.core.publisher.Mono.block(Mono.java:1710) ~[reactor-core-3.5.2.jar:3.5.2]
                at org.springframework.boot.r2dbc.init.R2dbcScriptDatabaseInitializer.runScripts(R2dbcScriptDatabaseInitializer.java:68) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.runScripts(AbstractScriptDatabaseInitializer.java:146) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.applyScripts(AbstractScriptDatabaseInitializer.java:108) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.applySchemaScripts(AbstractScriptDatabaseInitializer.java:98) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.initializeDatabase(AbstractScriptDatabaseInitializer.java:76) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.sql.init.AbstractScriptDatabaseInitializer.afterPropertiesSet(AbstractScriptDatabaseInitializer.java:66) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[spring-beans-6.0.4.jar:6.0.4]
                at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915) ~[spring-context-6.0.4.jar:6.0.4]
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.4.jar:6.0.4]
                at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-3.0.2.jar:3.0.2]
                at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150) ~[spring-boot-3.0.2.jar:3.0.2]
                at run.halo.app.Application.main(Application.java:28) ~[classes/:2.2.1]
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
                at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
                at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[application/:na]
                at org.springframework.boot.loader.Launcher.launch(Launcher.java:95) ~[application/:na]
                at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[application/:na]
                at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[application/:na]
Caused by: org.springframework.dao.DataAccessResourceFailureException: Failed to obtain R2DBC Connection
        at org.springframework.r2dbc.connection.ConnectionFactoryUtils.lambda$getConnection$0(ConnectionFactoryUtils.java:90) ~[spring-r2dbc-6.0.4.jar:6.0.4]
        at reactor.core.publisher.Mono.lambda$onErrorMap$28(Mono.java:3763) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94) ~[reactor-core-3.5.2.jar:3.5.2]
        ... 47 common frames omitted
Caused by: io.r2dbc.postgresql.PostgresqlConnectionFactory$PostgresConnectionException: Cannot connect to halodb/<unresolved>:65432
        at io.r2dbc.postgresql.PostgresqlConnectionFactory.cannotConnect(PostgresqlConnectionFactory.java:188) ~[r2dbc-postgresql-1.0.0.RELEASE.jar:1.0.0.RELEASE]
        at io.r2dbc.postgresql.PostgresqlConnectionFactory.lambda$doCreateConnection$7(PostgresqlConnectionFactory.java:153) ~[r2dbc-postgresql-1.0.0.RELEASE.jar:1.0.0.RELEASE]
        at reactor.core.publisher.Mono.lambda$onErrorMap$28(Mono.java:3763) ~[reactor-core-3.5.2.jar:3.5.2]
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94) ~[reactor-core-3.5.2.jar:3.5.2]
        ... 32 common frames omitted
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: halodb/192.168.112.2:65432
Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
        at io.netty.channel.unix.Errors.newConnectException0(Errors.java:155) ~[netty-transport-native-unix-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128) ~[netty-transport-native-unix-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.unix.Socket.finishConnect(Socket.java:359) ~[netty-transport-native-unix-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:710) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:687) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:567) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:489) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:397) ~[netty-transport-classes-epoll-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
        at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]

附加信息

No response

lipanpan-hub commented 1 year ago

有没有大佬 知道是什么问题的? 如何解决这个?

ruibaby commented 1 year ago
- --spring.r2dbc.url=r2dbc:pool:postgresql://halodb:65432/halo
+ --spring.r2dbc.url=r2dbc:pool:postgresql://halodb:5432/halo

这两个容器已经在同一个 Network,所以不要使用外部映射端口,仍然需要使用容器内的端口(5432)去连接数据库。

/kind support

lipanpan-hub commented 1 year ago
- --spring.r2dbc.url=r2dbc:pool:postgresql://halodb:65432/halo
+ --spring.r2dbc.url=r2dbc:pool:postgresql://halodb:5432/halo

这两个容器已经在同一个 Network,所以不要使用外部映射端口,仍然需要使用容器内的端口(5432)去连接数据库。

/kind support

确实是这样 感谢大佬指点