linux 单机安装consul

bash 复制代码
sudo yum install -y yum-utils && sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo && sudo yum -y install consul

#添加consul配置文件
nano /etc/consul.d/server.json
{
    "server": true,
    "bootstrap": true,
    "advertise_addr": "192.168.31.168",
    "ui_config": {
        "enabled": true
    },
    "data_dir": "/data/consul",
    "log_level": "INFO",
    "addresses": {
        "http": "0.0.0.0"
    },
    "ports": {
        "http": 8500
    }
}
#启动
sudo chmod 777 /data/consul
systemctl start consul && systemctl enable consul

配置开机启动:

bash 复制代码
nano /etc/systemd/system/consul.service
#########################################
[Unit]
Description=Consul Agent
After=network.target
 
[Service]
User=consul
Group=consul
ExecStart=/usr/bin/consul agent -config-dir=/etc/consul.d
ExecReload=/usr/bin/consul reload
KillSignal=SIGINT
 
[Install]
WantedBy=multi-user.target
#########################################
systemctl daemon-reload
sudo systemctl enable consul
sudo systemctl start consul

Docker版本7天没有使用后,会出现集群错误,所以部属Linux版本开发比较好

ERROR\] agent: startup error: error="refusing to rejoin cluster because server has been offline for more than the configured server_rejoin_age_max (168h0m0s) - consider wiping your data dir"

相关推荐
lang2015092828 分钟前
MySQL 8.0原子性DDL全面解析
数据库·mysql
tongsound44 分钟前
libmodbus 使用示例
linux·c++
拾光Ծ1 小时前
【Linux】“ 权限 “ 与相关指令
linux·运维·服务器
硬核子牙1 小时前
调试器是怎么让代码停下来的
linux
To_再飞行1 小时前
Linux Bash(一)
linux·运维·服务器·bash
LCG元1 小时前
保姆级教程:CentOS 7/8 部署Nginx + MySQL + PHP(LEMP)环境,从零开始到上线项目
linux
viperrrrrrrrrr71 小时前
milvus向量数据库
数据库·大模型·llm·milvus
疯癫的老码农1 小时前
【Linux环境下安装】SpringBoot应用环境安装(五)-milvus安装
linux·spring boot·milvus
孤廖1 小时前
C++ 模板再升级:非类型参数、特化技巧(含全特化与偏特化)、分离编译破解
linux·服务器·开发语言·c++·人工智能·后端·深度学习
白衣鸽子1 小时前
MySql数据库同步技术:构建高可用架构的基石
数据库·后端