研究分布式锁,基于ZK实现,需要整合到SpringBoot使用 参考自SpringBoot集成Curator实现Zookeeper基本操作,Zookeeper入门 本篇的代码笔者有自己运行过,需要注意组件的版本号是否兼容,否则会有比较多的坑 搭建Zookeeper容器 采用Docker compose快速搭建ZK容器,很快,几分钟就好了,而且是集群方式搭建。详情见笔者的Docker搭建zookeeper 引入依赖 需要注意的点:Curator 2.x.x-兼容两个zk 3.4.x 和zk 3.5.x,Curator 3.x.x-兼容兼容zk 3.5,根据搭建的zk的版本使用对应的curator依赖。引入的zk依赖,如果项目中有使用logback日志 ,需要排除zk中的log4j12依赖,详情见下面笔者给出的依赖: <dependencies> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version>2.12.0</version>...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile