Spring Boot Cloud

基于 Spring Boot、Spring Cloud、Spring Oauth2 和 Spring Cloud Netflix 等框架构建的微服务项目
Alternatives To Spring Boot Cloud
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Spring Cloud Netflix4,8003,267623 days ago49July 27, 2023103apache-2.0Java
Integration with Netflix OSS components
Spring Cloud Rest Tcc2,474
4 years agoJava
以Spring Cloud Netflix作为服务治理基础, 展示基于tcc思想所实现的分布式事务解决方案
Spring Boot Cloud1,944
4 years ago22Java
基于 Spring Boot、Spring Cloud、Spring Oauth2 和 Spring Cloud Netflix 等框架构建的微服务项目
User Guide Springcloud1,377
5 years ago9other
[Cloudframeworks]Microservices Architecture with Spring Cloud - user guide / [云框架]基于Spring Cloud的微服务架构-用户指南
Roncoo Education1,122
4 days ago2mitJava
领课教育系统(roncoo-education)是基于领课网络多年的在线教育平台开发和运营经验打造出来的产品,致力于打造一个各行业都适用的分布式在线教育系统。系统采用前后端分离模式,前台采用vue.js为核心框架,后台采用Spring Cloud为核心框架。系统目前主要功能有课程点播功能,支持多家视频云的接入,课程附件管理功能,支持多家存储云的接入,讲师管理功能,支持讲师入驻功能,可以帮助个人或者企业快速搭建一个轻量级的在线教育平台。
Spring Cloud Netflix Example741
3 years ago4mitJava
spring-cloud-netflix-example is an example for microservices system
Jhipster Registry686
2 days ago17apache-2.0TypeScript
JHipster Registry, based on Spring Cloud Netflix Eureka and Spring Cloud Config
Microservice_arch_springcloud225
a year ago2apache-2.0Java
基于SpringCloud实现的微服务架构示例工程。《软件架构探索》的配套组件。
Spring Cloud Tutorial168
5 years ago
Spring Cloud Tutorial.《Spring Cloud 教程》
J360 Cloud All165
7 years ago2Java
spring cloud独立功能介绍和demo 分布式配置服务器、客户端、服务发现、负载均衡、断路器Hytrix
Alternatives To Spring Boot Cloud
Select To Compare


Alternative Project Comparisons
Readme

基于 Spring Cloud 的微服务架构

本项目是一个基于 Spring Boot、Spring Cloud、Spring Oauth2 和 Spring Cloud Netflix 等框架构建的微服务项目。

技术栈

  • Spring boot - 微服务的入门级微框架,用来简化 Spring 应用的初始搭建以及开发过程。
  • Eureka - 云端服务发现,一个基于 REST 的服务,用于定位服务,以实现云端中间层服务发现和故障转移。
  • Spring Cloud Config - 配置管理工具包,让你可以把配置放到远程服务器,集中化管理集群配置,目前支持本地存储、Git 以及 Subversion。
  • Hystrix - 熔断器,容错管理工具,旨在通过熔断机制控制服务和第三方库的节点,从而对延迟和故障提供更强大的容错能力。
  • Zuul - Zuul 是在云平台上提供动态路由,监控,弹性,安全等边缘服务的框架。Zuul 相当于是设备和 Netflix 流应用的 Web 网站后端所有请求的前门。
  • Spring Cloud Bus - 事件、消息总线,用于在集群(例如,配置变化事件)中传播状态变化,可与 Spring Cloud Config 联合实现热部署。
  • Spring Cloud Sleuth - 日志收集工具包,封装了 Dapper 和 log-based 追踪以及 Zipkin 和 HTrace 操作,为 SpringCloud 应用实现了一种分布式追踪解决方案。
  • Ribbon - 提供云端负载均衡,有多种负载均衡策略可供选择,可配合服务发现和断路器使用。
  • Turbine - Turbine 是聚合服务器发送事件流数据的一个工具,用来监控集群下 hystrix 的 metrics 情况。
  • Spring Cloud Stream - Spring 数据流操作开发包,封装了与 Redis、Rabbit、Kafka 等发送接收消息。
  • Feign - Feign 是一种声明式、模板化的 HTTP 客户端。
  • Spring Cloud OAuth2 - 基于 Spring Security 和 OAuth2 的安全工具包,为你的应用程序添加安全控制。

