一、Consul 安装及集群配置
具体安装参考以文件介绍
https://my.oschina.net/u/593517/blog/2967475
&表示后台运行
服务端
./consul agent -server -bootstrap-expect 3 -data-dir=/usr/local/consul/data -node=server3 -bind=192.168.58.203 -client=0.0.0.0 &
客户端
./consul agent -client=0.0.0.0 -data-dir=/usr/local/consul/data -node=client-1 -ui -join 192.168.58.199 &
二、Spring cloud 配置
添加application.yml
配置文件
spring: cloud: consul: host: 192.168.58.201 #集群服务器客户端ID,不是本地local port: 8500 discovery: register: true healthCheckPath: /actuator/health healthCheckInterval: 15s instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
启动服务异常:
出现连接错误:提示无法连接到本地localhost,application.yml 已经配置了开发环境的地址和端口,为什么还一直连接的是本地?
解决办法:
经过排查调试,把application.yml 改成了 bootstrap.yml 就可以启动服务并注册成功。
相关推荐
Consul 是由 HashiCorp 基于 Go 语言开发的,Consul 是一个分布式高可用的系统,提供的服务发现、健康检查、配置(KV存储)和分段功能可以被独立使用,比如我们在 Go Micro 微服务这里使用的主要是服务发现功能,也...
该系统实现一对多、分页查询以及修改,将病区与病人各为一个微服务进行处理,利用Feign在Consul注册中心进行负载均衡,Swagger进行前后端分离,进行调试。
springcloud基于consul的生产者、消费者2端实例代码,包含feign\Hystrix,其他组件后续集成。
美好愿望:架构更优雅,代码更优美,避免重复造轮子,降低成本,敏捷开发。 simple yet gorgeous. hikaru as a web develop distributed full-stack framework, we still have a lot to do .At the same time, more ...
spring cloud demo 学习项目,项目技术 jdk 8 + spring cloud Hoxton.SR5 + spring boot 2.2.5.RELEASE + Consul +maven 。实现了服务注册、配置中心、服务调用、熔断、路由、限流。
资源名字:基于Springcloud+mysql的分布式架构网上商城设计与实现(源码+设计文档+部署说明+视频演示).zip 资源内容:项目全套源码+完整文档 源码说明: 全部项目源码都是经过测试校正后百分百成功运行。 基于...
基于Spring Cloud Finchley.SR1 网关基于 Spring Cloud Gateway 提供Consul 服务注册发现版本pigxc 最终一致性的分布式事务解决方案 图形化代码生成,不会vue也能做到敏捷开发 基于 Spring Security oAuth 深度定制...
spring-cloud-consul-example, spring 云领事示例是microservices系统的示例 spring-cloud-consul-example自述文件:英语 | 中文。spring-cloud-consul-example是microservices系统的一个例子。系统包含收费管理。...
Spring Cloud Consul中文文档
SpringCloud——服务注册(consul)之Consul通过HTTP API和DNS提供服务发现服务。
SpringCloud的完整示例,Consul作为服务注册中心,利用Mybatis访问数据库,Jersy提供restful api
Spring Cloud(二) Consul 服务治理实现 spring-cloud-ribbon Spring Cloud(三) 服务提供者 Eureka + 服务消费者(rest + Ribbon) spring-cloud-feign Spring Cloud(四) 服务提供者 Eureka + 服务...
重点讲解了SpringCloud各种组件停止更新进入维护阶段后,后续技术组件的升级和替换策略及方案选型,既有传统Eureka、Ribbon、OpenFeign、Hystrix、Config等技术的升级讲解,又有Consul、Gateway、Bus、Stream、Sleuth...
spring cloud consul注册中心,微服务间openfeign调用 ,附带windows 64位版consul 以及启动文件
一篇很好的springCloud学习的思维导读,详细的介绍了,springCloud的搭建步骤以及各组件的说明讲解 涵盖 Eureka服务注册与发现 Zookeeper服务注册与发现 Consul服务注册与发现 Ribbon负载均衡服务调用 OpenFeign...
Spring Cloud Consul 服务提供方
springcloud-consul-consumerspring cloud中使用consul作为注册中心——服务消费者
Spring Cloud 服务提供方,向Consul注册中心注册,支持服务部署在docker中(eureka暂不支持,严格地说是注册的信息无效) 修改application.properties 和bootstrap.properties
CentOS7.4+HDP+Ambari+consul+Elasticsearch 安装部署文档