Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Consul of Consul practice?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

The previous article, "plans and issues related to Consul practices", started with the issues related to Consul. This article first answers the question of what Consul is. It is inevitable that there are some knowledge about Consul and other knowledge that need to be known in advance, and there may be some words or expressions that are difficult to understand.

A. what is Consul?

Consul is an open source project launched by the hashicorp organization two years ago, so it has a history of more than two years. Developed by the Go language, Consul is very easy to deploy, requires very few executable programs and configuration files, and is green and lightweight. Consul has a set of components, so it can provide a variety of functions. At present, the main function is service discovery, and other additional functions, such as automatic orchestration, key-value database, etc., are temporarily classified as added value.

There are conceptual similarities between Service Discovery (service discovery) and simple Service Discovery Protocol (SDP), but there is no good explanation at present. According to personal understanding, service discovery is to inform the party who needs to know the service information (the service contains a lot of service information, such as IP address, port number, path name, etc., which is usually stored in a specific format (data exchange format) actively or passively. As for who is our own side and who is the other side, it is decided according to the actual situation. In Consul's service discovery definition, application services (such as Web services, database services, Redis services, etc.) act as providers (specifically implemented by Consul Agent, which will be mentioned later) in the process of registering with Consul services, Consul is the recipient, and service information is provided to Consul Server by Consul Agent. In addition to the process of registering with the Consul service, Consul Server may proactively challenge Consul Agent.

Let's start with a virtual example.

For example, the postman goes to a building of a company to deliver express mail and asks the doorman which room employee An is in. The doorman picks up the address book on the table and tells the postman where employee An is. If an employee B comes to the company, if he wants the postman to deliver it, he must first let the doorman know which room he is in, and he needs to register with the doorman. After employee B registers, when the postman asks the doorman, the doorman can tell the postman the specific location of employee B. The process that the doorman knows the specific location of employee B is service discovery. The location information of employee B can be regarded as service information. The address book of the doorman is the data exchange format mentioned above. In this case, employee B is the party mentioned above. The doorman is the provider of service discovery.

Give me another practical example.

When an end user submits user information to a website A, the website must first obtain other information about the user on site B from other sites, while there are multiple service modules on other sites B. that is to say, the back end of site B also has other service modules b1, b2, b3, and bn... that provide services. So how does website B integrate information from these other service modules, b1~bn, that provide services? At this time in the site B can be achieved with the help of Consul. The service module on website B tells Consul its own service information, and Consul detects the health status of the service module. When the service module is not available, the service module is removed from the Consul. When the website B needs to provide services from these service modules, it obtains the information of the service module from the Consul, or the Consul actively tells the website B which service modules are available and what the information of these available service modules is.

With the help of Consul, the served person can get the available services and applications provided by the service provider from Consul. These services and applications can be added or removed at any time, and it is very easy to achieve a highly available, scalable and flexible application service architecture with the help of load balancing equipment or software.

B. what problem did Consul solve?

Consul solves the problem of dynamically providing service information and dynamically changing service configuration. Like Dubbo, Consul can solve some problems that Dubbo can solve, such as "automatic service registration and discovery, no longer need to write down the address of the service provider, the registry queries the IP address of the service provider based on the interface name, and can smoothly add or delete service providers."

Consul can also solve other problems, such as "what scenarios can Consul be applied to?"

C. what scenarios can Consul be applied to?

On the basis of the existing applications, after some simple modifications, Consul can easily build a highly available and scalable service system or improve the availability and scalability of the system.

Configuration sharing can be achieved with the help of Consul, and services that need to read configurations can read accurate configuration information from Consul.

With the help of Consul, third-party applications can integrate their own applications more easily, and third parties can provide clearer service interface declarations and guarantee available service information.

Consul can integrate a variety of environments, can integrate a variety of environments in complex systems, developers or users do not need to care about the complexity of the system and the complex relationship between a variety of components, through Consul can directly query which services they can use. For example, some databases can be used in the system, and which redis can be used.

Consul can help system managers understand the internal system architecture of complex systems more clearly. Operators can regard Consul as a kind of monitoring software or an asset (resource) management system.

Environmental requirements for Consul deployment. Consul can be deployed in physical machine environment, operating system virtualization environment, Docker (application virtualization) environment, or mixed environment of physical machine, virtual machine and Docker.

Consul supports multiple data centers. Multiple data centers require each data center to install a set of Consul Cluster. One Server,Server in each Consul Cluster is connected to the server of another data center. According to the description of the Consul architecture (click here, CONSUL ARCHITECTURE), the Consul implementation of multiple data centers depends on the gossip protocol protocol and does not need to rely on components other than Consul.

Consul is easy to use and can be used by people with multiple roles. Consul can be used by system operation and maintenance personnel, software developers and other related technicians.

D. more information on Consul

You can refer to the information provided on Consul's official website and other websites. Some available reference resources listed in this article are as follows:

Consul official website https://www.consul.io/

Consul Github address https://github.com/hashicorp/consul

Consul-template Github address https://github.com/hashicorp/consul-template

Consul officially introduced https://www.consul.io/intro/index.html.

Consul system Architecture https://www.consul.io/docs/internals/architecture.html

Comparison of Consul with other open source software or solutions https://www.consul.io/intro/vs/

Dubbo user Guide http://dubbo.io/Home-zh.htm can learn what Dubbo is and what it can do through this guide

Plug and play Service Discovery (service discovery) http://www.ibm.com/developerworks/cn/cloud/library/cl-plug-and-play-service-discovery-with-consul-and-docker-bluemix/ with Consul and Docker

Automating modern data center http://www.infoq.com/cn/news/2015/05/hashimoto-modern-datacenter with Terraform and Consul

Based on the fact that swarm+consul+nginx achieves the structure http://genchilu-blog.logdown.com/posts/317095-based-on-swarm-and-consul-ha-and-dynamically-extensible-architectures of HA and auto scaling

Using Docker, Registrator, Consul, Consul Template and Nginx to implement a highly scalable Web framework http://dockone.io/article/272

Getting started with Consul http://blog.csdn.net/viewcode/article/details/45915179

Consul multi-data center configuration https://www.consul.io/docs/guides/datacenters.html

Consul practice http://blog.sina.com.cn/s/blog_72ef7bea0102vuc5.html

Tag: what is Consul, what can Consul do, Consul application scenarios, Consul solutions, Consul system architecture

-- end--

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: 292

*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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report