guochao 63fc09dd14 first | 5 anni fa | |
---|---|---|
.idea | 5 anni fa | |
.mvn | 5 anni fa | |
src | 5 anni fa | |
target | 5 anni fa | |
.DS_Store | 5 anni fa | |
HELP.md | 5 anni fa | |
README.md | 5 anni fa | |
demo.iml | 5 anni fa | |
gateway-demo.iml | 5 anni fa | |
mvnw | 5 anni fa | |
mvnw.cmd | 5 anni fa | |
pom.xml | 5 anni fa |
启动说明:https://github.com/alibaba/nacos
Step 1: Download the binary package
1. 下载地址: https://github.com/alibaba/nacos/releases/download/1.1.4/nacos-server-1.1.4.zip
2. 解压:unzip nacos-server-1.0.0.zip
3. 进入bin目录:cd nacos/bin
Step 2: Start Server
sh startup.sh -m standalone(On the Linux/Unix/Mac platform)
OR
cmd startup.cmd -m standalone(cmd startup.cmd -m standalone)
Step 3: Access Server
http://127.0.0.1:8848/nacos
用户名和密码均为:nacos
服务模板git clone 链接:git@github.com:guo00guo/nacos-registry-template.git
需要的依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<!-- Nacos Client -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
新建application.yml
sleep: 0
# 配置输出日志
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG
org.springframework.web.reactive: DEBUG
reactor.ipc.netty: DEBUG
#开启端点
management:
endpoints:
web:
exposure:
include: '*'
security:
enabled: false
bootstrap.yaml
server:
port: 8082
spring:
application:
#注册到nacos时的服务名称
name: nacos-registry-template
cloud:
nacos:
discovery:
# 指定nacos server的地址
server-addr: 127.0.0.1:8848
# actuator相关配置
management:
endpoints:
web:
exposure:
# 暴露所有监控端点
include: '*'
endpoint:
health:
# 总是显示健康检测详情
show-details: always
启动服务控制台显示
2019-11-11 14:48:02.167 INFO 31299 --- [ main] c.a.c.n.registry.NacosServiceRegistry : nacos registry, nacos-registry-template 10.0.0.38:8082 register finished
打开nacos控制台查看是否注册成功
进入http://127.0.0.1:8848/nacos
点击左侧“服务管理”---“服务列表”
若出现刚启动服务的信息则接入成功