docker部署sentinel

一、安装sentinel

//拉去sentinel镜像
docker pull bladex/sentinel-dashboard:1.8.0

# 开放端口
firewall-cmd --add-port=8858/tcp --zone=public --permanent
firewall-cmd --add-port=8719/tcp --zone=public --permanent

# 重启防火墙
firewall-cmd --reload


//启动容器
docker run --name sentinel  -d -p 8858:8858 -p 8719:8719 -d bladex/sentinel-dashboard:1.8.0 -e username=sentinel -e password=sentinel -e server=localhost:8858

//容器退出时总是重启容器
docker update --restart=always sentinel

//查看容器日志
docker logs sentinel

二、整合springCloud-alibaba

pom.xml引入坐标

<!--sentinel 熔断降级-->
<dependency>
   <groupId>com.alibaba.cloud</groupId>
   <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>

application.yml 配置sentinel
注意:yml配置client-ip 是本地ip才行

spring:
    cloud:
        nacos:
            discovery:
                username: nacos
                password: nacos
                namespace: public
            server-addr: 127.0.0.1:8848
        sentinel:
            transport:
                dashboard: 192.168.32.131:8858
                client-ip: 192.168.32.1
                port: 8719

启动服务访问接口

在这里插入图片描述

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值