SpringCloud-Alibaba-(一)入门
一、传送门
Nacos了解
官网:http://nacos.io
中文文档:https://nacos.io/zh-cn/docs/quick-start.html
git:https://github.com/alibaba/spring-cloud-alibaba
介绍:https://yq.aliyun.com/articles/716337?spm=5176.10695662.1996646101.searchclickresult.250814a64tvEu3
开发文档:https://nacos.io/zh-cn/docs/quick-start.html
中文文档:https://github.com/alibaba/spring-cloud-alibaba/blob/master/Roadmap-zh.md
配教程资料:https://blog.51cto.com/9332743/2423285
阿里云镜像:https://help.aliyun.com/document_detail/102512.html
SpringBoot官方使用的starter:https://docs.spring.io/spring-boot/docs/2.1.5.RELEASE/reference/htmlsingle/#using-boot-starter
- 以下为局部的spring 官方的start
SpringBoot-Actuator了解
-
引入pom依赖,并启动项目,看到控制台有两个端点暴露
-
查看导航端点:http://localhost:8080/actuator/
-
health
-
健康检查
-
展示具体的详情需添加:management.endpoint.health.show-details=always
-
status取值:UP-正常,DOWN-遇到问题,OUT_OF_SERVICE-资源未在使用,或者不该去使用,UNKWON-不知道状态
-
/info:描述性端点
-
查看其他常用端点配置
-
actuator常用配置
SpringBoot配置管理优先级(使用中尽量规避优先级,怎么简单怎么玩)
小技巧
- 启动项目前最好 mvn clean install 保证拉取到最新的jar包
- 直接运行jar包程序:java -jar xxxx.jar
- mvn clean install -DskipTests :清理-打包-并跳过单元测试
- 在IDEA中配置的环境变量的jar启动命令:java -jar alibaba-pre-demo-0.0.1-SNAPSHOT.jar --SOME_ENV=always, 其中 --SOME_ENV=always 是配置在IDEA环境变量中的
二、与SpringCloud第一代对比
SpringCloud第一代 | 状态 | SpringCloudAlibaba | 状态 |
---|---|---|---|
Eureka | 2.0孵化失败 | Nacos Discovery | 性能强,感知快 |
Ribbon | 进入维护状态 | ||
Hystrix/HystrixDashboard/Turbine | 进入维护状态 | Sentinel | 可视化配置,上手更简单 |
Zuul | 进入维护状态 | SpringCloud Getway | 性能是zuul的1.6倍 |
SpringCloudConfig | 复杂,约定多,没有界面 | Nacos Config | 搭建简单,有可视化界面 |