Consul is an open source tool launched by Hashicorp to implement service discovery and configuration for distributed systems. Unlike other distributed service registration and discovery scenarios, the consul scenario is more "one-stop", with built-in service registration and discovery Framework, distributed conformance protocol implementations, health checks, Key/value storage, multi-datacenter scenarios, and no need to rely on other tools (such as zookeeper, etc.). It's also easier to use. Consul is implemented with Golang and therefore has natural portability (support for Linux, Windows, and Mac OS X); the installation package contains only one executable file for easy deployment and works seamlessly with lightweight containers such as Docker.
Consul Usage Scenarios
- Registration and configuration sharing for Docker instances
- Registration and configuration sharing for CoreOS instances
- Vitess Cluster
- Configuration sharing for SaaS apps
- Integrates with CONFD services to dynamically generate Nginx and Haproxy configuration files
Advantages of Consul
- Using the Raft algorithm to ensure consistency is more straightforward than a complex Paxos algorithm. In comparison, Zookeeper uses Paxos, while ETCD uses Raft.
- Support multi-data center, internal and external network services using different ports for monitoring. A multi-data center cluster avoids single points of failure in a single data center, and its deployment requires consideration of network latency, fragmentation, and so on. Zookeeper and ETCD do not provide support for multi-datacenter functions.
- Supports health checks. ETCD does not provide this functionality.
- Supports HTTP and DNS protocol interfaces. The integration of the zookeeper is complex and the ETCD only supports the HTTP protocol.
- Official web Management interface, Etcd no such function.
Comprehensive comparison, Consul as a new star of service registration and configuration management, it is worth to pay more attention and research.
The role of Consul
Client: Clients, stateless, forwarding HTTP and DNS interface requests to the server cluster within the LAN.
Server: Service side, save configuration information, high availability cluster, communicate with local clients in LAN, communicate with other data center via WAN. The number of servers per datacenter is recommended to be 3 or 5.
. NET client https://github.com/PlayFab/consuldotnet/, specific article reference https://playfab.com/blog/2015/05/19/porting-consul-go-api-c
?
Registering discovery for services using Apache Mesos and consul
Automating modern data centers with TerraForm and consul
Implementing distributed service registration and discovery using consul
A brief introduction to distributed service registration and Discovery consul