consulmanage部署

一、部署consul

使用yum方式部署consul

yum install -y yum-utils

yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo

yum -y install consul

执行以下命令获取uuid密钥并记录下来

uuidgen

编辑consul配置文件

vi /etc/consul.d/consul.hcl

bash 复制代码
data_dir = "/opt/consul"
log_level = "error"

client_addr = "0.0.0.0"

ui_config{
  enabled = true
}

ports = {
  grpc = -1
  https = -1
  dns = -1
  grpc_tls = -1
  serf_wan = -1
}

peering {
  enabled = false
}

connect {
  enabled = false
}

server = true

advertise_addr = "10.1.60.118"    #指定consul得主机地址

bootstrap_expect=1

acl = {
  enabled = true
  default_policy = "deny"
  enable_token_persistence = true
  tokens {
    initial_management = "5f0efcc4-860a-4d7e-a397-3b06998f3aa7"  #配置为以上步骤获取的uuid
    agent = "5f0efcc4-860a-4d7e-a397-3b06998f3aa7"   #配置为以上步骤获取的uuid
  }
}

启动consul服务

mkdir /opt/consul

chown -R consul:consul /opt/consul

sed -i 's/Type=notify/Type=exec/g' /usr/lib/systemd/system/consul.service

systemctl daemon-reload

systemctl enable consul

systemctl restart consul

关于consul的部署也可以参考:https://github.com/starsliao/TenSunS/blob/main/docs/Consul%E9%83%A8%E7%BD%B2%E8%AF%B4%E6%98%8E.md

二、部署consulmanage

部署需要用到docker和docker-compose,需要提前安装

部署docker参考:部署docker-ce_docker-ce 配置_Apex Predator的博客-CSDN博客

部署docker-compose参考: docker-compose部署_Apex Predator的博客-CSDN博客

从github上的tensuns项目下载consulmanage部署脚本

地址:https://github.com/starsliao/TenSunS/blob/main/install/docker-compose/tensuns_install_only.sh

脚本如下

执行脚本

sh consulmanagement_install.sh

根据脚本的提示编辑yaml文件

vi /opt/tensuns/docker-compose.yaml

bash 复制代码
version: '3.6'
services:
  flask-consul:
    image: swr.cn-south-1.myhuaweicloud.com/starsl.cn/flask-consul:latest
    container_name: flask-consul
    hostname: flask-consul
    restart: always
    volumes:
      - /usr/share/zoneinfo/PRC:/etc/localtime
    environment:
      consul_token: 5f0efcc4-860a-4d7e-a397-3b06998f3aa7   #填写之前生成的uuid
      consul_url: http://10.1.60.118:8500/v1               #编辑为consulmanage本机的地址路径
      admin_passwd: 11111111                           #设置consulmanage平台登录的admin密码
      log_level: INFO
    networks:
      - TenSunS

  nginx-consul:
    image: swr.cn-south-1.myhuaweicloud.com/starsl.cn/nginx-consul:latest
    container_name: nginx-consul
    hostname: nginx-consul
    restart: always
    ports:
      - "1026:1026"
    volumes:
      - /usr/share/zoneinfo/PRC:/etc/localtime
    depends_on:
      - flask-consul
    networks:
      - TenSunS

networks:
  TenSunS:
    name: TenSunS
    driver: bridge
    ipam:
      driver: default

启动consulmanage服务

cd /opt/tensuns && docker-compose up -d

访问consulmanage web

http://10.1.60.118:1026

至此consulmanage部署完成

相关推荐
blasit10 分钟前
keil 5 MDK 安装失败提示Cannot create destination file."文件名、目录名或卷标语法不正确"
运维·程序员·如何当个好爸爸
fanxiaohui1213832 分钟前
元脑服务器的创新应用:浪潮信息引领AI计算新时代
运维·服务器·人工智能
亦世凡华、1 小时前
快速部署:在虚拟机上安装 CentOS 7 的详细步骤
linux·运维·经验分享·centos·安装教程
星图辛某人2 小时前
《Linux命令行和shell脚本编程大全》第四章阅读笔记
linux·运维·笔记
梦游钓鱼4 小时前
在window终端创建docker容器的问题
运维·docker·容器
孤寂大仙v4 小时前
【Linux笔记】理解文件系统(上)
linux·运维·笔记
沉默的八哥4 小时前
K8S高可用Web应用部署方案
运维
winyh55 小时前
Vite 打包后Nginx部署配置
运维·nginx
运维小贺6 小时前
Nginx常用的模块
运维·nginx·正则表达式