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"

相关推荐
ayaya_mana1 分钟前
在 CentOS 7/RHEL 7 上安装并切换至新版内核
linux·运维·centos
三不原则18 分钟前
故障案例:数据库慢查询导致交易延迟,AIOps 如何自动定位?
运维·数据库
gzxx2007sddx22 分钟前
ubuntu挂载访问windows的共享文件夹
linux·运维·ubuntu·挂载·共享
Elieal22 分钟前
MybatisPlus难懂点
数据库·mybatis
一只专注api接口开发的技术猿29 分钟前
微服务架构下集成淘宝商品 API 的实践与思考
java·大数据·开发语言·数据库·微服务·架构
AC赳赳老秦35 分钟前
Dify工作流+DeepSeek:运维自动化闭环(数据采集→报告生成)
android·大数据·运维·数据库·人工智能·golang·deepseek
明洞日记37 分钟前
【软考每日一练009】计算机系统性能评价:基准程序分类与 TPC 实战案例详解
大数据·数据库
真的想上岸啊1 小时前
4、修改开发板内核启动日志级别
linux
Hoxy.R1 小时前
海量数据库安装部署初体验
服务器·网络·数据库
RisunJan1 小时前
Linux命令-kill(向进程发送信号的核心命令)
linux·运维·服务器