Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Cloud Alibaba 填坑小记 #8

Open
RedCrazyGhost opened this issue Jul 5, 2023 · 0 comments
Open

Spring Cloud Alibaba 填坑小记 #8

RedCrazyGhost opened this issue Jul 5, 2023 · 0 comments
Labels
Docker fa-brands fa-docker Java fa-brands fa-java

Comments

@RedCrazyGhost
Copy link
Owner

RedCrazyGhost commented Jul 5, 2023

前提:

Nacos version: 2.0.4

Docker Nacos 容器无法启动。

         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 2.0.4
,`--.'`|  ' :                       ,---.               Running in cluster mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 8848
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 1
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: http://172.17.0.2:8848/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'

2022-10-04 22:25:00,327 INFO The server IP list of Nacos is []

2022-10-04 22:25:01,328 INFO Nacos is starting...

2022-10-04 22:25:02,329 INFO Nacos is starting...

2022-10-04 22:25:03,330 INFO Nacos is starting...

单例模式需要使用MODE=standalone,否则Nacos无法启动!

docker run --name nacos -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:v2.0.4

微服务Spring Boot连接报错

java.util.concurrent.ExecutionException: com.alibaba.nacos.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Caused by: com.alibaba.nacos.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Caused by: com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:9848
Caused by: java.net.ConnectException: Connection refused

docker nacos容器没有映射9848端口。

端口 与主端口的偏移量 描述
9848 1000 客户端gRPC请求服务端端口,用于客户端向服务端发起连接和请求
9849 1001 服务端gRPC请求服务端端口,用于服务间同步等
docker run --name nacos -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:v2.0.4

微服务Spring Boot无法启动

***************************
APPLICATION FAILED TO START
***************************

Description:

No spring.config.import property has been defined

Action:

Add a spring.config.import=nacos: property to your configuration.
	If configuration is not required add spring.config.import=optional:nacos: instead.
	To disable this check, set spring.cloud.nacos.config.import-check.enabled=false.

缺少bootstrap依赖

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
@RedCrazyGhost RedCrazyGhost added Docker fa-brands fa-docker Java fa-brands fa-java labels Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docker fa-brands fa-docker Java fa-brands fa-java
Projects
None yet
Development

No branches or pull requests

1 participant