In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "the method of Dubbo+zookeeper with distributed services", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "the method of Dubbo+zookeeper with distributed services" can help you solve your doubts.
Distributed architecture:
1. When there are more and more vertical applications, the interaction between applications is inevitable, the core business will be extracted, as an independent service, gradually form a stable service center, the front-end application can respond to the changing market demand more quickly.
two。 At this point, the distributed service framework (RPC) for improving business reuse and integration is the key.
What is Dubbo?
A distributed service framework
A High performance and transparent RPC remote Service invocation Scheme
SOA service governance scheme
Dubbo:
As the framework after the comparison of the distributed architecture, it is also a relatively easy framework to start with, so it is suitable to be used as a distributed framework. Here is a simple construction process.
Tool: idea+tomact+zookeeper (knowledge points: jsp,spring,springmvc,maven)
Thoughts:
Dependency: org.springframework spring-context 5.2.5.RELEASE org.springframework spring-webmvc 5.2.5.RELEASE com.alibaba dubbo 2.6.2 Org.apache.curator curator-framework 4.1.0 com.atchengdu 001-interface 1.0-SNAPSHOT
Project distribution:
Provider implements interface to provide services, and constomer consumes services provided by provider
Interface:
Package com.atchengdu.serviceinterface; import com.atchengdu.pojo.User;public interface Userservice {/ / get the information of user User getuserByid (Integer ie);} package com.atchengdu.pojo;import java.io.Serializable;public class User implements Serializable {private Integer id; private String name; public User (Integer id, String name) {this.id = id; this.name = name;} public User () {public Integer getId () {return id Public void setId (Integer id) {public String getName () {return name; public void setName (String name) {@ Override public String toString () {return "User {" + "id=" + id + ", name='" + name +'\'+'}'
Provider:
Package com.atchengdu.Modulserviceimpl; import com.atchengdu.pojo.User;import com.atchengdu.serviceinterface.Userservice;public class Userserviceimpl implements Userservice {@ Override public User getuserByid (Integer ie) {User user=new User (1, "Zhang San"); return user;}}
Constomer:
Package com.atchengdu.webcontroller; import com.atchengdu.pojo.User;import com.atchengdu.serviceinterface.Userservice;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestMapping; @ Controllerpublic class Usercontroller {@ Autowired private Userservice userservice; @ RequestMapping ("/ user") public String user (Model model,Integer id) {User user = userservice.getuserByid (id) Model.addAttribute ("user", user); return "user" }} after reading this, the article "how to match Dubbo+zookeeper with distributed Services" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to learn more about related articles, please follow the industry information channel.
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.