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"

相关推荐
CookieCrusher2 小时前
数据泄露危机逼近:五款电脑加密软件为企业筑起安全防线
运维·数据库·windows·安全·文件加密·数据防泄漏·dlp
这周也會开心3 小时前
SQL-窗口函数
数据库·sql
向qian看_-_4 小时前
Linux 使用pip报错(error: externally-managed-environment )解决方案
linux·python·pip
TDengine (老段)5 小时前
TDengine 时间函数 WEEKDAY() 用户手册
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
TDengine (老段)5 小时前
从 ETL 到 Agentic AI:工业数据管理变革与 TDengine IDMP 的治理之道
数据库·数据仓库·人工智能·物联网·时序数据库·etl·tdengine
yaoxtao5 小时前
java.nio.file.InvalidPathException异常
java·linux·ubuntu
LQ深蹲不写BUG7 小时前
MySql的事务机制
数据库·mysql
2501_920047038 小时前
git在Linux中的使用
linux·git·elasticsearch
程序设计实验室8 小时前
在鸡哥14x上安装Linux:Fedora 42 上手体验
linux