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"

相关推荐
达梦数据4 小时前
达梦数据复制软件DMDRS搭建部署示例:源数据库DM8到目标数据库DM8一对一数据同步
数据库
IT_Octopus4 小时前
从一个应用开发者的角度,搞懂大数据查询的完整链路
java·大数据·数据库
Htr_4 小时前
Creem 2.0 使用指南:面向 AI 构建时代的资金平台
android·数据库·人工智能·ui·photoshop
Huangjin007_4 小时前
【Linux 系统篇(二十一)】进程(九):进程等待 wait/waitpid、status状态参数
linux·运维·服务器
我是大猴子4 小时前
reids的数据结构的应用场景
数据库
螺蛳粉 螺蛳粉5 小时前
mysql的备份与恢复
linux·运维·数据库·mysql
ao-weilai5 小时前
Linux网络编程:Socket UDP
linux·服务器·网络·c++
爱吃香菜的初学者5 小时前
九.Linux——文件操作
linux
园长的牧歌5 小时前
Ubuntu 打开应用在导航栏没有图标是个齿轮
linux·ubuntu
艾醒(AiXing-w)5 小时前
LangChain 1.0 智能体开发(三):Agent 记忆管理——从短期对话到跨会话长期记忆
数据库·人工智能·langchain