SpringCloud笔记1
一、加了这个在DS Replicas就不会显示localhost
eureka:
instance:
hostname: localhost
二、eureka微服务需要将自己排除注册,否则会运行时报错
register-with-eureka: false # 表示是否向eureka注册中心注册自己
fetch-registry: false #表示如果为false则表示自己为注册中心 "defaultZone", "http://localhost:8761/eureka/"
报错(但是能正常使用,目前没发现有何其他异常):
Connection refused: connect stacktrace=com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
三、访问git上的yml配置
这里的config-eureka指向gitee里面config-eureka.yml
四、加了这个url就必须要加/eureka/才能访问到
server:
port: 7001
servlet:
context-path: /eureka
五、配置eureka集群
defaultZone: http://eureka7002.com:7002/eureka/,http://eureka7003.com:7003/eureka/
这样在访问某个eureka的时候会发现DS Replicas的变化
之后每个eureka客户端都这样配置,即可实现集群