一、簡介
是什么:面向分布式、多語言異構化服務架構的流量治理組件
能干嘛:從流量路由、流量控制、流量整形、熔斷降級、系統自適應過載保護、熱點流量防護等多個維度來幫助開發者保障微服務的穩定性
- 官網地址:https://sentinelguard.io/zh-cn/index.html
- GitHub:https://github.com/alibaba/Sentinel/releases
二、實現步驟
2.1 查看Sentinel版本
docker search sentinel-dashboard
2.2 下載Sentinel鏡像
docker pull bladex/sentinel-dashboard
查看鏡像:
友情提示:如果提示拉取鏡像時報錯,可以選擇更換docker鏡像源,步驟如下:
vim /etc/docker/daemon.json{"registry-mirrors": ["https://docker.registry.cyou/","https://docker-cf.registry.cyou/","https://dockercf.jsdelivr.fyi/","https://docker.jsdelivr.fyi/","https://dockertest.jsdelivr.fyi/","https://mirror.aliyuncs.com/","https://dockerproxy.com/","https://mirror.baidubce.com/","https://docker.m.daocloud.io/","https://docker.nju.edu.cn/","https://docker.mirrors.sjtug.sjtu.edu.cn/","https://docker.mirrors.ustc.edu.cn/","https://mirror.iscas.ac.cn/","https://docker.rainbond.cc/","https://jq794zz5.mirror.aliyuncs.com"]
}
# 重新加載配置
systemctl daemon-reload
# 重啟docker
systemctl restart docker
# 查看配置是否生效
docker info
vim /etc/resolv.confnameserver 114.114.114.114
nameserver 8.8.8.8
2.3 運行Sentinel容器
docker run --name sentinel -p 8858:8858 -td bladex/sentinel-dashboard
三、訪問Sentinel監控平臺
訪問地址:http://ip:8858
賬號:sentinel
密碼:sentinel
四、Sentinel修改默認賬號、密碼
4.1 進入容器
docker exec -it sentinel /bin/bash
4.2 新建application.properties文件
touch application.properties
4.3 寫入配置
vi application.properties# If auth.enabled=false, Sentinel console disable login
auth.username=sentinel
auth.password=sentinel
只需要寫上述兩句配置,改掉password就可以了。利用的是springboot項目配置文件優先級方式復寫了jar包內的默認配置
4.4 重啟docker容器
docker restart sentinel
4.5 測試
輸入錯誤密碼
輸入正確密碼,正常進入