Dubbo (two): zookeeper registry

zookeeper registry

Zookeeper is Apacahe Hadoop subprojects, is a tree of directory services to support change push for Dubbo services as registration centers, industrial high strength, can be used in a production environment, and recommended [1].

Flow Description:

  • Service Provider startup: URL address to write their own directory under /dubbo/com.foo.BarService/providers
  • When consumers start service: subscription provider directory at /dubbo/com.foo.BarService/providers URL address. And write their own URL address directory under /dubbo/com.foo.BarService/consumers
  • Monitoring Center on startup: subscribe to all providers and consumers URL addresses under /dubbo/com.foo.BarService directory.

It supports the following features:

  • When the provider of a power failure or other abnormal shutdown, the registry can automatically delete information provider
  • When the registry to restart, can automatically restore the registration data, as well as subscription request
  • When the session expires, it can automatically restore the registration data, as well as subscription request
  • When set , The recording fails registration and a subscription request retry timer background
  • accessible Set login information zookeeper
  • accessible Set the root zookeeper, and is not configured to use the default root node.
  • Support * wildcard , All packets can subscribe to the service providers and all versions of
    the use of
    the provider and consumer clients increased zookeeper jar package dependencies:
<dependency>
    <groupId>org.apache.zookeeper</groupId>
    <artifactId>zookeeper</artifactId>
    <version>3.3.3</version>
</dependency>

Or direct download.

Dubbo support zkclient and curator two kinds Zookeeper client implementation:

Note: zkclient has been removed to achieve the 2.7.x version, if you want to use zkclient client, you need to expand their own

Use zkclient client
from version 2.2.0 to start by default zkclient implemented to improve the robustness of the client zookeeper. zkclient Datameer open source is a Zookeeper client implementation.

The default configuration:

<dubbo:registry ... client="zkclient" />

or:

dubbo.registry.client=zkclient

or:

zookeeper://10.20.153.10:2181?client=zkclient

Or need to rely on direct download:

<dependency>
    <groupId>com.github.sgroschupf</groupId>
    <artifactId>zkclient</artifactId>
    <version>0.1</version>
</dependency>

Use curator client
from version 2.3.0 supports optional curator beginning to realize. Curator open source Netflix is a Zookeeper client implementation.

If you need to change curator implement, configure:

<dubbo:registry ... client="curator" />

or:

dubbo.registry.client=curator

or:

zookeeper://10.20.153.10:2181?client=curator

Or need to rely on direct download:

<dependency>
    <groupId>com.netflix.curator</groupId>
    <artifactId>curator-framework</artifactId>
    <version>1.1.10</version>
</dependency>

Zookeeper stand-alone configuration:

<dubbo:registry address="zookeeper://10.20.153.10:2181" />

or:

<dubbo:registry protocol="zookeeper" address="10.20.153.10:2181" />

Zookeeper cluster configuration:

<dubbo:registry address="zookeeper://10.20.153.10:2181?backup=10.20.153.11:2181,10.20.153.12:2181" />

or:

<dubbo:registry protocol="zookeeper" address="10.20.153.10:2181,10.20.153.11:2181,10.20.153.12:2181" />

The same Zookeeper, divided into groups registry:

<dubbo:registry id="chinaRegistry" protocol="zookeeper" address="10.20.153.10:2181" group="china" />
<dubbo:registry id="intlRegistry" protocol="zookeeper" address="10.20.153.10:2181" group="intl" />

zookeeper installation
Installation See: Zookeeper installation manual, just take a native Zookeeper server, and Quick Start value dubbo.registry.address of the Provider and Consumer in the conf / dubbo.properties was changed zookeeper: //127.0 .0.1: 2181 can be used.

Reliability declare
internal Zookeeper as Ali did not use the registry, but the use of registry-based database of their own to achieve, namely: Zookeeper registry does not guarantee the reliability of long-running internal Ali, only to realize this bridge Zookeeper providing open source version, its reliability depends on the reliability Zookeeper itself.

Compatibility statement
because zookeeper storage structure 2.0.8 was originally designed not to expand different types of data, version 2.0.9 has been adjusted, it is not compatible, need all use version 2.0.9 for the job, will remain compatible with future releases 2.0 .9.2.2.0 version changed based zkclient achieve, need to increase zkclient dependencies, version 2.3.0 adds achieve curator based, as an alternative implementation strategies.

2.3.3 or later is recommended zookeeper client registry

This paper consists of a low-key multiple operating panda article published! No welcome public attention: a low-key red panda

Guess you like

Origin www.cnblogs.com/aodeng/p/11826664.html