Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the comparison of zookeeper registries?

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail what the comparison of zookeeper registration centers is like, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Recently, I found a more detailed comparison of registries in learning zookeeper registration.

Write it down briefly:

1 ZooKeeper

A service management application developed by Java. Is a sub-project of the Hadoop project. The zookeeper. Is a management application for other applications, responsible for coordination, scheduling, management, configuration and other functions.

Support breakpoint recovery, session recovery, configuration service items, configuration consumption items, wildcard information configuration, etc.

ZooKeeper is an application developed by Java. The running environment only needs JDK and JVM.

2 Multicast

A broadcast registration center. As long as Provider and Consumer are in the same network segment, the service can be published and subscribed.

Limitations: only suitable for small architectures or development tests. Because it may cause a broadcast storm. More than 5 physical machines in the network segment publish services at the same time, which may cause data communication problems and fail to realize fast service subscription and application.

3 Redis

KV server registry. KV server, cache server. Memory database. NOSQL database. Later, there will be a detailed explanation of the course.

Similar to the ZooKeeper registry. Provider publishes services to Redis, and Consumer subscribes to services from Redis.

Advantage: high efficiency.

Defects: the description of the data is relatively simple and the frequency of use is relatively small. Without a large number of tests, the stability is uncertain.

4 Simple

It is a registry customized by Dubbo. Reduce tripartite dependence. Reduce code dependency and coupling.

Only suitable for small applications and development testing.

The following quotes explain in detail

Multicast registration in China

Multicast registrations do not need to start any Chinese nodes, as long as the "broadcast address" is like, they can discover each other.

1. Provide the address of "broadcast" at startup

two。 Consume "on startup" broadcast subscription request

3. Provide the address of the unicast subscription to the subscriber when the subscription request is received, and broadcast it to the subscriber if unicast=false is set

4. When the consumer "receives the provided" address, connect the address to enter the RPC call.

Due to the limitation of network structure, multicast is only suitable for "scale should" or development phase. Multicast address range: 224.0.0.0-239.255.255.255

Configuration

Or

In order to reduce broadcast volume, Dubbo defaults to unicast to send provider address information to consumers. If more than one consumer process is started on each machine at the same time, consumption

You need to declare unicast=false, otherwise only two consumers will receive the message:

Or

Zookeeper registration in China

Zookeeper is the entry of Apacahe Hadoop and a tree-based recording service. It holds change push and is suitable for registration as a Dubbo service.

The strength of the industry is relatively low, and it can be used in the production environment, and it is recommended to make it.

Process description:

When the service provider starts: record the URL address that writes "write" to / dubbo/com.foo.BarService/providers

When the service consumer starts: subscribe to the provider URL address recorded by / dubbo/com.foo.BarService/providers customers. Parallel to

/ dubbo/com.foo.BarService/consumers record the URL address that writes "please".

Monitor all provider and consumer URL addresses recorded by subscription / dubbo/com.foo.BarService on startup.

The following functions are supported:

When the provider has an abnormal outage such as a power outage, the provider information can be deleted in the registration.

When the registration is restarted, you can recover the registration data and subscribe to the request.

When the session expires, you can recover registration data and subscribe requests.

When set, failed registration and subscription requests are recorded, and the background retries regularly.

You can set zookeeper login information

You can set the root node of the zookeeper. If you do not set it, you will make the root tree grow.

Subscription holds the * wildcard character and can subscribe to all groups of services and providers of all versions

To make a fool

Add zookeeper client jar package dependencies to provider and consumer:

Org.apache.zookeeper

Zookeeper

3.3.3

Or download it directly.

Dubbo supports two Zookeeper client implementations of zkclient and curator:

Make the zkclient client

Starting with version 2.2.0, the default is the zkclient implementation to improve the health of zookeeper clients. Zkclient is the open source of Datameer.

Zookeeper client implementation.

Default configuration:

Or:

Dubbo.registry.client=zkclient

Or:

Zookeeper://10.20.153.10:2181?client=zkclient

Need to rely on or download directly:

Com.github.sgroschupf

Zkclient

0.1

Make the curator client

The optional curator implementation has been supported since version 2.3.0. Curator is one of Netflix's open source Zookeeper client implementations.

If you need to change to the curator implementation, configure:

Or:

Dubbo.registry.client=curator

Or:

Zookeeper://10.20.153.10:2181?client=curator

Need to rely on or download directly:

Com.netflix.curator

Curator-framework

1.1.10

Zookeeper stand-alone configuration:

Or:

Zookeeper cluster configuration:

Or:

The same Zookeeper is divided into several groups of registrations:

Zookeeper installation

To install the Zookeeper installation booklet, you only need to set up an original Zookeeper server, and add Provider and

Change the value of dubbo.registry.addrss in the conf/dubbo.properties of Consumer managers to zookeeper://127.0.0.1:2181 to make the

Thank you.

Reliability statement

Zookeeper is not used as a registration tool in Ah Tong. It is a database-based registration process that enables you to register, that is, Zookeeper registration.

This Zookeeper bridging implementation is only available for the open source version, and its reliability depends on

The reliability of Zookeeper itself.

Compatibility statement

Because the zookeeper storage structure originally designed in 2.0.8 cannot expand different types of data, version 2.0.9 has been adjusted, so it is not compatible and needs to be changed.

Version 2.0.9 only, and future versions will remain compatible with 2.0.9. Version 2.2.0 is based on zkclient implementation, which needs to increase the dependence of zkclient.

Package, version 2.3.0 adds an curator-based implementation as an optional implementation strategy.

. It is recommended that the client ↩ be registered with zookeeper version 2.3.3 or above.

