栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Docker-compose nacos搭建——筑梦之路

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Docker-compose nacos搭建——筑梦之路

gitee上国内地址:
                 git clone https://gitee.com/hub-mirrors/nacos-docker.git

目录nacos-docker/example下有多种模式示例,比如单机,集群,使用mysql5.7 使用mysql8.0等

这里以单机示例:

cat standalone-mysql-5.7.yaml
version: "2"
services:
  nacos:
    image: nacos/nacos-server:2.0.3
    container_name: nacos-standalone-mysql
    environment:
      - NACOS_AUTH_ENABLE=true  #开启授权 增强安全性  此处非常关键 网上普遍没有开启
    env_file:
      - ../env/nacos-standlone-mysql.env
    volumes:
      - ./standalone-logs/:/home/nacos/logs
      - ./init.d/custom.properties:/home/nacos/init.d/custom.properties
    ports:
      - "8848:8848"
      - "9848:9848"
      - "9555:9555"
    depends_on:
      - mysql
    restart: on-failure
  mysql:
    container_name: mysql
    image: nacos/nacos-mysql:5.7
    env_file:
      - ../env/mysql.env
    volumes:
      - ./mysql:/var/lib/mysql
    ports:
      - "3306:3306"
    prometheus:
     container_name: prometheus
     image: prom/prometheus:latest
     volumes:
       - ./prometheus/prometheus-standalone.yaml:/etc/prometheus/prometheus.yml
     ports:
       - "9090:9090"
     depends_on:
       - nacos
     restart: on-failure
   grafana:
     container_name: grafana
     image: grafana/grafana:latest
     ports:
       - 3000:3000
     restart: on-failure


#env文件
cat mysql.env 
MYSQL_ROOT_PASSWORD=root
MYSQL_DATAbase=nacos_devtest
MYSQL_USER=nacos

cat nacos-standlone-mysql.env 
PREFER_HOST_MODE=hostname
MODE=standalone
SPRING_DATASOURCE_PLATFORM=mysql
MYSQL_SERVICE_HOST=mysql
MYSQL_SERVICE_DB_NAME=nacos_devtest
MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false

这是官方的模板 可根据自己需求修改里面的配置参数

docker-compose -f standalone-mysql-5.7.yaml up -d

访问:http://ip:8848/nacos  nacos nacos

监控访问:http://ip:9090    http://ip:3000  模板id  13221  模板json文件见我的资源

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/395567.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号