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"

相关推荐
小白不想画工图几秒前
银河麒麟V10系统安装QT5.12
linux·开发语言·qt·银河麒麟
ClouGence12 分钟前
CloudDM 支持达梦、KingbaseES、GoldenDB,国产数据库也能统一管起来
数据库·sql·开源
IT爱学堂17 分钟前
新版Linux零基础入门到高手Rocky版本-替换CentOS(完结)
linux·运维·centos
kkkkkkkkkk_Z27 分钟前
学嵌入式和Linux应用编程|学习日记:计算机网络基础
linux·学习·计算机网络
举个栗子。37 分钟前
DBX:20MB 驾驭 90+ 种数据库的极简开源数据库管理器
数据库·开源
逃逸线LOF39 分钟前
SpringMVC拦截器 & 异常处理机制
数据库·mysql
ang7841 小时前
日常高频使用的 Ansible 命令,按使用频率和场景整理。
linux·运维·服务器
科技小登1 小时前
重大活动安全保障方案怎么选?重保服务、攻防演练、应急响应与安全意识培训实战与边界
数据库·人工智能·安全
番茄你个西红41 小时前
金仓KFS同步工具常见问题解决方法
数据库
CarIise1 小时前
JDBC数据库操作与SQL注入防范
数据库·sql