spring boot + zookeeper 注册中心
依赖配置
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.2.RELEASE</version><relativePath/> <!-- lookup parent from repository -->
</parent><groupId>com.ruiguo</groupId>
<artifactId>spring-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-boot</name>
<description>Demo project for Spring Boot</description><properties><java.version>14</java.version><spring-cloud.version>Hoxton.SR7</spring-cloud.version>
</properties><!-- 集成zookeeper客户端-->
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zookeeper-discovery</artifactId><exclusions><exclusion><groupId>org.apache.zookeeper</groupId><artifactId>zookeeper</artifactId></exclusion></exclusions>
</dependency><dependency><groupId>org.apache.zookeeper</groupId><artifactId>zookeeper</artifactId><version>3.5.8</version>
</dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zookeeper-config</artifactId>
</dependency><!-- 指定集成的父级依赖版本 -->
<dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${spring-cloud.version}</version><type>pom</type><scope>import</scope></dependency></dependencies>
</dependencyManagement>
注册中心配置
server.port=8081
spring.application.name=spring boot-provider# 数据源配置
spring.datasource.url=jdbc:mysql://localhost:3306/jiaruiguo?characterEncoding=utf8&useSSL=true&serverTimezone=UTC&zeroDateTimeBehavior=CONVERT_TO_NULL
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root# 驼峰命名转换
mybatis.configuration.map-underscore-to-camel-case=true# zoookeeper服务注册
spring.cloud.zookeeper.connect-string=localhost:2181
spring.cloud.zookeeper.discovery.enabled=true
spring.cloud.zookeeper.discovery.register=true
spring.cloud.zookeeper.discovery.root=service
开启服务注册
/*** @EnableCaching : 启用缓存* @EnableDiscoveryClient : 启用注册中心*/
@EnableCaching
@SpringBootApplication
@EnableDiscoveryClient
public class Application {public static void main(String[] args) {SpringApplication.run(Application.class, args);}}
结果查看
spring boot + zookeeper 注册中心相关推荐
- 3.spring cloud + zookeeper注册中心 + Feign调用案例
3.spring cloud + zookeeper注册中心 + Feign调用案例 3.1.pom.xml定义 <?xml version="1.0" encoding=& ...
- Spring Cloud 系列之 ZooKeeper 注册中心
什么是注册中心 服务注册中心是服务实现服务化管理的核心组件,类似于目录服务的作用,主要用来存储服务信息,譬如提供者 url 串.路由信息等.服务注册中心是微服务架构中最基础的设施之一. 注册中心可以说 ...
- 微服务系列之ZooKeeper注册中心和Nacos注册中心Nacos和Zookeeper对比
一.ZooKeeper注册中心 Zookeeper 是 Apache Hadoop 的子项目,是一个树型的目录服务,支持变更推送,适合作为 Dubbo 服务的注册中心,工业强度较高,可用于生产环境,推 ...
- Dubbo 集成 ZooKeeper 注册中心实现服务调用
Dubbo 是基于Java的开源的RPC的分布式服务框架,目前是 Apache 项目. 推荐使用 ZooKeeper 做注册中心,当然也可以支持 Redis, Multicast 和Simple. D ...
- 淘宝SOA框架dubbo学习(2)--搭建Zookeeper注册中心服务
2019独角兽企业重金招聘Python工程师标准>>> 继上一篇博文, 淘宝SOA框架dubbo学习(1) http://my.oschina.net/hanshubo/blog/3 ...
- (十二)springmvc+mybatis+dubbo+zookeeper分布式架构 整合 - zookeeper注册中心安装
今天我们来学习基于zookeeper注册中心的安装. 注册中心 1.建议使用dubbo-2.3.3以上版本的使用zookeeper注册中心客户端 2.Zookeeper是Apache Hadoop的子 ...
- 后台服务系统之搭建ZooKeeper注册中心
dubbo支持多种注册中心,推荐使用ZooKeeper. http://dubbo.apache.org/zh-cn/docs/user/references/registry/zookeeper.h ...
- linux 查看zookeeper目录,查看zookeeper注册中心是否有注册服务
查看zookeeper注册中心是否有注册服务可以在服务器上看,也可以在dubboadmin看哦~ 1.在服务器上看: 1)查找zookeeper的目录: find / -name zookeeper ...
- Spring Cloud 服务注册中心Eureka
Eureka介绍 在Spring Cloud Netflix 整合技术栈中,Eureka既可以作为服务注册中心也可以用于服务发现对整个微服务架构起着最核心的整合作用. Eureka是基于REST(Re ...
最新文章
- stm32cubemx生成不了keil工程文件_STM32CubeMX系列教程03_创建并生成代码工程
- Ashikhmin-Shirley, cook- torrance, ward -duer 对比
- Totem-DesignNet处理器插件开发方法
- 持续集成之Jenkins安装部署
- arrayPointer
- 小程序消息服务器webapi,小程序订阅消息
- ZABBIX API简介及使用
- php dwg转pdf文件怎么打开,CAD转PDF怎么转为黑白的PDF文件
- 基于SIMULINK的AWGN信道仿真
- MongoDB和MySQL常用增删改查语句
- Detecting Spacecraft Anomalies Using LSTMs and Nonparametric Dynamic Thresholding
- 使用git将远程仓库和本地仓库关联
- python3保存的npy文件,python2无法读取的可能解决方案。
- Windows10如何设置定时开机
- 项目一 Windows Server 2012 R2服务器安装与配置
- 阿里巴巴何以超越周期?| 一点财经
- 计算机桌面模糊了,显示屏模糊,详细教您怎么解决电脑屏幕模糊
- 统计学在中国的发展与就业前景
- SAP MIRO付款条件与折扣
- Win2008nbsp;64位下.Net访问MDAC…
热门文章
- G_PERIOD_GET
- 遇到填报无计可施?一文讲透自由表填报,数据分析效率直线提升
- 2.5亿被腰围改变的中国人,哪个省胖子最多?
- 微盟616助力品牌潮出圈背后,智慧零售迈入广阔收获期
- 闲鱼有流量,毒具特色,“全面”的转转如何突围?
- java读写锁降级_java的读写锁中锁降级的问题
- 如何在IDA软件中找到自己需要的目标函数(关键函数)
- 原生js动态为table追加html,JS动态添加Table的TR,TD实现方法
- Python中两种文件修改的方式
- 【Python教程】typing模块的作用-提高代码健壮性