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"

相关推荐
带娃的IT创业者17 分钟前
突破内存瓶颈:利用 Nvidia GPU 显存作为 Linux Swap 空间的深度实践
linux·运维·服务器·nvidia·swap·gpu显存
zy happy37 分钟前
VMware虚拟机添加新的硬盘
java·linux·jvm·docker
LCG元37 分钟前
嵌入式开发踩坑排查实战:从 STM32 外设初始化到 Linux SPI 驱动的 15 类硬件疑难故障深度复盘
linux·stm32·单片机
代码AC不AC1 小时前
【Linux】Socket编程TCP
linux·tcp·socket编程
扛枪的书生1 小时前
SeaweedFS 学习总结
linux
Tencent_TCB1 小时前
腾讯云 CloudBase 登上 WAIC:我们为 Agent 重新设计了云的生产线
网络·数据库·腾讯云
minglie11 小时前
香橙派zero3配个iic屏显示ip
linux·学习
数智化管理手记1 小时前
预算控制手工核对效率低?预算控制数字化落地实操如何做?
大数据·网络·数据库·人工智能·数据挖掘
MXsoft6181 小时前
成熟的自动化运维平台是什么样的?
运维·数据库·自动化