![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
zookeeper
风起尘落
我只需努力,剩下的交给时光。
展开
-
zookeeper实现分布式锁
1.场景: 服务器集群实现全局唯一id生成(这里只是实现这个列子,真实情况下,全局唯一id都会提前生成好存放在redis中) 2.代码结构采用模板方法 3.zkLock接口 public interface ZkLock { /** * 获取锁的资源 */ void getLock(); /** *释放锁资源 ...原创 2019-11-18 11:35:40 · 149 阅读 · 0 评论 -
zookeeper创建节点,监听节点。
public class ZookeeperTestServiceImpl implements ZookeeperTestService { private static final String ADDRESS="39.108.107.163"; private static final int SESSION_OUTTIME=2000; @Over...原创 2019-11-12 11:03:18 · 1174 阅读 · 0 评论 -
zookeeper启动:Could not find or load main class org.apache.zookeeper.server.quorum.
启动zookeeper3.5.6出现如下错误:Could not find or load main class org.apache.zookeeper.server.quorum. 应该是解压后的文件中不存在 src目录和一个jar包 ,我换了一个版本 换成了3.4.14就可以了。 下载地址:mirror.bit.edu.cn/apache/zookeeper/ ...原创 2019-11-11 17:19:14 · 16865 阅读 · 3 评论