apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
28.94k stars 10.19k forks source link

使用 H2 内存数据库,自动初始化快速启动失败,日志并没有错误日志,请问这是什么原因? #5104

Closed wallmamami closed 2 months ago

wallmamami commented 3 months ago

快速启动失败。

简洁明了地描述一下bug 如下:使用文档中描述的步骤,H2内存快速初始化,但是启动失败! https://www.apolloconfig.com/#/zh/deployment/quick-start 文档中2-1方式启动。 export SPRING_PROFILES_ACTIVE="github,auth" unset SPRING_SQL_CONFIG_INIT_MODE unset SPRING_SQL_PORTAL_INIT_MODE java -jar apollo-all-in-one.jar

额外的细节和日志

错误日志

:: Spring Boot :: (v2.4.2)

2024-03-13 15:17:04.039 INFO 30701 --- [ main] c.c.f.apollo.assembly.ApolloApplication : Starting ApolloApplication v1.9.0 using Java 1.8.0_322 on VM-12-46-tencentos with PID 30701 (/home/anymatch/apollo/quick-start/apollo-all-in-one.jar started by root in /home/anymatch/apollo/quick-start) 2024-03-13 15:17:04.042 INFO 30701 --- [ main] c.c.f.apollo.assembly.ApolloApplication : The following profiles are active: github,auth 2024-03-13 15:17:05.162 INFO 30701 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=e4e7a962-7e6a-32f7-a9a2-73b8244230aa 2024-03-13 15:17:05.477 INFO 30701 --- [ main] o.s.l.c.support.AbstractContextSource : Property 'userDn' not set - anonymous context will be used for read-write operations 2024-03-13 15:17:05.842 INFO 30701 --- [ main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses Jersey 2024-03-13 15:17:05.932 WARN 30701 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath. 2024-03-13 15:17:05.960 INFO 30701 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING 2024-03-13 15:17:05.985 INFO 30701 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1 2024-03-13 15:17:05.986 INFO 30701 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data. 2024-03-13 15:17:06.080 INFO 30701 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1710314225992 with initial instances count: 0 2024-03-13 15:17:06.085 INFO 30701 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application UNKNOWN with eureka with status UP 2024-03-13 15:17:06.102 INFO 30701 --- [ main] c.c.f.apollo.assembly.ApolloApplication : Started ApolloApplication in 2.697 seconds (JVM running for 3.477) 2024-03-13 15:17:06.105 INFO 30701 --- [ main] c.c.f.apollo.assembly.ApolloApplication : application isActive: true 2024-03-13 15:17:06.106 INFO 30701 --- [extShutdownHook] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application UNKNOWN with eureka with status DOWN 2024-03-13 15:17:06.110 INFO 30701 --- [extShutdownHook] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ... 2024-03-13 15:17:06.140 INFO 30701 --- [extShutdownHook] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient

dosubot[bot] commented 3 months ago

你好,@wallmamami!我是Dosu,一个可以帮助你解决问题、回答问题并成为贡献者的机器人。我在这里帮助你,同时等待人类维护者的回复。现在我将开始查看你的问题,并将很快提供完整的回答。

wallmamami commented 3 months ago

这三个版本试了都是同样的问题 apollo-quick-start-1.9.0 apollo-quick-start-2.1.0 apollo-quick-start-2.2.0

dosubot[bot] commented 3 months ago

Based on the information you've provided and the context from the Apollo repository, it seems like you've followed the correct steps to initialize the H2 memory database for Apollo Quick Start versions 1.9.0, 2.1.0, and 2.2.0.

However, there was a similar issue reported in the Apollo repository titled Column "Cluster" not found error when running apollo quick start with h2. This issue was resolved by a pull request: rename the init.h2.sql to avoid loading wrong files in quick start mode. Although the specific changes made in this pull request are not detailed in the repository, it suggests that there might have been a problem with the initialization files used in quick start mode.

There could be several reasons for Apollo Quick Start failure with the H2 memory database. Some common reasons include SQL syntax compatibility issues, character set and collation settings, data type compatibility, timestamp default values, index prefix lengths, stored procedures and functions, lack of H2-specific optimizations, and configuration and version mismatches.

Unfortunately, without specific error messages or logs, it's difficult to pinpoint the exact cause of the failure you're experiencing. If possible, could you provide more detailed logs or error messages? This would help in identifying the root cause of the issue.

In the meantime, you might want to check the compatibility of your H2 database with the SQL script used by Apollo, especially if it includes platform-specific features or syntax. You could also try to ensure that your H2 database version and configuration match the expectations of the Apollo Quick Start setup.

I hope this information is helpful. Please let me know if you have any other questions or need further clarification.

Sources

#### About Dosu This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
wallmamami commented 3 months ago

2024-03-13 15:08:31.471 INFO 31577 --- [main] c.c.f.apollo.assembly.ApolloApplication : Starting ApolloApplication v1.9.0 using Java 1.8.0_322 on VM-12-46-tencentos with PID 31577 (/home/anymatch/apollo/quick-start/apollo-all-in-one.jar started by root in /home/anymat ch/apollo/quick-start) 2024-03-13 15:08:31.474 INFO 31577 --- [main] c.c.f.apollo.assembly.ApolloApplication : The following profiles are active: github,auth 2024-03-13 15:08:32.606 INFO 31577 --- [main] o.s.cloud.context.scope.GenericScope : BeanFactory id=e4e7a962-7e6a-32f7-a9a2-73b8244230aa 2024-03-13 15:08:32.920 INFO 31577 --- [main] o.s.l.c.support.AbstractContextSource : Property 'userDn' not set - anonymous context will be used for read-write operations 2024-03-13 15:08:33.291 INFO 31577 --- [main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses Jersey 2024-03-13 15:08:33.378 WARN 31577 --- [main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheMana ger to the classpath. 2024-03-13 15:08:33.406 INFO 31577 --- [main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING 2024-03-13 15:08:33.431 INFO 31577 --- [main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1 2024-03-13 15:08:33.433 INFO 31577 --- [main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data. 2024-03-13 15:08:33.537 INFO 31577 --- [main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1710313713438 with initial instances count: 0 2024-03-13 15:08:33.542 INFO 31577 --- [main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application UNKNOWN with eureka with status UP 2024-03-13 15:08:33.561 INFO 31577 --- [main] c.c.f.apollo.assembly.ApolloApplication : Started ApolloApplication in 2.713 seconds (JVM running for 3.487) 2024-03-13 15:08:33.564 INFO 31577 --- [main] c.c.f.apollo.assembly.ApolloApplication : application isActive: true 2024-03-13 15:08:33.565 INFO 31577 --- [SpringContextShutdownHook] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application UNKNOWN with eureka with status DOWN 2024-03-13 15:08:33.570 INFO 31577 --- [SpringContextShutdownHook] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ... 2024-03-13 15:08:33.601 INFO 31577 --- [SpringContextShutdownHook] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient

shoothzj commented 3 months ago

It may be related to https://github.com/spring-cloud/spring-cloud-netflix/issues/3570 I tests the master branch. It works well.

nobodyiam commented 3 months ago

@wallmamami The apollo-all-in-one.jar was not updated to the latest version. You may try it now.

stale[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

stale[bot] commented 2 months ago

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.