Spring MVC + zookeeper + Dubbo configuration

Source: Internet
Author: User
Tags zookeeper server port

1, First Download Zookeeper registration Center,: http://www.apache.org/dyn/closer.cgi/zookeeper/

2, in the Conf directory, there is a zoo_sample.cfg file, name it zoo.cfg, and modify the configuration file

the Following is a description of each parameter:

Ticktime: this time is the interval between zookeeper servers or between the client and the server, which means that every ticktime time sends a heartbeat.

Datadic:zookeeper the directory where the data is stored, by default, Zookeeper writes the log of the data in this Directory.

Datalogdir:zookeeper directory where log files are saved

Clientport: the client connects to the port of the zookeeper server, zookeeper listens to the port and accepts the Client's access Request.

Because zookeeper needs to use 8080 of this port by default, the zookeeper most recent version has an embedded management console that is started by jetty and consumes 8080 ports.

By looking at Zookeeper's official documentation, There are 3 ways to solve this problem:

(1). Delete Jetty.

(2) Modify the Port.

There are two ways to modify a method, one is to add-dzookeeper.admin.serverport= to your port number in the startup Script. one is to increase the port number in the Zoo.cfg admin.serverport= not occupied

(3) Disable this service and add "-dzookeeper.admin.enableserver=false" to the startup script

3. Double-click Zkserver.cmd in the Bin folder to start the registry Service.

Also talk about Dubbo+zookeeper and provider provider, consumer consumer communication between the process,

Zookeeper as a registry, using a separate server, occupying 2181 Ports.

Dubbo-admin as a monitoring center, using the same server as the zookeeper, the Tomcat deployment occupies 8080 Ports.

Provider as a provider, using the unit server, tomcat deployments occupy 8080 ports and open 20880 ports using the Dubbo Protocol.

Consumer as a consumer, using servers alone, tomcat deployments occupy 8080 Ports.

1, with Dubbo protocol on 20880 Port exposure service

In the Provider's Dubbo configuration file, It is generally configured with the

1<Dubbo:protocolname="Dubbo"Port="20880"/ >

Indicates that the Dubbo protocol exposes the service at Port 20880, of course, if not configured, by default 20880 port exposure service, All consumers are through 20880 ports, for consumers, the provider service 8080 port is transparent, that is, the provider server port number can be arbitrarily changed, Service will not have any impact, consumers do not care.

So the provider needs to open 20880 ports to consumers, not 8080 ports to Consumers.

2, Port Open situation

zookeeper as a registration center, provider registration service, consumer subscription service, dubbo-admin monitoring service, so the Zookeeper registry port 2181 needs to provider, consumer, Dubbo-admin open;

One of your cases, the Dubbo-admin Monitoring Center and the Zookeeper Registration center are deployed on the same server, zookeeper can not consider the port open to Dubbo-admin situation;

The Cunsumer subscription service, which gets the provider on the 20880 port exposed service, when the consumer request service is, jumps directly from consumer to provider, not consumer to zookeeper to provider, so , the provider 2080 port does not need to open to the zookeeper;

similarly, provider corresponding services, but also directly from the provider to consumer, rather than provider to zookeeper and consumer, so consumer 8080 no need to open to zookeeper;

3. Summarize

zookeeper's 2181 open to provider, consumer, dubbo-admin

Provider 20880 is open to all consumer, but 8080 service ports can be shielded

consumer's 8080 Open to all the provider

The dubbo-admin 8080 is open to admin users, making it easy to monitor registry services through a Browser.

the Registry is only responsible for service registration and Directory publishing, Security authorization, The actual service access is still a point-to-point connection between two components to complete, in this way the entire architecture to achieve higher performance, the colleague Service management platform is not easy to become a large concurrent service access under the single point Bottleneck.

attached: Management page of Dubbo

Download Required: dubbo-admin-2.5.3 's War pack

: http://download.csdn.net/detail/u013286716/7041185

The operation is as Follows:

1, replace the root folder content under Tomcat/webapps (that is, replace Tomcat's startup home page), unzip the downloaded war package into webapps/root, and replace it directly .

Note:JDK does not use 1.8, this experiment is used for 1.7

2, start tomcat, Access ip:8080, or if it is local, use localhost:8080

Enter the user name password, in the Dubbo.properties file under E:\apache-tomcat-7.0.6-dubbo\webapps\ROOT\WEB-INF can be seen, such as:

3, visit http://localhost:8080/dubbo-admin-2.5.3

4, start our service providers and consumers to view

Spring MVC + zookeeper + Dubbo configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.