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

Detailed explanation of Nginx access restriction configuration

What is Nginx access restriction configuration Ng...

How to quickly modify the root password under CentOS8

Start the centos8 virtual machine and press the u...

Detailed explanation of location and rewrite usage in nginx

1. Summary of location usage Location can locate ...

How to redirect to other pages in html page within two seconds

Copy code The code is as follows: <!DOCTYPE ht...

After docker run, the status is always Exited

add -it docker run -it -name test -d nginx:latest...

A simple method to regularly delete expired data records in MySQL

1. After connecting and logging in to MySQL, firs...

Some methods to optimize query speed when MySQL processes massive data

In the actual projects I participated in, I found...

CentOS 6 Compile and install ZLMediaKit analysis

Install ZLMediaKit on centos6 The author of ZLMed...

A graphic tutorial on how to install MySQL in Windows

Abstract: This article mainly explains how to ins...

Summary of MySql storage engine and index related knowledge

Storage Engine What is a database storage engine?...

An example of the calculation function calc in CSS in website layout

calc is a function in CSS that is used to calcula...

A detailed discussion on detail analysis in web design

In design work, I often hear designers participati...

A brief discussion on MySQL index optimization analysis

Why are the SQL queries you write slow? Why do th...

centos7.2 offline installation mysql5.7.18.tar.gz

Because of network isolation, MySQL cannot be ins...