[incubator-dubbo] branch master updated: solve compatible issue with dubbo 2.5.9, 2.5.10 (#2176)
This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git The following commit(s) were added to refs/heads/master by this push: new 70e1e62 solve compatible issue with dubbo 2.5.9, 2.5.10 (#2176) 70e1e62 is described below commit 70e1e6220b82fd20611d7ec2624726442671bf95 Author: jasonjoo2010 AuthorDate: Fri Aug 3 16:07:29 2018 +0800 solve compatible issue with dubbo 2.5.9, 2.5.10 (#2176) --- dubbo-common/src/main/java/org/apache/dubbo/common/Version.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java b/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java index c22242c..983cbb9 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java @@ -35,7 +35,7 @@ public final class Version { private static final Logger logger = LoggerFactory.getLogger(Version.class); // Dubbo RPC protocol version, for compatibility, it must not be between 2.0.10 ~ 2.6.2 -public static final String DEFAULT_DUBBO_PROTOCOL_VERSION = "2.0.1"; +public static final String DEFAULT_DUBBO_PROTOCOL_VERSION = "2.0.2"; // Dubbo implementation version, usually is jar version. private static final String VERSION = getVersion(Version.class, ""); @@ -43,7 +43,7 @@ public final class Version { * For protocol compatibility purpose. * Because {@link #isSupportResponseAttatchment} is checked for every call, int compare expect to has higher performance than string. */ -private static final int LOWEST_VERSION_FOR_RESPONSE_ATTATCHMENT = 20001; // 2.0.1 +private static final int LOWEST_VERSION_FOR_RESPONSE_ATTATCHMENT = 20002; // 2.0.2 private static final Map VERSION2INT = new HashMap(); static { @@ -202,4 +202,4 @@ public final class Version { } } -} \ No newline at end of file +}
[incubator-dubbo-website] branch asf-site updated: publish blog 'dubbo-zk'
This is an automated email from the ASF dual-hosted git repository. iluo pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 3d584d7 publish blog 'dubbo-zk' 3d584d7 is described below commit 3d584d7fe0424b435dd014f1379aafe7a7d0ae54 Author: beiwei.ly AuthorDate: Fri Aug 3 16:01:17 2018 +0800 publish blog 'dubbo-zk' --- blog/zh-cn/dubbo-zk.md | 339 + ...7ba6acec73c8197d.js => 0abb2937d4e2bc4697f3.js} | 2 +- build/0b0bbf419be1d7b49571.js | 6 - ...f8eca3ff7556b8db.js => 197de76506a1ddd84a4b.js} | 0 build/55de20a411cd16ffcaad.js | 6 + ...ed1d026d7ba627aa.js => 87c67c0d7caf73d7e493.js} | 0 ...5d02abb36f898304.js => c5ce7257df274bc595ec.js} | 2 +- build/page.js | 2 +- img/blog/dubbo-in-zk.jpg | Bin 0 -> 31272 bytes img/blog/zk-emsemble.png | Bin 0 -> 86220 bytes img/blog/zk-tree.png | Bin 0 -> 34214 bytes md_json/blog.json | 4 + md_json/docs.json | 8 +- site_config/blog.js| 7 + 14 files changed, 363 insertions(+), 13 deletions(-) diff --git a/blog/zh-cn/dubbo-zk.md b/blog/zh-cn/dubbo-zk.md new file mode 100644 index 000..8a69062 --- /dev/null +++ b/blog/zh-cn/dubbo-zk.md @@ -0,0 +1,339 @@ +# 在 Dubbo 应用中使用 Zookeeper + +## Zookeeper 介绍 + +### 基本概念 + +在现代的分布式应用中,往往会出现节点和节点之间的协调问题,其中就包括了:选主、集群管理、分布式锁、分布式配置管理、统一命名服务、状态同步等诉求。[Apache Zookeeper](https://zookeeper.apache.org),正如它的名字所暗示的那样,*动物园管理员*,就是为了解决这些诉求的一个分布式协调服务框架。 + +为了保证高可用,ZooKeeper 本身也可以部署成集群模式,称之为 *ZooKeeper ensemble*。ZooKeeper 集群中始终确保其中的一台为 leader 的角色,并通过 *ZAB (Zookeeper Atomic Broadcast Protocol) [^1]* 协议确保所有节点上的信息的一致。客户端可以访问集群中的任何一台进行读写操作,而不用担心数据出现不一致的现象。 + +![Diagram shows client-server architecture of ZooKeeper](../../img/blog/zk-emsemble.png) +*Image Credit : ebook -Zookeeper-Distributed Process Coordination from O'Reilly* + +Zookeeper 中的数据存储方式与传统的 UNIX 文件系统相似,节点按照树状结构来组织,其中,节点被称之为 *znodes (ZooKeeper data nodes)* + +![zk-tree](../../img/blog/zk-tree.png) +*Image Credit : ebook -Zookeeper-Distributed Process Coordination from O'Reilly* + +### 基本用法 + +可以通过直接下载的方式 [^2]安装并运行 Zookeeper ,在 Mac 上也可以通过 Homebrew [^3] `brew install zookeeper` 来安装,考虑到通用性,本文采用 docker 的方式来运行 Zookeeper。如果没有安装 docker,请先准备好 docker 环境 [^4]。 + + 1. 启动 Zookeeper + +执行命令将 Zookeeper 运行在 docker 容器中 + +```shell +docker run --rm --name zookeeper -p 2181:2181 zookeeper +``` + + 2. 进入 Zookeeper 容器 + +```shell +docker exec -it zookeeper bash +``` + +在 `bin` 目录下有启动 Zookeeper 的命令 `zkServer` 以及管理控制台 `zkCli` + +```shell +bash-4.4# ls -l bin +total 36 +-rwxr-xr-x1 zookeepe zookeepe 232 Mar 27 04:32 README.txt +-rwxr-xr-x1 zookeepe zookeepe 1937 Mar 27 04:32 zkCleanup.sh +-rwxr-xr-x1 zookeepe zookeepe 1056 Mar 27 04:32 zkCli.cmd +-rwxr-xr-x1 zookeepe zookeepe 1534 Mar 27 04:32 zkCli.sh +-rwxr-xr-x1 zookeepe zookeepe 1759 Mar 27 04:32 zkEnv.cmd +-rwxr-xr-x1 zookeepe zookeepe 2696 Mar 27 04:32 zkEnv.sh +-rwxr-xr-x1 zookeepe zookeepe 1089 Mar 27 04:32 zkServer.cmd +-rwxr-xr-x1 zookeepe zookeepe 6773 Mar 27 04:32 zkServer.sh +``` + + 3. 通过 zkCli 进入 Zookeeper 管理界面 + +由于是通过 Docker 启动,Zookeeper 进程已经启动,并通过 2181 端口对外提供服务。 + +```shell +bash-4.4# ps +PID USER TIME COMMAND +1 zookeepe 0:02 /usr/lib/jvm/java-1.8-openjdk/jre/bin/java -Dzookeeper.log.dir=. -Dzookeeper.root + 32 root 0:00 bash + 42 root 0:00 ps +``` + +因此可以直接通过 `zkCli` 来访问 Zookeeper 的控制台来进行管理。 + +```shell +bash-4.4# bin/zkCli.sh -server 127.0.0.1:2181 +Connecting to 127.0.0.1:2181 +... +WATCHER:: + +WatchedEvent state:SyncConnected type:None path:null + +[zk: 127.0.0.1:2181(CONNECTED) 0] help +ZooKeeper -server host:port cmd args + stat path [watch] + set path data [version] + ls path [watch] + delquota [-n|-b] path + ls2 path [watch] + setAcl path acl + setquota -n|-b val path + history + redo cmdno + printwatches on|off + delete path [version] + sync path + listquota path + rmr path + get path [watch] + create [-s] [-e] path data acl + addauth scheme auth + quit + getAcl path + close + connect host:port +``` + + 4. zkCli 上的一些基本操作 + +创建 `/hello-zone` 节点: + +```shell +[zk: 127.0.0.1:2181(CONNECTED) 19] create /hello-zone 'world' +Created /hello-zone +``` + +列出 `/` 下的子节点,确认 `hello-zone` 被创建: + +```shell +[zk: 127.0.0.1:2181(CONNECTED) 20] ls / +[zookeeper, hello-zone] +``` + +列出 `/hello-zone` 的子节点,确认为空: + +```shell +[zk: 127.0.0.1:2181(CONNECTED) 21] ls /hello-zone +[] +``` + +获取存储在 `/hello-zone` 节点上的数据: + +```s
[incubator-dubbo-website] branch asf-site updated: fix the default value of threads and payload in dubbo:provider and dubbo:protocol (#65)
This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-website.git The following commit(s) were added to refs/heads/asf-site by this push: new ecfffda fix the default value of threads and payload in dubbo:provider and dubbo:protocol (#65) ecfffda is described below commit ecfffda9c7a167e66162ffca25b7a0ba5756bac4 Author: shaoshuai AuthorDate: Fri Aug 3 15:33:25 2018 +0800 fix the default value of threads and payload in dubbo:provider and dubbo:protocol (#65) * fix the default value of threads and payload in dubbo:protocol fix the default value of threads to 200 fix the default value of payload to 8 * 1024 * 1024 = 8388608 (8M) --- docs/en-us/user/references/xml/dubbo-protocol.md | 4 ++-- docs/en-us/user/references/xml/dubbo-provider.md | 4 ++-- docs/zh-cn/user/references/xml/dubbo-protocol.md | 4 ++-- docs/zh-cn/user/references/xml/dubbo-provider.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/en-us/user/references/xml/dubbo-protocol.md b/docs/en-us/user/references/xml/dubbo-protocol.md index ba86533..b655502 100644 --- a/docs/en-us/user/references/xml/dubbo-protocol.md +++ b/docs/en-us/user/references/xml/dubbo-protocol.md @@ -53,10 +53,10 @@ Service provider protocol configuration. The corresponding class is `com.alibaba | port || int| False | The default port of dubbo protocol is 20880, rmi protocol is 1099, http and hessian protocol are 80;It will allocate the default port if `port` is not filled; It will allocate an unused port if `port` equals `-1`. To ensure the ports scope is controllable, the port will increase based on the corresponding protocol default port after Dubbo 2.4.0+ | Service discovery | Service port[...] | host | | string | False | Find local IP automatically | Service discovery | -The host name of services, to specify VIP and domain, or having multiple network cards. If null, it will find local IP automatically- It's recommended to let Dubbo find local IP automatically | Above 2.0.5 | | threadpool| threadpool | string | False | fixed| Performance optimize | The type of Thread Pool, fixed/cached are available | Above 2.0.5 | -| threads | threads | int| False | 100 | Performance optimize | The size of the services' Thread Pool(Fixed) | Above 2.0.5 | +| threads | threads | int| False | 200 | Performance optimize | The size of the services' Thread Pool(Fixed) | Above 2.0.5 | | iothreads | threads | int| False | The count of CPU + 1 | Performance optimize | The size of io Thread Pool(Fixed)| Above 2.0.5 | | accepts | accepts | int| False | 0| Performance optimize | The maximum connection count of the service provider | Above 2.0.5 | -| payload | payload | int| False | 88388608(=8M)| Performance optimize | The length limit of request and response, unit is byte | Above 2.0.5 | +| payload | payload | int| False | 8388608(=8M)| Performance optimize | The length limit of request and response, unit is byte | Above 2.0.5 | | codec | codec | string | False | dubbo| Performance optimize | Protocol encoding| Above 2.0.5 | | serialization | serialization | string | False | The default serialization of dubbo protocol is hessian2, rmi protocol is java, http protocol is json | Performance optimize | Protocol serialization, It's used when a protocol has multiple serializations. For example, `dubbo` protocol has 4 serializations, they are `dubbo`, `hessian2`, `java` and `compactedjava`. | Above 2.0.5 | | accesslog | accesslog | string/boolean | False | | Service discovery | `true` will write access log to logger. Specifying it to a log path, you can write access logs to special log file. | Above 2.0.5 | diff --git a/docs/en-us/user/references/xml/dubbo-provider.md b/docs/en-us/user/references/xml/dubbo-provider.md index ad081b0..c90fff6 100644 --- a/docs/en-us/user/references/xml/dubbo-provider.md +++ b/docs/en-us/user/references