Redis registration in China

Registration based on Redis.

Make the Key/Map structure of Redis store the data structure:

The main Key is the service name and type

Key in Map is the URL address

The Value in the Map is the expiration time, which can be used to judge the dirty data, and the dirty data is deleted by the monitor.

Make the Publish/Subscribe event of the notify Redis notify the data change:

Event types are distinguished by their values: register, unregister, subscribe, unsubscribe

Ordinary consumers subscribe to the Key of the specified service provider directly, and only receive the register and unregister events of the specified service.

If you subscribe to / dubbo/* through the psubscribe function, you will receive all change events for all services.

Tuning process:

1. When the service provider starts, add the address of the current provider to Key:/dubbo/com.foo.BarService/providers

two。 And send register events to Channel:/dubbo/com.foo.BarService/providers

3. Subscribe to register and unregister events from Channel:/dubbo/com.foo.BarService/providers when service consumption starts

4. And add the address of the current consumer to Key:/dubbo/com.foo.BarService/providers

5. After receiving the register and unregister events, the service consumer gets the provider's location from the Key:/dubbo/com.foo.BarService/providers

Address list

6. Subscribe to register and unregister from Channel:/dubbo/*, as well as subscribe and unsubsribe events when service monitoring starts

7. After receiving the register and unregister events in the service monitoring, get the provider from the Key:/dubbo/com.foo.BarService/providers

Address list

8. After receiving the subscribe and unsubsribe events in the service monitoring, get the consumption from the Key:/dubbo/com.foo.BarService/consumers

List of author's address

Configuration

Or

Or

Or

Option

You can set the prefix of key in redis, which defaults to dubbo.

You can set the redis cluster policy. The default is failover:

Failover: only write and read any server. If you fail, you need to retry another server. You need to configure data synchronization on the server.

Replicate: write all servers at the same time on the client side, read only a single server, do not need synchronization on the server side, increase the number of clusters in registration, and reduce the performance.

"it will be more serious."

Reliability statement

Redis is not used as a registration tool internally, but is not included in the database-based registration that enables it to be implemented, that is, Redis registration is not included in

This Redis bridging implementation is only available for the open source version, and its reliability depends on the reliability of Redis itself.

Installation

To install the Redis installation volume, you only need to set up an original Redis server and change the Provider and Consumer files in the Quick Start

The value of dubbo.registry.addrss in conf/dubbo.properties is changed to redis://127.0.0.1:6379.

. Redis is an efficient KV storage server ↩

. ↩ has been supported since version 2.1.0

. Redis expired data detects dirty data through "hop" mode, server time must be synchronized, and there is a "constant pressure" on the server, otherwise expiration detection

Would be inaccurate, ↩.

Simple registration in China

Simple registration is an ordinary Dubbo service in itself, which can reduce the dependence of the third party and make the overall communication more efficient.

Configuration

Expose Simple registrations as Dubbo services:

Quote Simple Registry service:

Or:

Or:

Description of suitability

This SimpleRegistryService is a simple implementation and does not support the cluster. It can be used as a reference for "defining registration", but it is not suitable for production environment.

Telnet Command reference Book

Starting from version 2.0.5, dubbo has started to mirror service governance through the telnet command.

To make a fool

Telnet localhost 20880

Or:

Echo status | nc-I 1 localhost 20880

The resources checked by the status command can also be extended, see: extended reference book.

Command

The following shows the description and method of the built-in telnet command in dubbo. In addition, the telnet command also supports the user extension. See: Telnet command extension.

Ls

1. Ls: displays a list of services

2. Ls-l: displays a list of service details

3. Ls XxxService: displays the list of methods for services

4. Ls-l XxxService: displays a list of details of the method for the service

Ps

1. Ps: displays a list of server clients

2. Ps-l: displays the list of service addresses

3. Ps 20880: displays the connection information on the stub

4. Ps-l 20880: displays connection details on the stub

Cd

1. Cd XxxService: change the default service. When the default service is set, the service parameter can be omitted for any command that needs to input the service name as a parameter.

2. Cd /: cancel the default service

Pwd

Pwd: displays the current default service

Trace

1. Trace XxxService: track the call status of one service call in any way

2. Trace XxxService 10: track 10 calls for arbitrary service calls

3. Trace XxxService xxxMethod: track the scheduling of one service subscription

4. Trace XxxService xxxMethod 10: track the performance of 10 service subscriptions

11 telnet Command reference Book

one hundred and forty five

Count

1. Count XxxService: statistics on the scheduling of one service in any way.

2. Count XxxService 10: statistics of 10 arbitrary service calls

3. Count XxxService xxxMethod: statistics on the adjustment of one service delivery method

4. Count XxxService xxxMethod 10: statistics of 10 service calls

Invoke

1. Invoke XxxService.xxxMethod ({"prop": "value"}): the method of calling the service

2. Invoke xxxMethod ({"prop": "value"}): the method of calling the service (to find the service that contains this method)

Status

1. Status: displays summary status, which summarizes the status of all resources, displays OK when all OK is available, and displays as long as there are ERROR

ERROR, which displays WARN as long as there are two WARN

2. Status-l: displays a list of status

Log

1. Log debug: modify the blog level of dubbo logger

2. Log 100: view the blog of the last 100 characters of file logger

Help

1. Help: displays telnet life help information

2. Help xxx: displays detailed help information for xxx commands

Clear

1. Clear: clear the contents of the screen

2. Clear 100th: clears the contents of the specified number of bytes on the screen

Exit

Exit: exits the current telnet command

. Version 2.0.6 and above supports ↩

On the zookeeper registry is what the comparison is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report