springcloudsentinel完美替换hystrix

编程

1.在sentinel-dashboard-1.6.3.jar这个包所在目录运行命令:

java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.6.3.jar

启动成功后访问: http://localhost:8080

Sentinel 控制台引入基本的登录功能,默认用户名和密码都是 sentinel

                                                                                            客户端接入sentinel控制台

1.父工程引入依赖:

<dependency>

<groupId>com.alibaba.cloud</groupId>

<artifactId>spring-cloud-alibaba-dependencies</artifactId>

<version>2.1.0.RELEASE</version>

<type>pom</type>

<scope>import</scope>

</dependency>

2.子工程order和product服务引入依赖:

<dependency>

<groupId>com.alibaba.cloud</groupId>

<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>

</dependency>

3.在order和product服务application.yml配置文件添加配置:

spring:

cloud:

sentinel:

transport:

dashboard: localhost:8080 #sentinel控制台的请求地址

4.访问 http://localhost:8080/

    

以上是 springcloudsentinel完美替换hystrix 的全部内容, 来源链接: utcz.com/z/518038.html

回到顶部