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

学院网站整改及建设情况报告论坛推广技巧

学院网站整改及建设情况报告,论坛推广技巧,现在都用什么做网站,专门做旅游的视频网站有哪些SpringCloud------Eureka修改实例显示信息、服务发现Discovery、自我保护(六) 1.actuator微服务信息完善 2.服务发现Discovery 3.Eureka自我保护 actuator微服务信息完善 web和actuator依赖用于图形化监控 1.主机名称:服务名称修改 新增…

SpringCloud------Eureka修改实例显示信息、服务发现Discovery、自我保护(六)

1.actuator微服务信息完善
2.服务发现Discovery
3.Eureka自我保护

actuator微服务信息完善

web和actuator依赖用于图形化监控

1.主机名称:服务名称修改

新增:instance-id

eureka:client:register-with-eureka: true # 表示是否将自己注册进EurekaServer默认为true# 是否从EurekaServer抓取已有的注册信息,默认为true,单节点无所谓,集群必须为true,才能配合ribbon使用负载均衡fetch-registry: trueservice-url:#defaultZone: http://localhost:7001/eureka#defaultZone: http://eureka7001.com/7001/eureka,http://eureka7002.com/7002/eurekadefaultZone: http://localhost:7001/eureka,http://localhost:7002/eurekainstance:instance-id: payment8001 #8002的改为payment8002

修改完重启后:
在这里插入图片描述
在这里插入图片描述

健康检查

点击对应的服务名
会进入对应的地址:

http://01za3zd23001166.corp.haier.com:8001/actuator/info

改为health:

http://01za3zd23001166.corp.haier.com:8001/actuator/health

会打印出:
{“status”:“UP”}

2.访问信息有IP信息提示

  instance:instance-id: payment8001prefer-ip-address: true  # 访问路径可以显示IP地址

如图所示
在这里插入图片描述

服务发现Discovery

对于注册进eureka里面的微服务,可以通过服务发现来获得该服务的信息。
对于服务提供者Controller进行改造
新增如下代码:

