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"

相关推荐
m0_561359673 分钟前
掌握Python魔法方法(Magic Methods)
jvm·数据库·python
kida_yuan4 分钟前
【Linux】运维实战笔记 — 我常用的方法与命令
linux·运维·笔记
xxxmine5 分钟前
redis学习
数据库·redis·学习
@syh.18 分钟前
【linux】进程控制
linux
qq_54702617927 分钟前
Redis 常见问题
数据库·redis·mybatis
APIshop28 分钟前
Java 实战:调用 item_search_tmall 按关键词搜索天猫商品
java·开发语言·数据库
小陈phd1 小时前
混合知识库搭建:本地Docker部署Neo4j图数据库与Milvus向量库
数据库·docker·neo4j
2401_838472511 小时前
使用Python进行图像识别:CNN卷积神经网络实战
jvm·数据库·python
知识即是力量ol1 小时前
基于 Redis 实现白名单,黑名单机制详解及应用场景
数据库·redis·缓存
zhihuaba1 小时前
使用PyTorch构建你的第一个神经网络
jvm·数据库·python