Closed HuangDayu closed 4 years ago
LOCAL_SNAPSHOT_PATH:C:\Users\Administrator\nacos\config
does not exist !!!
I have configured a remote nacos server , Why go to get the local configuration file ? The application environment should not require nacos server .
2020-06-21 14:34:29.101 ERROR 9536 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-06-21 14:34:33.108 ERROR 9536 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-06-21 14:34:37.115 ERROR 9536 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-06-21 14:34:41.121 ERROR 9536 --- [-localhost_8848] c.a.n.c.config.http.ServerHttpAgent : [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect
2020-06-21 14:34:41.121 ERROR 9536 --- [-localhost_8848] c.a.n.client.config.impl.ClientWorker : [fixed-localhost_8848] [check-update] get changed dataId exception
java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached
at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost(ServerHttpAgent.java:170) ~[nacos-client-1.2.1.jar:na]
at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpPost(MetricsHttpAgent.java:64) ~[nacos-client-1.2.1.jar:na]
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateConfigStr(ClientWorker.java:386) [nacos-client-1.2.1.jar:na]
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateDataIds(ClientWorker.java:354) [nacos-client-1.2.1.jar:na]
at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:521) [nacos-client-1.2.1.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_144]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_144]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_144]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
I did not configure this address http://localhost:8848
, but nacos client has been constantly requesting this address.
cloud:
nacos:
config:
enabled: false
When I turn off the config function, the first thing after the application starts is to request the address :http://localhost:8848
.
In our environment, it didn't happen. My suggestion is check configuration. Or have a debug and find out why the configuration is not available.
Found the reason.
When I add different configuration files for different environments, for example:
application-dev.yaml
application-test.yaml
application-prod.yaml
Then configure the profiles in bootstrap.yaml
, for example:
spring:
main:
allow-bean-definition-overriding: true
profiles:
active: dev
The configuration of nacos config is in application-dev.yaml
, then the configuration of nacos config does not take effect.
When reading the configuration, does not support reading the corresponding configuration file according to spring.profiles.active
?
spring:
main:
allow-bean-definition-overriding: true
profiles:
active: dev
application:
name: service-***
cloud:
config:
enabled: false
discovery:
enabled: false
service-id: cloud-config
profile: dev,test,prod
nacos:
config:
enabled: false
spring:
cloud:
nacos:
config:
enabled: true
server-addr: test.***.com:8848
group: springcloud
discovery:
enabled: true
server-addr: test.***.com:8848
group: springcloud
metadata:
instance-id: ${spring.application.name}-${spring.cloud.client.ip-address}:${server.port}
2020-06-22 10:52:31.833 INFO 5856 --- [ main] c.a.s.voice.VoiceServiceApplication : The following profiles are active: dev
2020-06-22 10:52:33 JRebel: Cannot monitor properties in resource URL [jar:file:/D:/maven/repo/org/springframework/integration/spring-integration-core/5.1.6.RELEASE/spring-integration-core-5.1.6.RELEASE.jar!/META-INF/spring.integration.default.properties]
2020-06-22 10:52:33.637 WARN 5856 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'nacos-config' contains invalid characters, please migrate to a valid format.
2020-06-22 10:52:33.643 WARN 5856 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'nacos-discovery' contains invalid characters, please migrate to a valid format.
......
2020-06-22 10:52:50.439 INFO 5856 --- [ main] c.a.n.c.c.impl.LocalConfigInfoProcessor : LOCAL_SNAPSHOT_PATH:C:\Users\Action9\nacos\config
2020-06-22 10:52:50.458 INFO 5856 --- [ main] c.a.nacos.client.config.impl.Limiter : limitTime:5.0
2020-06-22 10:52:50.621 WARN 5856 --- [ main] c.a.c.n.c.NacosPropertySourceBuilder : Ignore the empty nacos configuration and get it based on dataId[service-***] & group[springcloud]
2020-06-22 10:52:50.652 WARN 5856 --- [ main] c.a.c.n.c.NacosPropertySourceBuilder : Ignore the empty nacos configuration and get it based on dataId[service-***.properties] & group[springcloud]
2020-06-22 10:52:50.677 WARN 5856 --- [ main] c.a.c.n.c.NacosPropertySourceBuilder : Ignore the empty nacos configuration and get it based on dataId[service-***-dev.properties] & group[springcloud]
2020-06-22 10:52:50.677 INFO 5856 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='service-***-dev.properties,springcloud'}, NacosPropertySource {name='service-***.properties,springcloud'}, NacosPropertySource {name='service-***,springcloud'}]}
When I turn off nacos config in bootstrap.yaml
and open nacos config in application-dev.yaml
, after the application starts, I don’t get the local configuration file like the previous one, but after the application is started, it will still get the remote configuration file for test.***.com:8848
.
Is there a relationship between bootstrap.yaml
and application-dev.yaml
reading two configuration files ?
I see, thanks.
Issue Description
currentServerAddr:http://localhost:8848
.Error Log
pom
yml