Giter VIP home page Giter VIP logo

learn-spring-cloud's Introduction

Eureka 实验1

组件:

  • discovery-server-01: standalone 启动
  • time-server-01: 服务提供者
    • 启动时添加参数:server.port 4444 和 server.port 5555 启动两个
  • time-client-01: 服务消费者

Eureka 实验2 -- Eureka Server 集群配置

组件:

  • discovery-server-02: 集群启动
    • 启动时添加参数:spring.active.profile discovery1 和 spring.active.profile discovery2 启动两个
  • time-server-02: 服务提供者
    • 启动时添加参数:server.port 4444 和 server.port 5555 启动两个
  • time-client-02: 服务消费者

Eureka 配置优化

具体看 discovery-server-02 和 time-server-02 中的配置信息

实验3 Feign 的入门案例

组件:

  • feign01: 启动后不需要服务注册,直接访问即可

访问地址:localhost:9090/search/github?str=spring-cloud-dubbo

实验4 Feign 的进阶案例

组件:

  • discovery-server-01: standalone 启动
  • feign-client-02: feign 的客户端
  • feign-client-02: feign 的服务端
    • 替换默认的 http 客户端 --> HttpClient or OkHttp
    • Feign Get 多参数
    • Feign 拦截器的使用 -- 传递 token

实验5 Hystrix 基础实验

组件:

  • hystrix-basic-01

实验样例:

  1. 同步调用testSynchronous
  2. 同步安静失败testSynchronousFailSilently
  3. 同步快速失败testSynchronousFailFast
  4. 异步调用testAsynchronous
  5. 响应式调用testObservable
  6. 缓存调用testWithCacheHist

实验6 Hystrix 官网案例

组件:

  • hystrix-basic-02

是一个模拟交易的实例:

---> GetUserAccount ---> GetPaymentInfo ---> GetOrder ---> PayCreditCard

实验7 Hystrix 和 Feign 结合使用

组件:

  • discovery-server-01: standalone 启动
  • hystrix-feign-01 作为 feign 的客户端,并启用 Hystrix
  • feign-service-02 作为 feign 的服务端

实验有关 feign,hystrix,ribbon 超时与重试的相关配置

实验8 Hystrix 和 Hystrix Dashboard 使用

组件:

  • discovery-server-01: standalone 启动
  • hystrix-feign-01 作为 feign 的客户端,并启用 Hystrix
  • feign-service-02 作为 feign 的服务端
  • hystrix-dashboard-01 作为 hystrix dashboard 的单独应用

实验9 Hystrix 和 turbine 使用

组件:

  • discovery-server-01: standalone 启动
  • hystrix-feign-01 作为 feign 的客户端,并启用 Hystrix
  • feign-service-02 作为 feign 的服务端,启动两个实例,两个端口
    • 8081
    • 8082
  • hystrix-turbines-01 作为 turbine 和 hystrix dashboard 的应用

访问: http://localhost:9001/turbine.stream?cluster=hystrix-feign-service

然后将 http://localhost:9000/turbine.stream?cluster=hystrix-feign-service 这个地址放到 Hystrix Dashboard (http://localhost:9001/hystrix)上去

learn-spring-cloud's People

Contributors

suchaos avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.