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"

相关推荐
郝亚军28 分钟前
ubuntu-18.04.6-desktop-amd64安装步骤
linux·运维·ubuntu
Wiktok41 分钟前
MySQL的常用数据类型
数据库·mysql
Konwledging1 小时前
kernel-devel_kernel-headers_libmodules
linux
Web极客码1 小时前
CentOS 7.x如何快速升级到CentOS 7.9
linux·运维·centos
曹牧1 小时前
Oracle 表闪回(Flashback Table)
数据库·oracle
J_liaty1 小时前
Redis 超详细入门教程:从零基础到实战精通
数据库·redis·缓存
一位赵1 小时前
小练2 选择题
linux·运维·windows
m0_706653231 小时前
用Python批量处理Excel和CSV文件
jvm·数据库·python
山岚的运维笔记1 小时前
SQL Server笔记 -- 第15章:INSERT INTO
java·数据库·笔记·sql·microsoft·sqlserver
代码游侠2 小时前
学习笔记——Linux字符设备驱动开发
linux·arm开发·驱动开发·单片机·嵌入式硬件·学习·算法