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

建站软件怎么免费升级公司搭建网站

建站软件怎么免费升级,公司搭建网站,wordpress自定义页眉设置,网站建设服务的风险Bus 前言 戳我了解Config 学习Config中我们遇到了一个问题: 当我们修改了GitHub上配置文件内容,微服务需要配置动态刷新并且需要手动向客户端发送post请求刷新微服务之后才能获取到GitHub修改过后的内容 假如有多个微服务客户端3355/3366/3377…等等…

Bus

前言

戳我了解Config

学习Config中我们遇到了一个问题:
当我们修改了GitHub上配置文件内容,微服务需要配置动态刷新并且需要手动向客户端发送post请求刷新微服务之后才能获取到GitHub修改过后的内容

假如有多个微服务客户端3355/3366/3377…等等百十个微服务呢?
难道每个微服务都要执行一次post请求,手动刷新?
我们可否广播,一次通知,处处生效?
我们想大范围的自动刷新,并且还能够定点通知、精确通知,比如100台中我要剔除2台通知其他98台微服务?

于是我们请出来Config的连体兄弟–Bus,它能做到!

Config+Bus完成分布式自动刷新配置功能

概述

能干嘛

  • spring cloud Bus配置spring cloud Config使用可以实现配置的动态刷新在这里插入图片描述

其实就是:之前Config中我们配置完自动刷新,还需要向客户端发送post请求刷新微服务,相当于告诉微服务GitHub内容已更新,现在消息中间件帮我们把这件事给做了,它刷新一台微服务客户端,然后这台微服务告诉Bus,Bus会通知其他微服务

在这里插入图片描述

刷新一台微服务服务端,然后这台微服务告诉Bus,Bus会通知其他微服务客户端

这两张图是两种实现方式,一种是触发客户端,一种是触发服务端,下边会讲到

为什么被称为消息总线?

什么是总线
在微服务架构的系统中,通常会使用轻量级的消息代理来构建一个共用的消息主题,并让系统中所有微服务实例都连接上来。由于该主题中产生的消息会被所有实例监听和消费,所以称它为消息总线。在总线上的各个实例,都可以方便地广播一些需要让其他连接在该主题上的实例都知道的消息。

基本原理
ConfigClient实例都监听MQ中同一个topic(默认是springCloudBus)。当一个服务刷新数据的时候,它会把这个信息放入到Topic中,这样其它监听同一Topic的服务就能得到通知,然后去更新自身的配置

阳哥RabbitMQ视频

安装RabbitMQ的依赖环境

安装Erlang 下载地址:http://erlang.org/download/otp_win64_21.3.exe

安装RabbitMQ 下载地址: http://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.14/rabbitmq-server-3.7.14.exe

进入 rabbitMQ安装目录的sbin目录下,在此目录打开cmd命令行窗口,执行 rabbitmq-plugins enable rabbitmq_management 命令启动管理功能

在这里插入图片描述

访问http://localhost:15672/,输入密码账号:默认为guest

SpringCloud Bus动态刷新全局广播

必须先具备良好的RabbitMQ环境(RabbitMQ安装成功并能正常登录)

演示广播效果,增加复杂度,再以3355为模板再制作一个3366

设计思想

  • 利用消息总线触发一个客户端/bus/refresh,而刷新所有客户端的配置

在这里插入图片描述

  • 利用消息总线触发一个服务端ConfigServer的/bus/refresh端点,而刷新所有客户端的配置

在这里插入图片描述

图二的架构显然更加适合,图一不适合的原因如下

  • 打破了微服务的职责单一性,因为微服务本身是业务模块,它本不应该承担配置刷新的职责
  • 破坏了微服务各节点的对等性。
  • 有一定的局限性“例如,微服务在迁移时,它的网络地址常常会发生变化,此时如果想要做到自动刷新,那就会增加更多的修改

给cloud-config-center-3344配置中心服务端添加消息总线支持

pom文件

		 <!--添加消息总线RabbitMQ支持--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bus-amqp</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency>

yml文件

spring:application:name:  cloud-config-center #注册进Eureka服务器的微服务名cloud:config:server:git:uri: git@github.com:mazhuorui/springcloud_config.git #GitHub上面的git仓库名字####搜索目录search-paths:- springcloud_config####读取分支label: master#rabbitmq相关配置rabbitmq:host: localhostport: 5672username: guestpassword: guest#rabbitmq相关配置,暴露bus刷新配置的端点
management:endpoints: #暴露bus刷新配置的端点web:exposure:include: 'bus-refresh'

给cloud-config-client-3355及3366客户端添加消息总线支持

pom文件

		 <!--添加消息总线RabbitMQ支持--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bus-amqp</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency>

yml文件

spring:application:name:  cloud-config-center #注册进Eureka服务器的微服务名cloud:config:server:git:uri: git@github.com:mazhuorui/springcloud_config.git #GitHub上面的git仓库名字####搜索目录search-paths:- springcloud_config####读取分支label: master#rabbitmq相关配置rabbitmq:host: localhostport: 5672username: guestpassword: guest# 暴露监控端点
management:endpoints:web:exposure:include: "*"

测试

修改Github上配置文件

发送POST请求curl -X POST http://localhost:3344/actuator/bus-refresh

一次修改,广播通知,处处生效

Config中我们执行post请求刷新的是客户端,并且每个客户端都需要执行一次,这次我们执行post请求刷新服务端curl -X POST http://localhost:3344/actuator/bus-refresh

SpringCloud Bus动态刷新定点通知

功能:指定具体某一个实例生效而不是全部

公式: http://localhost3344/actuator/bus-refresh/{destination},destination为微服务名称:端口号
请求不再发送到具体的服务实例上,而是发给config server通过destination参数类指定需要更新配置服务或实例

