Eureka相关操作

服务注册

(application.properties
或者application.yml
或者application.yaml)

配置信息

server.port:8761
eureka.instance.hostname:standalone
eureka.inatance.instance-id: s p r i n g . a p p l i c a t i o n . n a m e : {spring.application.name}: spring.application.name:{vcap.application.instance_id:{spring.application.instance_id:{random.value}}}
eureka.client.register-with-eureka:false
eureka.client.url:false
eureka.client.fefault-Zone:http:// e u r e k a . i n s t a n c e . h o s t n a m e : {eureka.instance.hostname}: eureka.instance.hostname:{server.port}/eureka/
spring.application.name:eureka-service

服务调用

#设置端口号
server:
port: 8765

#设置服务的名称
spring:
application:
name: eureka-client

#往eureka_service端注册的地址
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
hostname: client
instance-id: s p r i n g . a p p l i c a t i o n . n a m e : {spring.application.name}: spring.application.name:{vcap.application.instance_id:KaTeX parse error: Expected '}', got 'EOF' at end of input: …on.instance_id:{random.value}}}

服务提供

#服务提供者
eureka:
instance:
hostname: client
instance-id: s p r i n g . a p p l i c a t i o n . n a m e : {spring.application.name}: spring.application.name:{vcap.application.instance_id:KaTeX parse error: Expected '}', got 'EOF' at end of input: …on.instance_id:{random.value}}}
client:
service-url:
defaultZone: http://localhost:8761/eureka/
server:
port: 8760
spring:
application:
name: eureka-client-service

其他

熔断:(Hystrix)就是当一个服务器出问题时,让客户消费请求访问其他空闲服务,并提示;
负载均衡:(RestTemplate 用于服务之间的通信,加了@LoadBalance注解就是开启负载均衡模式)就是让请求访问空闲的服务,将服务请求分摊,保证高可用性,避免任何单一资源的过载;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值