alibaba / spring-cloud-alibaba

Spring Cloud Alibaba provides a one-stop solution for application development for the distributed solutions of Alibaba middleware.
https://sca.aliyun.com
Apache License 2.0
27.47k stars 8.19k forks source link

Client not connected, current status:STARTING #3736

Closed wuwei0727 closed 3 weeks ago

wuwei0727 commented 4 weeks ago

Which Component use pring-cloud-alibaba

Startup error

Screenshots If applicable, add screenshots to help explain your problem. Startup error: PixPin_2024-05-16_15-48-36

docker-compose: PixPin_2024-05-16_15-50-24

springboot nacos yml : PixPin_2024-05-16_15-50-38

aliyun The security group has been released PixPin_2024-05-16_15-51-17

Additional context Add any other context about the problem here.

2.7.13 2021.0.8 2021.0.5.0
wuwei0727 commented 4 weeks ago

Why do I configure the public ip address :8848, but the error message is 127.0.0.1:8848?

yuluo-yx commented 4 weeks ago

if use docker container, pls mapping 9848 port. try again

wuwei0727 commented 4 weeks ago

I mapped it, Ali Cloud also mapped it PixPin_2024-05-17_09-57-10

yuluo-yx commented 4 weeks ago

Can you provide a simple demo?

wuwei0727 commented 4 weeks ago

The gateway connects to the nacos demo

YunNian-Cloud-demo.zip

yuluo-yx commented 4 weeks ago

image

:21.287 [main] INFO  c.a.c.n.r.NacosContextRefresher - [registerNacosListener,129] - [Nacos Config] Listening config: dataId=yunnian-gateway-dev.yml, group=DEFAULT_GROUP
12:22:21.288 [main] INFO  c.a.c.n.r.NacosContextRefresher - [registerNacosListener,129] - [Nacos Config] Listening config: dataId=yunnian-gateway, group=DEFAULT_GROUP
12:22:21.288 [main] INFO  c.a.c.n.r.NacosContextRefresher - [registerNacosListener,129] - [Nacos Config] Listening config: dataId=yunnian-gateway.yml, group=DEFAULT_GROUP
(♥◠‿◠)ノ゙  网关启动成功   ლ(´ڡ`ლ)゙ 
INFO: Sentinel log output type is: file
INFO: Sentinel log charset is: utf-8
INFO: Sentinel log base directory is: C:\Users\Administrator\logs\csp\
INFO: Sentinel log name use pid is: false
INFO: Sentinel log level is: INFO

This is a network issue between the containers, you can check if the nacos container and the gateway container can communicate properly.

wuwei0727 commented 4 weeks ago

ThenThen should I use the container name yunnian-nacos:8848?

I've tried this before. No.

yuluo-yx commented 4 weeks ago

ThenThen should I use the container name yunnian-nacos:8848?

I've tried this before. No.

a simple way, you can run ping yunnian-nacos on gateway app container.

wuwei0727 commented 3 weeks ago

Hello, I configured server-addr: 8.136.114.59:8848 in bootstrap.yml. Why is the value 127.0.0.1:8848 when I start the connection?

wuwei0727 commented 3 weeks ago

PixPin_2024-05-19_12-38-13

yuluo-yx commented 3 weeks ago

PixPin_2024-05-19_12-38-13

What about configuration in application.yml? This may be a bug. You can check that the preconfiguration file is correctly loaded into the

yuluo-yx commented 3 weeks ago

Please take a closer look at your project configuration, I ran the demo you provided locally and it ran successfully without any errors and without changing any configuration properties.

this is my local running log:

15:08:29.076 [main] INFO  c.a.n.c.e.SearchableProperties - [sortPropertySourceDefaultOrder,197] - properties search order:PROPERTIES->JVM->ENV->DEFAULT_SETTING
15:08:29.121 [background-preinit] INFO  o.h.v.i.util.Version - [<clinit>,21] - HV000001: Hibernate Validator 6.2.5.Final
15:08:29.467 [main] INFO  c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.impl.NacosClientAuthServiceImpl success.
15:08:29.468 [main] INFO  c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.ram.RamClientAuthServiceImpl success.
Spring Boot Version: 2.7.13
Spring Application Name: yunnian-gateway

15:08:31.646 [main] WARN  c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[yunnian-gateway] & group[DEFAULT_GROUP]
15:08:31.700 [main] WARN  c.a.c.n.c.NacosPropertySourceBuilder - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[yunnian-gateway.yml] & group[DEFAULT_GROUP]
15:08:31.777 [main] INFO  c.y.g.YunNianGatewayApplication - [logStartupProfileInfo,637] - The following 1 profile is active: "dev"
15:08:36.457 [main] INFO  c.a.c.s.g.s.SentinelSCGAutoConfiguration - [sentinelGatewayFilter,144] - [Sentinel SpringCloudGateway] register SentinelGatewayFilter with order: -2147483648
15:08:36.831 [main] INFO  c.a.c.s.g.s.SentinelSCGAutoConfiguration - [sentinelGatewayBlockExceptionHandler,134] - [Sentinel SpringCloudGateway] register SentinelGatewayBlockExceptionHandler
INFO: Sentinel log output type is: file
INFO: Sentinel log charset is: utf-8
INFO: Sentinel log base directory is: C:\Users\Administrator\logs\csp\
INFO: Sentinel log name use pid is: false
INFO: Sentinel log level is: INFO
15:08:37.058 [main] WARN  o.s.c.l.c.LoadBalancerCacheAutoConfiguration$LoadBalancerCaffeineWarnLogger - [logWarning,83] - Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
15:08:37.077 [main] INFO  c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.impl.NacosClientAuthServiceImpl success.
15:08:37.077 [main] INFO  c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.ram.RamClientAuthServiceImpl success.
15:08:37.442 [main] INFO  c.a.c.s.d.c.SentinelConverter - [convert,79] - converter can not convert rules because source is empty
15:08:39.606 [main] INFO  c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.impl.NacosClientAuthServiceImpl success.
15:08:39.606 [main] INFO  c.a.n.p.a.s.c.ClientAuthPluginManager - [init,56] - [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.ram.RamClientAuthServiceImpl success.
15:08:39.940 [main] INFO  c.a.c.n.r.NacosServiceRegistry - [register,76] - nacos registry, DEFAULT_GROUP yunnian-gateway 192.168.235.1:1080 register finished
15:08:40.138 [main] INFO  c.a.c.n.d.NacosDiscoveryHeartBeatPublisher - [start,66] - Start nacos heartBeat task scheduler.
15:08:40.152 [main] INFO  c.y.g.YunNianGatewayApplication - [logStarted,61] - Started YunNianGatewayApplication in 12.507 seconds (JVM running for 13.522)
15:08:40.156 [main] INFO  c.a.c.n.r.NacosContextRefresher - [registerNacosListener,129] - [Nacos Config] Listening config: dataId=yunnian-gateway-dev.yml, group=DEFAULT_GROUP
15:08:40.156 [main] INFO  c.a.c.n.r.NacosContextRefresher - [registerNacosListener,129] - [Nacos Config] Listening config: dataId=yunnian-gateway, group=DEFAULT_GROUP
15:08:40.156 [main] INFO  c.a.c.n.r.NacosContextRefresher - [registerNacosListener,129] - [Nacos Config] Listening config: dataId=yunnian-gateway.yml, group=DEFAULT_GROUP
(♥◠‿◠)ノ゙  网关启动成功   ლ(´ڡ`ლ)゙ 
15:08:43.424 [RMI TCP Connection(4)-192.168.1.3] INFO  c.a.c.s.d.c.SentinelConverter - [convert,79] - converter can not convert rules because source is empty