应用架构

该项目包含 8 个服务

  • registry - 服务注册与发现
  • config - 外部配置
  • monitor - 监控
  • zipkin - 分布式跟踪
  • gateway - 代理所有微服务的接口网关
  • auth-service - OAuth2 认证服务
  • svca-service - 业务服务A
  • svcb-service - 业务服务B

体系架构

architecture

应用组件

components

启动项目

  • 使用 Docker 快速启动
    1. 配置 Docker 环境
    2. mvn clean package 打包项目及 Docker 镜像
    3. 在项目根目录下执行 docker-compose up -d 启动所有项目
  • 本地手动启动
    1. 配置 rabbitmq
    2. 修改 hosts 将主机名指向到本地
      127.0.0.1 registry config monitor rabbitmq auth-service
      或者修改各服务配置文件中的相应主机名为本地 ip
    3. 启动 registry、config、monitor、zipkin
    4. 启动 gateway、auth-service、svca-service、svcb-service

项目预览

注册中心

访问 http://localhost:8761/ 默认账号 user,密码 password

registry

监控

访问 http://localhost:8040/ 默认账号 admin,密码 admin

控制面板

monitor

应用注册历史

monitor

Turbine Hystrix面板

monitor

应用信息、健康状况、垃圾回收等详情

monitor

计数器

monitor

查看和修改环境变量

monitor

管理 Logback 日志级别

monitor

查看并使用 JMX

monitor

查看线程

monitor

认证历史

monitor

查看 Http 请求轨迹

monitor

Hystrix 面板

monitor

链路跟踪

访问 http://localhost:9411/ 默认账号 admin,密码 admin

控制面板

zipkin

链路跟踪明细

zipkin

服务依赖关系

zipkin

RabbitMQ 监控

Docker 启动访问 http://localhost:15673/ 默认账号 guest,密码 guest(本地 rabbit 管理系统默认端口15672)

rabbit

接口测试

  1. 获取 Token
curl -X POST -vu client:secret http://localhost:8060/uaa/oauth/token -H "Accept: application/json" -d "password=password&username=anil&grant_type=password&scope=read%20write"

返回如下格式数据:

{
  "access_token": "eac56504-c4f0-4706-b72e-3dc3acdf45e9",
  "token_type": "bearer",
  "refresh_token": "da1007dc-683c-4309-965d-370b15aa4aeb",
  "expires_in": 3599,
  "scope": "read write"
}
  1. 使用 access token 访问 service a 接口
curl -i -H "Authorization: Bearer eac56504-c4f0-4706-b72e-3dc3acdf45e9" http://localhost:8060/svca

返回如下数据:

svca-service (172.18.0.8:8080)===>name:zhangxd
svcb-service (172.18.0.2:8070)===>Say Hello
  1. 使用 access token 访问 service b 接口
curl -i -H "Authorization: Bearer eac56504-c4f0-4706-b72e-3dc3acdf45e9" http://localhost:8060/svcb

返回如下数据:

svcb-service (172.18.0.2:8070)===>Say Hello
  1. 使用 refresh token 刷新 token
curl -X POST -vu client:secret http://localhost:8060/uaa/oauth/token -H "Accept: application/json" -d "grant_type=refresh_token&refresh_token=da1007dc-683c-4309-965d-370b15aa4aeb"

返回更新后的 Token:

{
  "access_token": "63ff57ce-f140-482e-ba7e-b6f29df35c88",
  "token_type": "bearer",
  "refresh_token": "da1007dc-683c-4309-965d-370b15aa4aeb",
  "expires_in": 3599,
  "scope": "read write"
}
  1. 刷新配置
curl -X POST -vu user:password http://localhost:8888/bus/refresh
Popular Netflix Projects
Popular Spring Projects
Popular Companies Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Java
Cloud Computing
Token
Spring
Oauth
Consul
Spring Cloud
Netflix
Hystrix
Zuul
Zipkin
Feign
Spring Cloud Netflix
Spring Boot Admin
Spring Cloud Sleuth