Java客户端API
添加依赖
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.10</version>
</dependency>
创建会话
- 构造器方法
ZooKeeper(String connectString, int sessionTimeout, Watcher watcher)
ZooKeeper(String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOnly)
ZooKeeper(String connectString, int sessionTimeout, Watcher watcher, long sessionId, byte[] sessionPasswd)
ZooKeeper(String connectString, int sessionTimeout, Watcher watcher, long sessionId, byte[] sessionPasswd, boolean canBeReadOnly)
- 参数详解
参数名 | 描述 |
---|---|
connectString | 形如ip:port,ip:port/path1/path2,表示zk服务器列表,带path路径的表示基于此path操作 |
sessionTimeout | 客户端会话超时时间,毫秒值,在sessionTimeout时间内没有进行有效的心跳检测,则认为会话超时 |
watcher | 默认监听器,可以不设置,传null即可 |
canBeReadOnly | boolean值,true表示只读,默认为false |
sessionId和sessionPasswd | 会话id和会话的秘钥,当一个会话创建后,会自动生成对应的id和秘钥,主要用来恢复会话 |
- 例子
package com.banary.base;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import java.util.concurrent.CountDownLatch;
public class ZookeeperFactory {
private static CountDownLatch countDownLatch = new CountDownLatch(1);
public static void main(String[] args) throws Exception {
createZk2();
}
public static void createZk1() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
System.out.println(zooKeeper.getState());
countDownLatch.await();
System.out.println("zk实例创建成功");
}
public static void createZk2() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
System.out.println(zooKeeper.getState());
countDownLatch.await();
long sessionId = zooKeeper.getSessionId();
byte[] sessionPasswd = zooKeeper.getSessionPasswd();
//使用错的sessionId和sessionPasswd
zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher(), 1l, "test".getBytes());
//使用对的sessionId和sessionPasswd
zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher(), sessionId, sessionPasswd);
Thread.sleep(Integer.MAX_VALUE);
}
private static class DemoWatcher implements Watcher{
public void process(WatchedEvent watchedEvent) {
System.out.println("收到zk event:" + watchedEvent);
countDownLatch.countDown();
}
}
}
- 注意
创建zk对象的方法是异步的,此处采用CountDownLatch实现同步
创建节点
- 方法(不支持递归创建,如果该节点已存在,会抛出异常NodeExistsException)
#同步方法
public String create(String path, byte[] data, List<ACL> acl, CreateMode createMode) throws KeeperException, InterruptedException
#异步方法
public void create(String path, byte[] data, List<ACL> acl, CreateMode createMode, StringCallback cb, Object ctx)
- 参数详解
参数名 | 描述 |
---|---|
path | 要创建的数据节点的路径 |
data | 字节数组,该节点的初始内容,需要自己序列化成字节数组 |
acl | 节点的安全策略,详见ZooDefs.Ids |
createMode | 枚举类型,相见CreateMode |
cb | 异步创建时的回调函数,需要开发者自己实现对应的AsyncCallback子接口,如StringCallback,重写void processResult(int var1, String var2, Object var3, String var4)方法,当zk服务器创建完节点,客户端自动调用该方法 |
ctx | 回调函数上下文,和回调函数一起使用 |
- 例子
package com.banary.base;
import org.apache.zookeeper.*;
import java.util.concurrent.CountDownLatch;
public class CreateDemo {
private static CountDownLatch countDownLatch = new CountDownLatch(1);
public static void main(String[] args) throws Exception{
asyncCreate();
}
/**
* 同步创建
* @throws Exception
*/
public static void syncCreate() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
//阻塞,直到zk链接成功
countDownLatch.await();
//创建临时节点,没有权限限制
String path1 = zooKeeper.create("/zk-test-ephemeral-", "1".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
System.out.println("临时节点1创建成功:"+ path1);
//创建临时顺序节点,没有权限限制
String path2 = zooKeeper.create("/zk-test-ephemeral-", "1".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
System.out.println("临时节点2创建成功:" + path2);
}
/**
* 异步创建
* @throws Exception
*/
public static void asyncCreate() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
//阻塞,直到zk链接成功
countDownLatch.await();
//创建临时节点,没有权限限制
zooKeeper.create("/zk-test-ephemeral-", "1".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL,
new DemoCallback(), "path1");
//创建临时顺序节点,没有权限限制
zooKeeper.create("/zk-test-ephemeral-", "1".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL,
new DemoCallback(), "path2" );
Thread.sleep(Integer.MAX_VALUE);
}
private static class DemoWatcher implements Watcher{
public void process(WatchedEvent watchedEvent) {
if(Event.KeeperState.SyncConnected == watchedEvent.getState()){
countDownLatch.countDown();
}
}
}
private static class DemoCallback implements AsyncCallback.StringCallback {
@Override
public void processResult(int rc, String path, Object ctx, String name) {
System.out.println("创建节点:[" + rc + ", " + path + ", " + ctx.toString() +
", 真实path:" + name + "]");
}
}
}
- 异步方法回调接口参数说明
参数名 | 描述 |
---|---|
rc | 服务端响应码:0 创建成功;-4 客户端和服务端的链接断开;-110 节点已存在;-112 会话过期 |
path | 对应create方法中节点路径参数值 |
ctx | 接口调用时传如API的ctx,即对应异步create方法中的ctx参数 |
name | 创建成功后,对应节点的真是路径 |
- 同步方法和异步方法比较
- 同步方法会阻塞线程,异步方法不会
- 同步会抛出异常,异步方法不会,异常信息是通过状态码的方式传递到回调函数中
删除
- 方法(删除时不支持递归删除,也就是说某个节点如果存在子节点,则不能删除)
#同步删除
public void delete(String path, int version) throws InterruptedException, KeeperException
#异步删除
public void delete(String path, int version, VoidCallback cb, Object ctx)
- 参数说明
参数名 | 描述 |
---|---|
path | 要删除的节点对应的path |
version | 数据节点的版本号,乐观锁 |
cb | 异步删除时的回调函数 |
ctx | 回调函数的参数 |
- 例子
package com.banary.base;
import org.apache.zookeeper.*;
import java.util.concurrent.CountDownLatch;
public class DeleteDemo {
private static CountDownLatch countDownLatch = new CountDownLatch(1);
public static void main(String[] args) throws Exception{
asyncDelete();
}
public static void syncDelete() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
String path = zooKeeper.create("/deleteDemo", "deleteDemo".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
Thread.sleep(10000);
zooKeeper.delete(path, 0);
}
public static void asyncDelete() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
String path = zooKeeper.create("/deleteDemo", "deleteDemo".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
Thread.sleep(5000);
zooKeeper.delete(path, 0, new DemoCallback(), "asyncDelete");
Thread.sleep(5000);
}
private static class DemoWatcher implements Watcher{
@Override
public void process(WatchedEvent watchedEvent) {
System.out.println("创建zk会话:" + watchedEvent.getState());
if(Event.KeeperState.SyncConnected == watchedEvent.getState()){
System.out.println("zk会话创建成功");
countDownLatch.countDown();
}
}
}
public static class DemoCallback implements AsyncCallback.VoidCallback{
@Override
public void processResult(int rc, String path, Object ctx) {
System.out.println("删除节点成功:[" + rc + ", " + path + ", " + ctx.toString() + "]");
}
}
}
查询节点数据内容getData
- 方法
public byte[] getData(String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException
public byte[] getData(String path, boolean watch, Stat stat) throws KeeperException, InterruptedException
public void getData(String path, Watcher watcher, DataCallback cb, Object ctx)
public void getData(String path, boolean watch, DataCallback cb, Object ctx)
- 参数
参数名 | 描述 |
---|---|
path | 要获取数据的节点的路径 |
watcher | 监听器 |
watch | true表示使用默认的监听器,即创建zk对象时注册的监听器 |
stat | 数据节点的状态信息,传入一个旧的stat变量,服务器响应后会用的新的stat变量替换 |
cb | 异步方法的回调函数 |
ctx | 回调函数上下文参数 |
- 例子
package com.banary.base;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import java.util.concurrent.CountDownLatch;
public class GetDataDemo {
private static CountDownLatch countDownLatch = new CountDownLatch(1);
public static void main(String[] args) throws Exception{
asyncGetData();
}
/**
* 同步获取数据
* @throws Exception
*/
public static void syncGetData() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
String path = zooKeeper.create("/syncGetData", "syncGetData".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
System.out.println(new String(zooKeeper.getData(path,true, new Stat())));
}
/**
* 异步获取数据
*/
public static void asyncGetData() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
String path = zooKeeper.create("/asyncGetData", "asyncGetData".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
System.out.println(new String(zooKeeper.getData(path,true, new Stat())));
Thread.sleep(Integer.MAX_VALUE);
}
private static class DemoWatcher implements Watcher{
@Override
public void process(WatchedEvent watchedEvent) {
if(Event.KeeperState.SyncConnected == watchedEvent.getState()){
countDownLatch.countDown();
}
}
}
private static class DemoCallback implements AsyncCallback.DataCallback{
@Override
public void processResult(int rc, String path, Object ctx, byte[] bytes, Stat stat) {
System.out.println("异步获取的数据内容为:" + new String(bytes));
}
}
}
查询子节点getChildren
- 方法
public List<String> getChildren(String path, Watcher watcher) throws KeeperException, InterruptedException
public List<String> getChildren(String path, boolean watch) throws KeeperException, InterruptedException
public void getChildren(String path, Watcher watcher, ChildrenCallback cb, Object ctx)
public void getChildren(String path, boolean watch, ChildrenCallback cb, Object ctx)
public List<String> getChildren(String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException
public List<String> getChildren(String path, boolean watch, Stat stat) throws KeeperException, InterruptedException
public void getChildren(String path, Watcher watcher, Children2Callback cb, Object ctx)
public void getChildren(String path, boolean watch, Children2Callback cb, Object ctx)
- 参数
参数名 | 描述 |
---|---|
path | 要查询的节点 |
watcher | 注册一个监听器 |
watch | 使用默认的监听器 |
cb | 异步方法的回调函数 |
ctx | 回调函数上下文参数 |
stat | 闯入一个旧的Stat对象,查询后,会被服务端响应的新Stat对象替换 |
修改
- 方法
#同步方法
public Stat setData(String path, byte[] data, int version) throws KeeperException, InterruptedException
#异步方法
public void setData(String path, byte[] data, int version, StatCallback cb, Object ctx)
- 参数
参数名 | 描述 |
---|---|
path | 要修改的数据节点的路径 |
data | 修改后的数据 |
version | 数据修改时基于的版本号,即乐观锁 |
cb | 异步方法的回调函数 |
ctx | 回调函数上下文参数 |
- 例子
package com.banary.base;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import java.util.concurrent.CountDownLatch;
public class UpdateDemo {
public static CountDownLatch countDownLatch = new CountDownLatch(1);
public static void main(String[] args) throws Exception{
asyncUpdate();
}
/**
* 同步更新
*/
public static void syncUpdate() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
String path = zooKeeper.create("/syncUpdate", "syncUpdate".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
Stat stat = new Stat();
System.out.println(new String(zooKeeper.getData(path, true, stat)));
System.out.println(stat.getCzxid() + "," + stat.getMzxid() + "," + stat.getVersion());
//-1 表示不加乐观锁
zooKeeper.setData(path, "32123".getBytes(), -1);
System.out.println(new String(zooKeeper.getData(path, true, stat)));
System.out.println(stat.getCzxid() + "," + stat.getMzxid() + "," + stat.getVersion());
}
/**
* 异步更新
* @throws Exception
*/
public static void asyncUpdate() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
String path = zooKeeper.create("/asyncUpdate", "asyncUpdate".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
Stat stat = new Stat();
System.out.println(new String(zooKeeper.getData(path, true, stat)));
System.out.println(stat.getCzxid() + "," + stat.getMzxid() + "," + stat.getVersion());
zooKeeper.setData(path, "dsadsa".getBytes(), -1, new DemoCallback(), "回调");
Thread.sleep(Integer.MAX_VALUE);
}
private static class DemoWatcher implements Watcher{
@Override
public void process(WatchedEvent watchedEvent) {
if(Event.KeeperState.SyncConnected == watchedEvent.getState()){
countDownLatch.countDown();
}else if(watchedEvent.getType() == Event.EventType.NodeDataChanged){
System.out.println("节点数据内容发生了变化");
}
}
}
private static class DemoCallback implements AsyncCallback.StatCallback{
@Override
public void processResult(int rc, String path, Object ctx, Stat stat) {
System.out.println("修改节点:[" + rc + ", " + path + ", " + ctx.toString() +
", stat:" + stat.toString() + "]");
}
}
}
判断节点是否存在
- 方法
public Stat exists(String path, Watcher watcher) throws KeeperException, InterruptedException
public Stat exists(String path, boolean watch) throws KeeperException, InterruptedException
public void exists(String path, Watcher watcher, StatCallback cb, Object ctx)
public void exists(String path, boolean watch, StatCallback cb, Object ctx)
- 参数
参数名 | 描述 |
---|---|
path | 要判断的节点路径 |
watcher | 注册一个监听器,用来监听节点被创建,删除,更新 |
watch | 是否使用默认的监听器 |
cb | 异步方法的回调函数 |
ctx | 回调函数上下文参数 |
- 例子
package com.banary.base;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import java.util.concurrent.CountDownLatch;
public class ExistsNodeDemo {
public static CountDownLatch countDownLatch = new CountDownLatch(1);
public static void main(String[] args) throws Exception{
asyncExists();
}
/**
* 同步
*/
public static void syncExists() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
//创建
String path = zooKeeper.create("/syncExists", "syncExists".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
Stat stat = zooKeeper.exists(path, true);
System.out.println(stat.toString());
//更新
stat = zooKeeper.setData(path, "3213".getBytes(), -1);
System.out.println(stat.toString());
//删除
zooKeeper.delete(path, -1);
Thread.sleep(Integer.MAX_VALUE);
}
/**
* 异步
*/
public static void asyncExists() throws Exception{
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
//创建
String path = zooKeeper.create("/asyncExists", "asyncExists".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
zooKeeper.exists(path, true, new DemoCallback(), "asyncExists");
Thread.sleep(Integer.MAX_VALUE);
}
private static class DemoWatcher implements Watcher {
@Override
public void process(WatchedEvent watchedEvent) {
if(Event.KeeperState.SyncConnected == watchedEvent.getState()){
countDownLatch.countDown();
}else if(Event.EventType.NodeCreated == watchedEvent.getType()){
System.out.println("创建节点");
}else if(Event.EventType.NodeDataChanged == watchedEvent.getType()){
System.out.println("修改节点");
}else if(Event.EventType.NodeDeleted == watchedEvent.getType()){
System.out.println("删除节点");
}
}
}
public static class DemoCallback implements AsyncCallback.StatCallback{
@Override
public void processResult(int rc, String path, Object ctx, Stat stat) {
System.out.println("[" + rc + ", " + path + ", " + ctx.toString() +
", stat:" + stat.toString() + "]");
}
}
}
权限控制
- 方法
#zk会话对象的方法
public void addAuthInfo(String scheme, byte[] auth)
- 参数
参数名 | 描述 |
---|---|
scheme | 权限控制模式,枚举值:world,auth,digest,ip和super |
auth | 权限信息 |
- 例子
package com.banary.base;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import java.util.concurrent.CountDownLatch;
public class AuthDemo {
private static CountDownLatch countDownLatch = null;
public static void main(String[] args) throws Exception{
authCreate();
}
public static void authCreate() throws Exception{
countDownLatch = new CountDownLatch(1);
ZooKeeper zooKeeper = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
zooKeeper.addAuthInfo("digest", "auth".getBytes());
String path = zooKeeper.create("/auth", "auth".getBytes(), ZooDefs.Ids.CREATOR_ALL_ACL, CreateMode.PERSISTENT);
countDownLatch = new CountDownLatch(1);
ZooKeeper zooKeeper2 = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
zooKeeper2.addAuthInfo("digest", "auth".getBytes());
System.out.println(new String(zooKeeper2.getData(path, true, new Stat())));
countDownLatch = new CountDownLatch(1);
ZooKeeper zooKeeper1 = new ZooKeeper("localhost:2181", 5000, new DemoWatcher());
countDownLatch.await();
System.out.println(new String(zooKeeper1.getData(path, true, new Stat())));
}
private static class DemoWatcher implements Watcher {
public void process(WatchedEvent watchedEvent) {
if(Event.KeeperState.SyncConnected == watchedEvent.getState()){
countDownLatch.countDown();
}
}
}
}
总结
- 除了创建会话是异步的,其他操作都存在同步和异步方法,同步会抛出异常
- 创建会话、查询(包括查询该节点的数据和子节点和判断节点存在)都可以注册监听器,也可以使用会话的默认监听器
Java客户端API的更多相关文章
- JAVA客户端API调用memcached两种方式
1. memcached client for java客户端API:memcached client for java 引入jar包:java-memcached-2.6.2.jar package ...
- zookeeper的Java客户端API
zookeeper作为一个分布式服务框架,主要用来解决分布式数据一致性问题,对多种语言提供了API.这里主要记录下JAVA客户端API的使用. 1.创建会话 客户端可以通过创建一个ZooKeeper实 ...
- Zookeeper的java客户端API使用方法(五)
前面几篇博文,我们简单的介绍了一下zookeeper,如何安装zookeeper集群,以及如何使用命令行等.这篇博文我们重点来看下Zookeeper的java客户端API使用方式. 创建会话 客户端可 ...
- hadoop系列二:HDFS文件系统的命令及JAVA客户端API
转载请在页首明显处注明作者与出处 一:说明 此为大数据系列的一些博文,有空的话会陆续更新,包含大数据的一些内容,如hadoop,spark,storm,机器学习等. 当前使用的hadoop版本为2.6 ...
- 读《分布式一致性原理》JAVA客户端API操作2
创建节点 通过客户端API来创建一个数据节点,有一下两个接口: public String create(final String path, byte data[], List<ACL> ...
- [转载] ZooKeeper的Java客户端API
转载自 http://www.cnblogs.com/ggjucheng/p/3370359.html http://zookeeper.apache.org/doc/trunk/javaExampl ...
- 读《分布式一致性原理》JAVA客户端API操作3
更新数据 客户端可以通过zookeeper的API来更新一个节点的数据内容,有如下两个接口: public Stat setData(final String path, byte data[], i ...
- Zookeeper Java客户端API的使用
1. 原生api 具体查看下面github代码 2. ZkClient ZkClient是Github上一个开源的ZooKeeper客户端.ZkClient在ZooKeeper原生 A ...
- 读《分布式一致性原理》JAVA客户端API操作
创建会话 客户端可以通过创建一个Zookeeper实例来连接服务器.4种构造方法如下 ZooKeeper(connectString, sessionTimeout, watcher): ZooKee ...
随机推荐
- 发布 Google Chrome插件教程
换个视角,世界不一样.嘘~~~ 如果你会使用js的话,那么你就可以自己动手写一个chrome插件,而且非常容易.google是一个全球化的平台,想想自己的程序被世界人民所使用,是不是很激动? 注册开发 ...
- 微信公众号H5支付遇到的那些坑
简史 官方文档说的很清楚,商户已有H5商城网站,用户通过消息或扫描二维码在微信内打开网页时,可以调用微信支付完成下单购买的流程. 当然,最近微信支付平台也加入了纯H5支付,也就是说用户可以在微信以外的 ...
- TurnipBit:DIY音乐盒教程实例
一款可以自己DIY的音乐盒,要什么曲子,就自己谱曲啦!为他(她)制作一首他喜欢的音乐,来代表您的心意,也可以让他自己来制作他最爱的音乐哦!更可以带孩子一起体验谱写欢快的音乐. 最近发现一很好玩的中国式 ...
- OwinHost.exe用法
简介 OwinHost.exe是微软提供的自宿主host,如果自己不想写owin的host,可以用这个. 官方对OwinHost的描述为:Provides a stand-alone executab ...
- delphi用webservice
delphi的webservice开发. 一.在已有的项目中,调用外部的webservice 1.根据向导建webservice,在项目中引入“WSDL Importer".假设引入后生成的 ...
- 如何一条sql语句查找表中第二大值
例1: 一个Customer表,一个字段Value,现请问如何查到Value中第二大的值 select max(value) from Customer where value < (selec ...
- Android异常分析(转)
关于异常 异常? 异常就是一种程序中没有预料到的问题,既然是没有预料到的,就可能不在原有逻辑处理范围内,脱离了代码控制,软件可能会出现各种奇怪的现象.比如:android系统常见异常现象有应用无响应. ...
- windows虚拟内存管理
内存管理是操作系统非常重要的部分,处理器每一次的升级都会给内存管理方式带来巨大的变化,向早期的8086cpu的分段式管理,到后来的80x86 系列的32位cpu推出的保护模式和段页式管理.在应用程序中 ...
- Zabbix实战-简易教程--拓扑图(Maps)
一.拓扑图(Maps) 二话不说,有图有真相,先看看效果,再详细讲解配置过程: 图1:全国网络质量图 图2 核心机房网络质量图 二.详细配置 1.添加 map 选择 系统管理-->基础配置-- ...
- Erlang gen_server进程花样作死
本文主要记录各种情况下gen_server进程退出的表现. 研究动机起源于Elixir/Phoenix框架中遇到的一个进程异常退出问题.因为网络异常,客户端超过一段时间未发来消息,channel进程( ...