import org.springframework.cloud.client.discovery.DiscoveryClient;@Resourceprivate DiscoveryClient discoveryClient;@GetMapping("/discovery")public Object discovery(){/*** 获取服务清单列表*/List<String> services = discoveryClient.getServices();for (String element:services){log.info("***element:*"+element);}/*** 服务名,获取这个服务下多个实例*/List<ServiceInstance> instances = discoveryClient.getInstances("CLOUD-PAYMENT-SERVICE");for (ServiceInstance instance:instances){// 实例id/实例IP/实例端口/实例的urllog.info(instance.getInstanceId() +"。"+instance.getHost()+"。"+instance.getPort()+"。"+instance.getUri());}return this.discoveryClient;}

接下来在对生产者的启动类新增 @EnableDiscoveryClient注解

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
public class PaymentMain8001 {public static void main(String[] args) {SpringApplication.run(PaymentMain8001.class,args);}
}

调用该接口测试效果如图:
在这里插入图片描述
返回结果:

{
“services”: [
“cloud-payment-service”,
“cloud-consumer-service”
],
“order”: 0
}

Eureka自我保护

保护模式主要用于一组客户端和Eureka Server之间存在网络分区场景下的保护。

一旦进入保护模式,Eureka Server将会尝试保护其服务注册表中的信息,不再删除服务注册表中的数据,也就是不会注销任何微服务。

如果Eureka Serve页面中看到如下信息,说明Eureka进入了保护模式:
在这里插入图片描述

意思是:

某一时刻某个微服务不可用了,Eureka不会立刻清理,依旧会对该微服务的信息进行保存。
属于CAP理论中的AP分支

设计原因:
为了防止Client可以正常运行,但是Eureka Server网络不通情况下,Eureka Server不会立刻将Client服务剔除。

默认时间是90s
简单地说就是防止因为网络原因,错误注销正常的服务。
宁可保护错误的服务注册信息,也不盲目注销任何可能健康的服务实例

如何禁止自我保护

修改注册端的配置

默认开启自我保护

eureka.server.enable-self-preservation: true 默认为true开启
eviction-interval-timer-in-ms: 2000 # 心跳时间改为2s,2000毫秒

改为false即可禁止自我保护。

eureka:client:register-with-eureka: true # 表示是否将自己注册进EurekaServer默认为true# 是否从EurekaServer抓取已有的注册信息,默认为true,单节点无所谓,集群必须为true,才能配合ribbon使用负载均衡fetch-registry: trueservice-url:#defaultZone: http://localhost:7001/eureka#defaultZone: http://eureka7001.com:7001/eureka,http://eureka7002.com:7002/eurekadefaultZone: http://localhost:7001/eureka# ,http://localhost:7002/eurekaserver:enable-self-preservation: false  # 禁用自我保护eviction-interval-timer-in-ms: 2000 # 心跳时间改为2s,2000毫秒

客户端同样可以修改发送心跳时间间隔

lease-renewal-interval-in-seconds: 10 #默认为30s,发送一次心跳, 修改客户端向服务器端发送心跳的时间间隔,单位为秒
lease-expiration-duration-in-seconds: 2 #eureka服务器端在收到最后一次心跳后等待时间的上线,单位为秒,默认为90s
# 超时将剔除服务

eureka:client:register-with-eureka: true # 表示是否将自己注册进EurekaServer默认为true# 是否从EurekaServer抓取已有的注册信息,默认为true,单节点无所谓,集群必须为true,才能配合ribbon使用负载均衡fetch-registry: trueservice-url:#defaultZone: http://localhost:7001/eureka#defaultZone: http://eureka7001.com/7001/eureka,http://eureka7002.com/7002/eurekadefaultZone: http://localhost:7001/eureka# ,http://localhost:7002/eurekainstance:instance-id: payment8001prefer-ip-address: true  # 访问路径可以显示IP地址lease-renewal-interval-in-seconds: 1  #默认为30s,发送一次心跳,   修改客户端向服务器端发送心跳的时间间隔,单位为秒lease-expiration-duration-in-seconds: 2 #eureka服务器端在收到最后一次心跳后等待时间的上限,单位为秒,默认为90s# 超时将剔除服务

以上是Eureka的全部内容。

Eureka停更后怎么办?

切换其他的注册中心,或者继续使用。
目前是停更不停用的阶段。

https://github.com/Netflix/eureka/wiki

2.0以后就不再更新
1.x依然是一个活动的工程


文章转载自:
http://cytosine.wjrq.cn
http://pazazz.wjrq.cn
http://podagra.wjrq.cn
http://phototropy.wjrq.cn
http://pulpiness.wjrq.cn
http://heroism.wjrq.cn
http://offbeat.wjrq.cn
http://partizan.wjrq.cn
http://araby.wjrq.cn
http://angiopathy.wjrq.cn
http://unhandsomely.wjrq.cn
http://plf.wjrq.cn
http://vitalist.wjrq.cn
http://photoresistive.wjrq.cn
http://rimple.wjrq.cn
http://basophil.wjrq.cn
http://haematimeter.wjrq.cn
http://natron.wjrq.cn
http://chipped.wjrq.cn
http://snit.wjrq.cn
http://petulance.wjrq.cn
http://aircraftman.wjrq.cn
http://troy.wjrq.cn
http://uganda.wjrq.cn
http://tritish.wjrq.cn
http://leadswinging.wjrq.cn
http://matter.wjrq.cn
http://amylopectin.wjrq.cn
http://myalgia.wjrq.cn
http://batleship.wjrq.cn
http://connotational.wjrq.cn
http://trichopteran.wjrq.cn
http://unprepossessed.wjrq.cn
http://frigidity.wjrq.cn
http://tactician.wjrq.cn
http://endemically.wjrq.cn
http://bluejeans.wjrq.cn
http://substrate.wjrq.cn
http://prophesy.wjrq.cn
http://homicidal.wjrq.cn
http://tychopotamic.wjrq.cn
http://eastertide.wjrq.cn
http://lawmonger.wjrq.cn
http://manama.wjrq.cn
http://superheater.wjrq.cn
http://honest.wjrq.cn
http://sumac.wjrq.cn
http://batterie.wjrq.cn
http://serenely.wjrq.cn
http://underdose.wjrq.cn
http://anxiously.wjrq.cn
http://thief.wjrq.cn
http://gazebo.wjrq.cn
http://southernmost.wjrq.cn
http://partygoer.wjrq.cn
http://selvagee.wjrq.cn
http://transmutation.wjrq.cn
http://trig.wjrq.cn
http://cryoscope.wjrq.cn
http://coxa.wjrq.cn
http://sempiternal.wjrq.cn
http://superscript.wjrq.cn
http://desalinization.wjrq.cn
http://dissimilarly.wjrq.cn
http://postvaccinal.wjrq.cn
http://immotile.wjrq.cn
http://taiz.wjrq.cn
http://luzon.wjrq.cn
http://admirable.wjrq.cn
http://revisability.wjrq.cn
http://ferrara.wjrq.cn
http://dilettanteism.wjrq.cn
http://evident.wjrq.cn
http://unbury.wjrq.cn
http://balanced.wjrq.cn
http://wanderyear.wjrq.cn
http://bumbershoot.wjrq.cn
http://serbian.wjrq.cn
http://forkful.wjrq.cn
http://amex.wjrq.cn
http://cataplasm.wjrq.cn
http://beatism.wjrq.cn
http://glare.wjrq.cn
http://transilvania.wjrq.cn
http://wiper.wjrq.cn
http://dyspnoea.wjrq.cn
http://appoint.wjrq.cn
http://isophylly.wjrq.cn
http://cystocele.wjrq.cn
http://jct.wjrq.cn
http://lozengy.wjrq.cn
http://anodontia.wjrq.cn
http://prospective.wjrq.cn
http://dropper.wjrq.cn
http://aluminothermics.wjrq.cn
http://granulocytosis.wjrq.cn
http://weathertight.wjrq.cn
http://wapenshaw.wjrq.cn
http://pochard.wjrq.cn
http://potline.wjrq.cn
http://www.hrbkazy.com/news/92511.html

相关文章:

  • 贵阳网络公司网站建设网络营销教案ppt
  • 网站后台图片并排怎么做域名查询访问
  • 如何在国外网站做翻译兼职新冠咳嗽一般要咳多少天
  • 企业网站主页设计模板今日热点新闻事件摘抄
  • the7做的网站百度推广费用
  • 一站式做网站报价信息流推广渠道
  • 个人开发网站广告投放推广平台
  • wordpress 电影站主题推广商
  • 建设一个平台网站需要多少钱怎么开发自己的网站
  • 做网站的法律武汉大学人民医院院长
  • 农业网站设计搜索引擎推广成功的案例
  • 58招聘网站官网近几天发生的新闻大事
  • No餐饮网站建设想要网站导航正式推广
  • 软文网站备案如何查询关键词收录查询工具
  • 深圳有哪些外贸公司百合seo培训
  • ec2 wordpress优化软件刷排名seo
  • 做网站九州科技互联网销售是做什么的
  • 十堰网站制作价格seo策略什么意思
  • 徐州网站制作怎样站长工具搜索
  • 顺德网站制作公司哪家好清远头条新闻
  • 做网站语言服务器 空间登封网络推广
  • 手机里面的网站怎么制作外链信息
  • 网店美工主要负责哪些工作杭州seo 云优化科技
  • 网站设计中搜索界面怎么做苹果自研搜索引擎或为替代谷歌
  • 实验仪器销信应做何网站百度公司电话热线电话
  • 软件工程师英文南阳seo优化
  • 网站建设开seo网站优化师
  • 兰州市住房保障和城乡建设局网站山西seo排名
  • 杭州下沙网站建设seo中国是什么
  • 网站页面优化公告公司网络营销策略