linux(centos8):安装配置consul集群(consul 1.8.4 | centos 8.2.2004)
一,什么是consul?
https://www.consul.io/
说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,下载consul软件
https://www.consul.io/downloads
[root@localhost consul]# cd /usr/local/source/consul
[root@localhost consul]# ls
consul_1.8.4_linux_amd64.zip
[root@localhost consul]# unzip consul_1.8.4_linux_amd64.zip
Archive: consul_1.8.4_linux_amd64.zip
inflating: consul
[root@localhost consul]# ls
consul consul_1.8.4_linux_amd64.zip
三,在第一台consul服务器上运行:
[root@consul1 /]# mkdir /data/
[root@consul1 /]# mkdir /data/consul/
[root@consul1 /]# mkdir /data/consul/data
[root@consul1 /]# chmod 777 /data/consul/data
[root@consul1 /]# nohup /usr/local/soft/consul agent -server -bind=172.17.0.2 -client=0.0.0.0 -bootstrap-expect=2 -data-dir=/data/consul/da -node=server-2 >/dev/null 2>&1 &
[1] 549
[root@consul1 /]#
[root@consul1 /]# ss -lntp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 4096 172.17.0.2:8300 0.0.0.0:* users:(("consul",pid=549,fd=6))
LISTEN 0 4096 172.17.0.2:8301 0.0.0.0:* users:(("consul",pid=549,fd=12))
LISTEN 0 4096 172.17.0.2:8302 0.0.0.0:* users:(("consul",pid=549,fd=8))
LISTEN 0 4096 *:8500 *:* users:(("consul",pid=549,fd=16))
LISTEN 0 4096 *:8600 *:* users:(("consul",pid=549,fd=15))
可以看到consul已经在守护端口中,而且consul启用了多个端口
[root@consul1 /]# /usr/local/soft/consul --version
Consul v1.8.4
Revision 12b16df32
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
[root@consul1 /]# /usr/local/soft/consul members
Node Address Status Type Build Protocol DC Segment
server-2 172.17.0.2:8301 alive server 1.8.4 2 dc1 <all>
只有一台机器,正常
[root@consul1 /]# /usr/local/soft/consul info
agent:
check_monitors = 0
check_ttls = 0
checks = 0
services = 0
build:
prerelease =
revision = 12b16df3
version = 1.8.4
consul:
acl = disabled
bootstrap = false
known_datacenters = 1
leader = false
leader_addr =
server = true
raft:
applied_index = 0
commit_index = 0
fsm_pending = 0
last_contact = never
last_log_index = 0
last_log_term = 0
last_snapshot_index = 0
last_snapshot_term = 0
latest_configuration = []
latest_configuration_index = 0
num_peers = 0
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Follower
term = 0
runtime:
arch = amd64
cpu_count = 2
goroutines = 79
max_procs = 2
os = linux
version = go1.14.6
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 1
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 1
members = 1
query_queue = 0
query_time = 1
serf_wan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 1
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 1
members = 1
query_queue = 0
query_time = 1
四,在第二台consul服务器上运行相同的操作,
[root@consul2 /]# nohup /usr/local/soft/consul agent -server -bind=172.17.0.3 -client=0.0.0.0 -bootstrap-expect=2 -data-dir=/data/consul/da -node=server-3 >/dev/null 2>&1 &
[1] 371
[root@consul2 /]# /usr/local/soft/consul members
Node Address Status Type Build Protocol DC Segment
server-3 172.17.0.3:8301 alive server 1.8.4 2 dc1 <all>
[root@consul2 /]# /usr/local/soft/consul join 172.17.0.2
Successfully joined cluster by contacting 1 nodes.
[root@consul2 /]# /usr/local/soft/consul members
Node Address Status Type Build Protocol DC Segment
server-2 172.17.0.2:8301 alive server 1.8.4 2 dc1 <all>
server-3 172.17.0.3:8301 alive server 1.8.4 2 dc1 <all>
五,在第三台consul服务器上运行相同的操作:
[root@consul3 /]# nohup /usr/local/soft/consul agent -server -bind=172.17.0.4 -client=0.0.0.0 -bootstrap-expect=2 -data-dir=/data/consul/da -node=server-4 -ui >/dev/null 2>&1 &
[1] 229
[root@consul3 /]#
[root@consul3 /]# /usr/local/soft/consul members
Node Address Status Type Build Protocol DC Segment
server-4 172.17.0.4:8301 alive server 1.8.4 2 dc1 <all>
[root@consul3 /]# /usr/local/soft/consul join 172.17.0.2
Successfully joined cluster by contacting 1 nodes.
[root@consul3 /]# /usr/local/soft/consul members
Node Address Status Type Build Protocol DC Segment
server-2 172.17.0.2:8301 alive server 1.8.4 2 dc1 <all>
server-3 172.17.0.3:8301 alive server 1.8.4 2 dc1 <all>
server-4 172.17.0.4:8301 alive server 1.8.4 2 dc1 <all>
六,访问在第三台consul服务器上启用的web ui:
http://172.17.0.4:8500/
返回:
七,consul的退出:
[root@consul2 /]# /usr/local/soft/consul leave
Graceful leave complete
[root@consul2 /]# ss -lntp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
[root@consul3 /]# /usr/local/soft/consul members
Node Address Status Type Build Protocol DC Segment
server-2 172.17.0.2:8301 alive server 1.8.4 2 dc1 <all>
server-3 172.17.0.3:8301 left server 1.8.4 2 dc1 <all>
server-4 172.17.0.4:8301 alive server 1.8.4 2 dc1 <all>
八,查看linux的版本:
[root@localhost liuhongdi]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
linux(centos8):安装配置consul集群(consul 1.8.4 | centos 8.2.2004)的更多相关文章
- Linux中安装配置spark集群
一. Spark简介 Spark是一个通用的并行计算框架,由UCBerkeley的AMP实验室开发.Spark基于map reduce 算法模式实现的分布式计算,拥有Hadoop MapReduce所 ...
- Linux中安装配置hadoop集群
一. 简介 参考了网上许多教程,最终把hadoop在ubuntu14.04中安装配置成功.下面就把详细的安装步骤叙述一下.我所使用的环境:两台ubuntu 14.04 64位的台式机,hadoop选择 ...
- centos8安装fastdfs6.06集群方式三之:storage的安装/配置/运行
一,查看本地centos的版本 [root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) 说 ...
- centos8安装fastdfs6.06集群方式二之:tracker的安装/配置/运行
一,查看本地centos的版本 [root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) 说 ...
- centos8安装fastdfs6.06集群方式一之:软件下载与安装
一,查看本地centos的版本 [root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core) 说 ...
- 架构(三)MongoDB安装配置以及集群搭建
一 安装 1.1 下载MongoDB 我个人不太喜欢用wget url, 之前出现过wget下载的包有问题的情况 https://fastdl.mongodb.org/linux/mongodb-li ...
- 离线环境下使用二进制方式安装配置Kubernetes集群
本文环境 Redhat Linux 7.3,操作系统采用的最小安装方式. Kubernetes的版本为 V1.10. Docker版本为18.03.1-ce. etcd 版本为 V3.3.8. 1. ...
- Nginx 在 Linux 下安装与搭建集群
搭建集群图例 集群搭建图如下,为了简单一点,使用一个Nginx服务器+两个Tomcat服务器,省略数据库部分: 环境说明 Linux 为 CentOS 7.2 发行版 + Java jdk 1.8 + ...
- hadoop集群环境搭建之安装配置hadoop集群
在安装hadoop集群之前,需要先进行zookeeper的安装,请参照hadoop集群环境搭建之zookeeper集群的安装部署 1 将hadoop安装包解压到 /itcast/ (如果没有这个目录 ...
随机推荐
- 关于“枚举{0,1,...,n-1}所包含的所有大小为k的子集”的理解
前言 今天整理以前的竞赛笔记时,发现了当时写的一个模板: 枚举{0,1,-,n-1}所包含的所有大小为k的子集: int comb = (1 << k) - 1; while (comb ...
- 不光是查找值!"二分搜索"
从有序数组中查找某个值 问题描述:给定长度为n的单调不下降数列a0,…,an-1和一个数k,求满足ai≥k条件的最小的i.不存在则输出n. 限制条件:1≤n≤1060≤a0≤a1≤…≤an-1< ...
- python中反射 getattr(对象,'方法')()和hasattr(对象,'方法')
getattr(对象,'方法')():从一个对象里面找到里面的方法,,, 传了一个对象,再传一个字符串,就能找到这个字符串的方法 hasattr(对象,'方法') 判断这个对象里面有没有这个方法,返回 ...
- 理解C#中的ExecutionContext vs SynchronizationContext
原文:https://devblogs.microsoft.com/pfxteam/executioncontext-vs-synchronizationcontext/ 作者:Stephen 翻译: ...
- [补题][Codeforces478D]Red-Green Towers(DP)
题目链接 http://codeforces.com/problemset/problem/478/D 题意 叠放塔:有红.绿两种色块.从第一层开始,第一层1块,第二层2块,第i层i块. 要求每一层只 ...
- JavaScript中常用的数据输出方式解析
在js中,一般使用如下几种方式进行数据的输出: 1. 在浏览器的控制台输出 浏览器F12打开浏览器控制台(一般前端开发人员必备浏览器为谷歌浏览器,下面就以谷歌浏览器为例对控制台尽心解析): 1.1 E ...
- JS进阶 | 解决JQ keyup事件延迟的问题
写在前面 在使用keyup事件时,存在一个问题,假如想要做出类似于表单验证的demo:表单输入账号 “xxx” 后 再去ajax异步去后台数据库匹配,但是keyup事件的原理是每次键盘事件弹起就会检 ...
- 初识ABP vNext(10):ABP设置管理
Tips:本篇已加入系列文章阅读目录,可点击查看更多相关文章. 目录 前言 开始 定义设置 使用设置 最后 前言 上一篇介绍了ABP模块化开发的基本步骤,完成了一个简单的文件上传功能.通常的模块都有一 ...
- Vue iview Tree组件实现文件目录-高级实现
Tree组件实现文件目录-基础实现 封装文件目录组件 src\views\folder-tree\folder-tree.vue <template> <div class=&quo ...
- java 集合删除数据
public static void main(String[] args) { List<Integer> list = new ArrayList<>(Arrays.asL ...