Analysis of the Docker deployment Consul configuration process

Analysis of the Docker deployment Consul configuration process

Execute Command

docker run -d --name consul -p 8500:8500 consul

Port Description

https://www.consul.io/docs/install/ports.html

Mounting Instructions

/consul/data: persistent data storage
/consul/config: Configuration files

Consul Configuration

https://www.consul.io/docs/agent/options.html

Note: Open the browser at http://public network ip:8500

Cluster deployment

Start 4 Consul Agents, 3 Servers (a leader will be elected), and 1 Client

#Start the first Server node. The cluster requires 3 Servers. Map the container port 8500 to the host port 8900 and open the management interface.
docker run -d --name=consul1 -p 8900:8500 -e CONSUL_BIND_INTERFACE=eth0 consul agent --server=true --bootstrap-expect=3 --client=0.0.0.0 -ui

#Start the second Server node and join the cluster
docker run -d --name=consul2 -e CONSUL_BIND_INTERFACE=eth0 consul agent --server=true --client=0.0.0.0 --join 172.17.0.2

#Start the third Server node and join the cluster
docker run -d --name=consul3 -e CONSUL_BIND_INTERFACE=eth0 consul agent --server=true --client=0.0.0.0 --join 172.17.0.2

#Start the fourth Client node and join the cluster
docker run -d --name=consul4 -e CONSUL_BIND_INTERFACE=eth0 consul agent --server=false --client=0.0.0.0 --join 172.17.0.2

The IP address of the first container started is usually 172.17.0.2, and the IP addresses of the containers started later will be: 172.17.0.3, 172.17.0.4, and 172.17.0.5.

These Consul nodes are interoperable in Docker containers, and they communicate through bridge mode. However, if the host wants to access the network inside the container, port mapping is required. When starting the first container, map Consul's port 8500 to the host's port 8900 so that you can easily view cluster information through the host's browser.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Analysis of the implementation process of Docker intranet penetration frp deployment
  • Analysis of the process of deploying nGrinder performance testing platform with Docker
  • How to deploy MySQL and Redis services using Docker
  • How to install tomcat in docker and deploy the Springboot project war package
  • Steps to deploy multiple tomcat services using DockerFile on Docker container
  • Docker image creation, uploading, pulling and deployment operations (using Alibaba Cloud)
  • Detailed deployment of docker+gitlab+gitlab-runner
  • How to deploy stand-alone Pulsar and clustered Redis using Docker (development artifact)

<<:  Thoroughly understand JavaScript prototype and prototype chain

>>:  How MySQL handles implicit default values

Recommend

MySQL independent index and joint index selection

There is often a lack of understanding of multi-c...

Linux CentOS MySQL database installation and configuration tutorial

Notes on installing MySQL database, share with ev...

Application of Hadoop counters and data cleaning

Data cleaning (ETL) Before running the core busin...

How to change the Ali source in Ubuntu 20.04

Note that this article does not simply teach you ...

Install zip and unzip command functions under Linux and CentOS (server)

Install zip decompression function under Linux Th...

Mini Program to Implement Calculator Function

This article example shares the specific code of ...

Docker Stack deployment method steps for web cluster

Docker is becoming more and more mature and its f...

Specific use of stacking context in CSS

Preface Under the influence of some CSS interacti...

Sample code for implementing form validation with pure CSS

In our daily business, form validation is a very ...

Analysis of the solution to Nginx Session sharing problem

This article mainly introduces the solution to th...

Several commonly used single-page application website sharing

CSS3Please Take a look at this website yourself, ...