btw, You should ensure that the nacos deployed on your server is secure image

wuwei0727 commented 3 weeks ago

Thank you for your patient answer. I can connect to nacos by running gateway locally. My local debug breakpoint read nacos source code configuration and loaded my configuration 8.136.114.59:8848, but the online environment, as you see, reported an error. I see the environmental error on the line: NacosRegistration{nacosDiscoveryProperties=NacosDiscoveryProperties{serverAddr='127.0.0.1:8848', The Client is not connected and current status:STARTING. Why is it 127.0.0.1:8848? I checked the configuration file and there are no configuration errors. Can you give me some ideas for troubleshooting?

yuluo-yx commented 3 weeks ago

Is the online environment configured the same way? dev config file

wuwei0727 commented 3 weeks ago

Yes, the environment is the same online

wuwei0727 commented 3 weeks ago

Oh, by the way, I use docker-compose for my online environment, and I have no problem executing it online using java-jar. But you can't use docker-compose PixPin_2024-05-19_15-31-28

yuluo-yx commented 3 weeks ago

imo, In an online environment, it is possible that the dev configuration file is not loaded correctly, but instead, a default is loaded, which you can see more about in the logs

Looking at the online environment 15:08:31.777 [main] INFO c.y.g.YunNianGatewayApplication - [logStartupProfileInfo,637] - The following 1 profile is active: "dev" What is output here? dev or default

yuluo-yx commented 3 weeks ago

if is default, you can see https://github.com/yuluo-yx/sca-k8s-demo/blob/f4e92d38c4752e7e34cc3e2b1c52dfc8efcdb992/docker-compose/apps/provider/Dockerfile#L18 setting

wuwei0727 commented 3 weeks ago

PixPin_2024-05-19_15-37-54

wuwei0727 commented 3 weeks ago

My environment here is dev

yuluo-yx commented 3 weeks ago

Make sure your config file is loaded correctly, or is it present in the container? It looks like the config file is loaded correctly

yuluo-yx commented 3 weeks ago

maybe you can refer : https://github.com/yuluo-yx/sca-k8s-demo/blob/master/docker-compose/apps/provider/Dockerfile#L18

wuwei0727 commented 3 weeks ago

PixPin_2024-05-20_15-33-39

Hi, I checked docker's network and they are on the same network!

wuwei0727 commented 3 weeks ago

Now I can not locate what is the problem, this problem makes me confused, no idea

wuwei0727 commented 3 weeks ago

Hello, thank you very much! I've solved my problem。 The problem is that the old one was not updated before I built the docker image. The configuration file of the old image was 127.0.0.1, so I just updated the docker image

yuluo-yx commented 3 weeks ago

Hello, thank you very much! I've solved my problem。 The problem is that the old one was not updated before I built the docker image. The configuration file of the old image was 127.0.0.1, so I just updated the docker image

Good job, config file not load or network question.