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"

相关推荐
猫猫不是喵喵.2 小时前
从0到1创建一个微服务项目
java·数据库·微服务·1024程序员节
AR-26710-3 小时前
Linux Day33——定时任务+lvm
linux·运维
lsc_blog3 小时前
听到优化风声,先准备能由自己掌控的事
数据库·分布式·中间件·职场和发展·重构
墨痕诉清风3 小时前
SSRF漏洞实战记录+OSS桶命令执行+MCP漏洞
linux·服务器·数据库
byte轻骑兵3 小时前
实战 4:BlueZ 源码中添加自定义设备过滤规则
linux·物联网·bluez·电脑蓝牙·嵌入式蓝牙
瓦瓦gogo4 小时前
从一个 TypeScript 函数开始理解 MCP 协议
linux·ubuntu·typescript
鱼听禅6 小时前
Ubuntu安装YOLOv8进行菌落识别训练
linux·python·yolo·ubuntu
测试界的小码农6 小时前
【Linux 命令实战(04):文件内容查看,掌握 cat、less、head、tail】
linux·服务器·less
Ashe8136 小时前
MySQL 慢日志先别急着加索引:三个指标能拦掉大半误判
数据库
ClouGence6 小时前
最基础的异构数据库 DDL 同步,我们踩过哪些坑?
数据库·mysql·postgresql