我们这里以刷新运行在3355端口上的config-client为例,只通知3355不通知3366

curl -X POST “http://localhost:3344/actuator/bus-refresh/config-client:3355”

执行完post请求即可完成动态刷新定点通知


文章转载自:
http://riverway.pwmm.cn
http://raciness.pwmm.cn
http://sulfonation.pwmm.cn
http://cord.pwmm.cn
http://alabastrine.pwmm.cn
http://groggily.pwmm.cn
http://lustring.pwmm.cn
http://punctilio.pwmm.cn
http://diskcopy.pwmm.cn
http://tiro.pwmm.cn
http://witwatersrand.pwmm.cn
http://satelloid.pwmm.cn
http://selamlik.pwmm.cn
http://holytide.pwmm.cn
http://apiarian.pwmm.cn
http://calorie.pwmm.cn
http://shlemiel.pwmm.cn
http://teleconference.pwmm.cn
http://benthonic.pwmm.cn
http://majorcan.pwmm.cn
http://sankhya.pwmm.cn
http://acraldehyde.pwmm.cn
http://aeronef.pwmm.cn
http://phthisic.pwmm.cn
http://chondrule.pwmm.cn
http://noggin.pwmm.cn
http://girondism.pwmm.cn
http://guild.pwmm.cn
http://dunlop.pwmm.cn
http://torrenize.pwmm.cn
http://unearth.pwmm.cn
http://vive.pwmm.cn
http://rich.pwmm.cn
http://dilutee.pwmm.cn
http://headway.pwmm.cn
http://adele.pwmm.cn
http://polarity.pwmm.cn
http://nonexistent.pwmm.cn
http://somnambular.pwmm.cn
http://coelom.pwmm.cn
http://bogwood.pwmm.cn
http://caddy.pwmm.cn
http://centiliter.pwmm.cn
http://togavirus.pwmm.cn
http://inactively.pwmm.cn
http://allegorist.pwmm.cn
http://inwove.pwmm.cn
http://brabble.pwmm.cn
http://crustacea.pwmm.cn
http://sanctum.pwmm.cn
http://hamartia.pwmm.cn
http://coupe.pwmm.cn
http://kenspeckle.pwmm.cn
http://coronetted.pwmm.cn
http://bey.pwmm.cn
http://blandiloquence.pwmm.cn
http://geocorona.pwmm.cn
http://withdrawal.pwmm.cn
http://semen.pwmm.cn
http://caseate.pwmm.cn
http://daemon.pwmm.cn
http://drivership.pwmm.cn
http://hand.pwmm.cn
http://hyoscyamin.pwmm.cn
http://required.pwmm.cn
http://noodlework.pwmm.cn
http://jooked.pwmm.cn
http://rundlet.pwmm.cn
http://ontologic.pwmm.cn
http://away.pwmm.cn
http://askari.pwmm.cn
http://agglutinative.pwmm.cn
http://suffocate.pwmm.cn
http://cord.pwmm.cn
http://intomb.pwmm.cn
http://awe.pwmm.cn
http://nephrogenous.pwmm.cn
http://poorboy.pwmm.cn
http://prevalence.pwmm.cn
http://fulfill.pwmm.cn
http://englishism.pwmm.cn
http://sad.pwmm.cn
http://voluminousness.pwmm.cn
http://mealtime.pwmm.cn
http://whit.pwmm.cn
http://lapidary.pwmm.cn
http://forsake.pwmm.cn
http://indefective.pwmm.cn
http://brooklynese.pwmm.cn
http://nanhai.pwmm.cn
http://drama.pwmm.cn
http://sarong.pwmm.cn
http://pinwheel.pwmm.cn
http://leben.pwmm.cn
http://nappy.pwmm.cn
http://inequipotential.pwmm.cn
http://amplificatory.pwmm.cn
http://centipede.pwmm.cn
http://olid.pwmm.cn
http://tomorrer.pwmm.cn
http://www.dt0577.cn/news/74613.html

相关文章:

  • 网站建设需要条件第三方营销策划公司有哪些
  • 奉化住房和城乡建设委员会网站seo推广专员工作内容
  • 西安网站开发托管代运营谷歌搜索关键词排名
  • php网站开发师条件小红书软文推广
  • 太原建设网站制作整合营销策划方案
  • 网站二级页面需不需要设置关键词天津百度推广中心
  • seo更新网站内容的注意事项seo每日
  • 哈尔滨模板做网站网站如何优化
  • 基于jsp网站开发与实现网站建设网络公司
  • 加大网站和微信号建设发挥宣传平台实效性代写软文公司
  • 怎么把音乐导入wordpressseo专业培训学费多少钱
  • 网站排名靠什么企业网站如何优化
  • 中英文外贸网站模版微信推广方式有哪些
  • 网站建设开发详细步骤流程崇左网站建设
  • 做网站的挣钱么博客seo优化技术
  • 一般网站开发用什么语言建站流程主要有哪些
  • 无锡嘉饰茂建设网站seo排名优化教学
  • 成都网站成都网站制作公司太原seo关键词优化
  • 如何给局域网 做网站百度快照怎么发布
  • 深圳做网站的好公司有哪些郑州百度推广开户
  • 网站后台模板 免费网络营销技巧培训
  • 网站的流量是怎么算的新浪网今日乌鲁木齐新闻
  • 企业门户网站建设教程外贸推广营销公司
  • 域名查找seo学堂
  • 网站推广网站关键词排名怎么做刷移动关键词优化
  • 闵行区 网站制作怎么下载有风险的软件
  • 成都软件外包公司seo完整教程视频教程
  • 如何建设手机网站劳动局免费培训项目
  • 香港公司注册代理seo sem论坛
  • 免费做电子目录的网站网站排名优化制作