consul安装启动流程

简介: consul安装启动流程

普通软件包安装

首先cd /opt ,将安装包放到该目录下

  1. 下载consul安装包
    进入consul官网找到自己开发平台对应的安装包下载 https://www.consul.io/downloads.html
    或使用命令 wget https://releases.hashicorp.com/consul/1.6.2/consul_1.6.2_linux_amd64.zip
    (如果提示-bash: wget: command not found,则yum install wget)
  2. 下载完后,解压,得到一个可执行文件consul
    unzip consul_1.6.2_linux_amd64.zip
    (如果提示-bash: unzip: command not found,则yum install unzip)
  3. 将这个文件移动到全局变量环境中
    sudo mv consul /usr/local/bin/
  4. 验证是否安装成功
    consul
    (显示配置参数列表)
  5. 启动consul
普通单机启动:consul agent -dev -ui -node=consul-dev -client=本机IP地址(使用ctrl + z会退出,仅用于初次安装后的测试)
后台单机启动:nohup consul agent -dev -ui -node=consul-dev -client=127.0.0.1 >> /home/springboot/logs/consul.log 2>&1 &
  1. 验证服务启动状态
    在浏览器中输入: http://IP地址:8500/
  2. 启动问题及注意
  1. 查杀consul服务 ps -aux|grep consul , kill -9 进程ID
  2. 关闭防火墙:systemctl stop firewalld.service
    永久关闭防火墙:systemctl disable firewalld.service
  3. 观察日志:tail -f /home/springboot/logs/consul.log
  4. consul注册服务中如果Health Checks列出现红色叉号,说明服务出现问题,但未自动注销,这时可以使用postman发送put请求类型,进行强制手动线微服务实例:
    http://ip:8500/v1/agent/service/deregister/服务实例ID
  1. 端口冲突时解决过程
==> Error starting agent: 2 errors occurred:
        * listen udp ****:8600: bind: cannot assign requested address
        * listen tcp ****:8600: bind: cannot assign requested address

consul涉及端口

当端口冲突时,在/usr/local/bin下新建data.json文件,将以下端口更换为系统不冲突的端口

{
    "ports": {

    "http": 8500 ,

    "dns": 8601,

    "grpc":8400,

    "serf_lan": 8301,

    "serf_wan": 8302,

    "server": 8300
    }
}

再使用启动命令即可

nohup consul agent -server -bootstrap-expect 1 -data-dir ./ -advertise 127.0.0.1 -client 0.0.0.0 -ui -config-dir ./ >> /opt/logs/consul.log 2>&1 &
  1. 停止Agent:
    consul leave -http-addr=127.0.0.1:8500 #正常退出
    consul force-leave -http-addr=127.0.0.1:8500
    #强制退出

docker安装(非首选)

docker pull consul

mkdir -p /data/consul

docker run -d -p 8500:8500 -v /data/consul:/consul/data -e CONSUL_BIND_INTERFACE='eth0' --name=consul1 consul agent -server -bootstrap -ui -client='0.0.0.0'
目录
相关文章
|
2月前
|
存储 Ubuntu 网络协议
|
2月前
|
运维 网络协议 Linux
2024年最全CentOS8 Consul微服务架构安装(1)_agent(1),Linux运维开发面试
2024年最全CentOS8 Consul微服务架构安装(1)_agent(1),Linux运维开发面试
|
2月前
Consul安装教程和注册
Consul安装教程和注册
32 0
|
JSON 算法 数据中心
consul介绍与安装
Consul是一个微服务管理软件。支持多数据中心下,分布式高可用的,服务发现和配置共享。采用 `Raft 算法`,用来保证服务的高可用。
151 0
consul介绍与安装
|
存储 监控 网络协议
Consul简介和安装
Consul 是一套开源的分布式服务发现和配置管理系统,由 HashiCorp 公司用 Go 语言开发。
Consul简介和安装
|
iOS开发 MacOS
macOS下载、安装和启动consul
macOS下载、安装和启动consul
275 0
macOS下载、安装和启动consul
|
数据中心 开发工具 网络协议
|
网络协议 前端开发 atlas
Consul 简介、安装、常用命令的使用
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010046908/article/details/61916389 1 Consul简介 Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置。
1839 0