ZooKeeper Registry

zookeeper registration center

zookeeper

share picture

zookeeper registration center

  zookeeper is a sub-project of Apacahe Hadoop. It is a tree-type directory service that supports change push (< span style="color: #ff0000">When the information of the service provider changes, the information can be dynamically pushed to the consumer to allow the consumer to change the local information). It is suitable as a registration center for Dubbo services. The industrial intensity is relatively high. High, can be used in a production environment, and recommended to use

How zookeeper stores data to store data

   zookeeper is a tree-type directory structure, zookeeper stores data through nodes

p>

  Share a picture

Use of zookeeper registration center

1. Download zookeeper and unzip

  http://mirrors.hust.edu.cn/apache/zookeeper/

2 .Modify the file name

  zookeeper-3.4.12/conf/zoo_sample.cfg is changed to zookeeper-3.4.12/conf/zoo.cfg (the configuration file loaded by default when zookeeper starts)

< h3>3. Modify the zoo.cfg file

  dataDir=D:/zkp/lo (the directory of data retained by zookeeper during runtime (node ​​data))

  dataLogDir=D: /zkp/lo (The directory where zookeeper stores logs when it is running)

  Set to its own path

4. Start zookeeper

  zookeeper-3.4.12/ bin/zk Server.cmd start the server

  share picture

   start Success

  zookeeper-3.4.12/bin/zkCli.cmd starts the client-side

  share picture

   successfully started

5.java client,

   zookeeper registration center uses and It was basically the same as the new dubbo simple environment before.

  Dubbo_par introduced coordinates in pom.xml


  org. apache.zookeeper
  zookeeper
  3.3.3


   com.github.sgroschupf
  zkclient
  0.1

6 .Service provider service consumer configuration registration center is zookeeper


7. Test

  Start the server to execute service registration. Check the registered node data on the zkCli interface. Start the consumer to execute consumption


  org.apache.zookeeper
  zookeeper
  3.3.3


  com.github .sgroschupf
  zkclient
  0.1

< dubbo:registry address="zookeeper://own ip:2181" >

Leave a Comment

Your email address will not be published.