In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to integrate Dubbo zookeeper in SpringBoot". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
docker pull zookeeper
docker run --name zk01 -p 2181:2181 --restart always -d 2e30cac00aca
Zookeeper has been successfully launched.
Zookeeper Zookeeper is a distributed, open-source distributed application coordination service. It is a software that provides consistency services for distributed applications, including configuration maintenance, domain name services, distributed synchronization, group services, etc.
DubboDubbo is Alibaba's open source distributed service framework, which is characterized by a layered approach to architecture, which allows decoupling (or maximum loose coupling) between layers.
From the service model point of view, Dubbo adopts a very simple model, either the provider provides the service or the consumer consumes the service, so based on this, two roles of service provider and service consumer can be abstracted.
Client configuration:
startup class
@SpringBootApplicationpublic class ConsumerManagerApplication { public static void main(String[] args) { SpringApplication.run(ConsumerManagerApplication.class, args); }}
controller
@RestControllerpublic class ManagerController { @Reference ManagerService managerService; @RequestMapping("/hello") public String hello() { return managerService.hello(); }}
service(only need to be consistent with the interface of the service class, and the package name should also be consistent)
public interface ManagerService { public String hello();}
application.properties
dubbo.application.name=consumer-managerdubbo.registry.address=zookeeper://192.168.0.106:2181server.port=8081
Server configuration:
startup class
@SpringBootApplicationpublic class ProviderManagerApplication { public static void main(String[] args) { SpringApplication.run(ProviderManagerApplication.class, args); }}
service interface and implementation class
public interface ManagerService { public String hello();}@Servicepublic class ManagerServiceImpl implements ManagerService { @Override public String hello() { System.out.println("Client request incoming! "); return "xixi success !!! "; }}
application.properties
dubbo.application.name=provider-managerdubbo.registry.address=zookeeper://192.168.0.106:2181dubbo.scan.base-packages=com.hourui
Browser access:
"How to integrate Dubbo zookeeper in SpringBoot" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.