当前位置: 首页 > news >正文

deal 网站要怎么做重庆网站建设网站

deal 网站要怎么做,重庆网站建设网站,网站 title 被修改,求职招聘网站排名前十名sentinel控制台#xff0c;使用方便#xff0c;功能强大。使用官方的jar包#xff0c;配置不会持久化#xff0c;sentinel重启后会导致#xff0c;之前的规则全部丢失#xff0c;下面一起改造源码实现规则数据的持久化 sentinel源码地址 #xff08;github访问太慢使用方便功能强大。使用官方的jar包配置不会持久化sentinel重启后会导致之前的规则全部丢失下面一起改造源码实现规则数据的持久化 sentinel源码地址 github访问太慢直接上镜像版 Sentinel: Sentinel 是什么 随着微服务的流行服务和服务之间的稳定性变得越来越重要https://gitee.com/mirrors/Sentinel.git 因为项目使用的是Spring-cloud-alibabaSentinel支持和nacos整合就持久化到nacos数据库中同时sentinel还能读取nacos中做的流控规则。 1 源码目录 1.1、后台源码修改 小惊喜sentinel中有和nacos中对接的源码只不过没有使用。 1、改成 默认后台使用sentinel对接nacos而不是存到内存 2、前台页面接口调用nacos对应的接口 1.1.1 sentinel-dashboard中需要改动的位置 pom.xml中将sentinel-datasource-nacos包的scope注释掉 1.1.2 源码持久化到nacos的实现位置 不多说先复制到main目录rule包下 nacos包中的4个类 FlowRuleNacosProvider 动态获取Nacos配置中心流控规则读取流控规则FlowRuleNacosPublisher publish上传流控规则到Nacos配置中心写入流控规则NacosConfig Nacos配置NacosConfigUtils 流控规则在nacos中配置文件的一些细节后缀、组别等 1.1.3 NacosConfig配置 只实现了本地nacos并且需要默认配置需要支持自定义配置 改造后 NacosConfig源码 /** Copyright 1999-2018 Alibaba Group Holding Ltd.** Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/ package com.alibaba.csp.sentinel.dashboard.rule.nacos;import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity; import com.alibaba.csp.sentinel.datasource.Converter; import com.alibaba.fastjson.JSON; import com.alibaba.nacos.api.PropertyKeyConst; import com.alibaba.nacos.api.config.ConfigFactory; import com.alibaba.nacos.api.config.ConfigService; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;import java.util.List; import java.util.Properties;/*** author Eric Zhao* since 1.4.0*/ Configuration public class NacosConfig {Value(${sentinel.nacos.address})private String nacosAddr;Value(${sentinel.nacos.username})private String nacosUsername;Value(${sentinel.nacos.password})private String nacosPassword;Beanpublic ConverterListFlowRuleEntity, String flowRuleEntityEncoder() {return JSON::toJSONString;}Beanpublic ConverterString, ListFlowRuleEntity flowRuleEntityDecoder() {return s - JSON.parseArray(s, FlowRuleEntity.class);}Beanpublic ConfigService nacosConfigService() throws Exception {Properties properties new Properties();properties.put(PropertyKeyConst.SERVER_ADDR, nacosAddr);properties.put(PropertyKeyConst.USERNAME, nacosUsername);properties.put(PropertyKeyConst.PASSWORD, nacosPassword);return ConfigFactory.createConfigService(properties);} }1.1.4 修改配置文件 application.properties 增加nacos配置信息 #Sentinel 连接nacos配置 sentinel.nacos.address 192.168.1.109:8848 sentinel.nacos.username nacos sentinel.nacos.password nacos1.1.5 配置v2版本controller调用nacos提供的服务层 1.2 前端页面源码修改 1.2.1 配置中添加nacos接口并修改地址 文件 src/main/webapp/resources/app/scripts/controllers/identity.js 搜FlowServiceV1 改为 FlowServiceV2 搜/dashboard/flow/ 改为 /dashboard/v2/flow/ 1.2.2 修改页面中的路由地址 文件 src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html 搜dashboard.flowV1定位57行去掉V1 文件 src/main/webapp/resources/app/views/flow_v2.html 注释掉回到单机页面按钮 2.项目引用 2.1 微服务引入jar包 pom.xml !-- SpringCloud Alibaba Nacos --dependencygroupIdcom.alibaba.cloud/groupIdartifactIdspring-cloud-starter-alibaba-nacos-discovery/artifactId/dependency!-- Sentinel --dependencygroupIdcom.alibaba.csp/groupIdartifactIdsentinel-datasource-nacos/artifactId/dependency 2.2 微服务sentinel相关配置 # Spring spring:cloud:sentinel:eager: true# sentinel 地址transport:dashboard: ${sentinel.host}:${sentinel.port}filter:enabled: falsedatasource:ds1:nacos:server-addr: ${nacos.host}:${nacos.port}username: ${nacos.name}password: ${nacos.pwd}namespace: ${nacos.namespace}group-id: ${nacos.group}data-id: ${spring.application.name}-flow-rulesdata-type: jsonrule-type: flow 3 nacos增加sentinel持久化配置文件 以下文件后缀与组名需要对应 大功告成去试试效果吧
http://www.sadfv.cn/news/385362/

相关文章:

  • 厦门 网站建设 公司奔驰高端品牌
  • 公司网站开发毕业设计游戏代理平台一天结一次
  • 合肥的网站建设剂屏织梦做的网站后台怎么进
  • 长沙网站推广seo四川城乡建设官方网站
  • wp博客 婚庆网站模板wordpress 登陆api
  • 网站建设的快乐平面设计找图网站
  • 广西柳州网站建设做博客网站
  • 做网站店铺装修的软件新网站建设方案
  • 个人微信公共号可以做微网站么开发企业网关
  • 苏州企业网站建设开发与制作台州企业网站搭建价格
  • 辽宁省建设工程信息网官网新网站入口建设银行的财务网站
  • 阿里云建立网站老外采购平台
  • 苏州哪家做网站微信建公众号怎么建
  • 网站建设项目验收表智慧门店管理服务平台
  • wordpress全站迁移北京工程交易中心官网
  • 哪些行业需要做网站连云港关键字优化预订
  • 余姚做百度网站wordpress和论坛整合
  • 公司企业做网站违法吗做照片书网站好
  • 电子商务网站开发技术软件开发公司简介模板
  • 网站怎么设置为可信任网站建筑工程项目管理软件
  • 台州网站制作定制WordPress微信SVG图标
  • 怎么修改公司网站图片win7 做网站服务器
  • 服务专业的网络建站公司地区门户网站 建设攻略
  • 网站做以后怎么修改网站内容太原定制网站开发制作
  • 淘宝 网站开发 退货wordpress设置后台自定义功能选项
  • 自己搭建服务器 发布网站 域名如何申请义乌网站建设和制作
  • 东莞网站建设网站建设多少钱可以做音乐mv视频网站
  • 网站设计培训学校有哪家禅城容桂网站制作
  • 地方门户网站源码下载烟台违建举报网站
  • 奖券世界推广网站下沙网站优化