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"

相关推荐
被遗忘的旋律.6 分钟前
Linux驱动开发笔记(二十三)—— regmap
linux·驱动开发·笔记
RisunJan9 分钟前
Linux命令-iotop命令(实时磁盘 I/O 监控工具)
linux·运维·服务器
闲人编程11 分钟前
商品管理与库存系统
服务器·网络·数据库·python·api·数据模型·codecapsule
h***381818 分钟前
maven导入spring框架
数据库·spring·maven
樱花味的小奶牛26 分钟前
DECLARE CURSOR 才允许使用 FOR UPDATE 子句
数据库·sql
XMYX-026 分钟前
CentOS 7 搭建 PostgreSQL 14 实战指南
linux·postgresql·centos
雁凡彡28 分钟前
mybatis-plus中sqlserver 查询数组中指定位置前的数据
数据库·sqlserver·mybatis
大连好光景29 分钟前
《Docker容器提权&逃逸总结》
linux·运维·服务器
你想考研啊30 分钟前
win安装WSL和win使用shell
linux
丁丁丁梦涛38 分钟前
TencentOS Server 4.4(兼容centos 9 stream)部署KKFileView
linux·运维·centos·kkfileview