Construction of Zookeeper Registration Center and Dubbo-Admin Management Platform

  ZooKeeper is a distributed, open source distributed application coordination service, an open source implementation of Google's Chubby, and an important component of Hadoop and Hbase. It is a software that provides consistent services for distributed applications. The functions provided include: configuration maintenance, name service, distributed synchronization, group service, etc.

  ZooKeeper official website is: http://zookeeper.apache.org/

  Dubbo is Alibaba's open source distributed service framework. Its biggest feature is that it is structured in a layered manner, which can decouple (or maximize loose coupling) between layers. From the perspective of service model, Dubbo adopts a very simple model, either the provider provides the service, or the consumer consumes the service, so based on this, the service provider (Provider) and the service consumer can be abstracted (Consumer) Two roles. About the registry, protocol support, service monitoring, etc.

  Dubbo official website is: http://dubbo.io/

 1. Zookeeper installation and startup

  First, you need to install JdK, download it from Oracle's Java website, the installation is very simple, so I won't go into details. The download address of zookeeper is http://www.apache.org/dyn/closer.cgi/zookeeper/, which can be directly decompressed after downloading without installation.

Before you execute the startup script, there are several basic configuration items that need to be configured. The configuration file of Zookeeper is in the conf directory. There are zoo_sample.cfg and log4j.properties in this directory. All you need to do is to put zoo_sample.cfg  Renamed to  zoo.cfg , because Zookeeper will look for this file as the default configuration file when it starts. The following is a detailed introduction to the meaning of each configuration item in this configuration file, as shown in the following figure. 

 

Parameter Description:

tickTime: The basic time unit used in zookeeper, the millisecond value is the time interval for maintaining heartbeats between Zookeeper servers or between clients and servers, that is, a heartbeat is sent every tickTime.

dataDir: data directory. Can be any directory, by default Zookeeper will write data

The log files are also saved in this directory.

clientPort: This port is the port where the client connects to the Zookeeper server. Zookeeper will listen to this port and accept the client's access request.

So far, the stand-alone mode of zookeeper has been configured. To start the server, just run zkServer.cmd in the bin directory, and start it as follows:

 

If the black box above is not closed, it means that the registration center is always on and off. It must be remembered that the registration center must be before the program runs. Enter JPS in the command window, and the following appears, which also indicates that the startup is successful:

 

  2. Installation of Dubbo-admin management platform

  Because zookeeper is just a black box, we can't see whether there are any providers or consumers. At this time, we need to use the Dubbo-Admin management platform to view in real time, and we can also manage the providers and consumers through this platform. Since I am using the jdk1.8 version, I found a lot of dubbo-admin.war on the Internet, which are basically based on jdb1.7, because I packaged a version that supports jdk1.8, which can be downloaded at the following address. Available: http://download.csdn.net/detail/chinahuyong/9806244

  All source code for dubbo can be downloaded at https://github.com/alibaba/dubbo .

 

  After downloading dubbo-admin.war, we can deploy it according to the common web deployment method. Put the war package in the webapps directory of tomcat, start tomcat, and then deploy the corresponding parameters. Configure and modify the port 8088 of tomcat, the modification method is as follows, type the file server.xml under conf, because zookeeper will use the port 8080, so in order not to conflict, change the port of Tomcat, remember to change it! ! !

 

  There is one thing to pay attention to here. Now we are still the packaged war file. We also need the corresponding configuration of the dubbo-admin package, so we need to start tomcat first, let it automatically decompress the dubbo-admin package, then close the tomcat, and then delete the dubbo After -admin.war package, modify the dubbo.properties file under \WEB-INF under dubbo-admin, as shown below:

 

  The IP address corresponding to the dubbo.regist ry.address here is the IP and port address corresponding to our zookeeper, and it must be the same. Under normal circumstances do not need to change, because the initial is the local IP address.

  dubbo.admin. root .password=root and dubbo.admin.guest .password=guest  are two users, root and guest respectively. The default password is the same as the user name, and the password here can be modified.

  Now everything is configured, first of all, be sure to start zookeeper first and then start tomcat! Be sure to start zookeeper first and then start tomcat! Be sure to start zookeeper first and then start tomcat!

  start zookeeper

  start tomcat

  Visit http: //ip address: port number/dubbo-admin-2.5.4 / Make sure that the name must be the same as the project name under your webapp. If everything is normal, the login interface will pop up, as shown in the figure below.

 

  We enter the default user name and password root to log in to the main interface as shown below:

 

       We click System Management -> System Status to view the corresponding status, as follows:

 

  At this point, the entire deployment is complete, and we can start our application.

 

  Reference article:

  ZooKeeper official website is: http://zookeeper.apache.org/

  Dubbo official website is: http://dubbo.io/

  Zookeeper Online API Quick Check: http://zookeeper.apache.org/doc/r3.4.6/api/index.html

  Zookeeper learning: http://www.cnblogs.com/sunddenly/category/620563.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326073464&siteId=291194637