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"

相关推荐
ejjdhdjdjdjdjjsl1 天前
JSON序列化与反序列化实战指南
数据库·microsoft·c#
CC.GG1 天前
【C++】STL容器----unordered_map和unordered_set的使用
java·数据库·c++
编程小Y1 天前
如何优化MySQL的查询性能?
数据库·mysql
用户47949283569151 天前
性能提升 40 倍!实战 PostgreSQL FDW 解决微服务跨库查询难题
数据库·后端
计算机毕设VX:Fegn08951 天前
计算机毕业设计|基于springboot + vue宠物医院管理系统(源码+数据库+文档)
数据库·vue.js·spring boot·后端·课程设计
haimin03711 天前
linux设置CPU固定频率
linux·运维·服务器
大聪明-PLUS1 天前
Linux:处理器释放内存
linux·嵌入式·arm·smarc
kimi-2221 天前
LangChain 将数据加载到 Chroma 向量数据库
数据库·langchain
渣渣盟1 天前
NFS服务器配置全攻略:从入门到精通
linux·运维·服务器
一只旭宝1 天前
Linux专题九:I/O复用(水平以及边缘触发放到libevent库那一专题细讲)
linux·运维·服务器