码迷,mamicode.com
首页 > 其他好文 > 详细

nacos-server安装、运行 (docker)

时间:2019-07-23 20:06:42      阅读:3128      评论:0      收藏:0      [点我收藏+]

标签:eth   ports   tom   dock   start   name   volumes   div   orm   

https://nacos.io/en-us/docs/quick-start-docker.html
https://github.com/nacos-group/nacos-docker

 

mkdir /opt/nacos-server/init.d -p

vim /opt/nacos-server/Dockerfile

FROM nacos/nacos-server:1.1.0
EXPOSE 8848 9555

 

vim /opt/nacos-server/init.d/custom.properties

#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for prometheus
management.endpoints.web.exposure.include=*

# metrics for elastic search
#management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200

# metrics for influx
#management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true

 


vim /opt/nacos-server/docker-compose.yml

version: "2"
services:
  nacos:
    image: nacos-server-standalone
    container_name: nacos-server-standalone
    build: 
      context: .
      dockerfile: Dockerfile
    environment:
      - PREFER_HOST_MODE=hostname
      - MODE=standalone
      - SPRING_DATASOURCE_PLATFORM=mysql
      - MYSQL_MASTER_SERVICE_HOST=192.168.1.5
      - MYSQL_MASTER_SERVICE_PORT=3306
      - MYSQL_MASTER_SERVICE_DB_NAME=nacos
      - MYSQL_MASTER_SERVICE_USER=root
      - MYSQL_MASTER_SERVICE_PASSWORD=123456
      - MYSQL_SLAVE_SERVICE_HOST=192.168.1.5
      - MYSQL_SLAVE_SERVICE_PORT=3306
    volumes:
      - ./logs/:/home/nacos/logs
      - ./init.d/custom.properties:/home/nacos/init.d/custom.properties
    ports:
      - "8848:8848"
      - "9555:9555"
    restart: on-failure

 


cd /opt/nacos-server
docker-compose build
docker-compose up -d --force-recreate
docker-compose down
docker-compose restart

 

查看日志
docker logs --tail="500" nacos-server-standalone

查看进程
netstat -anltp|grep 8848

进入容器
docker exec -it nacos-server-standalone /bin/bash

 

集群配置参照:
https://nacos.io/en-us/docs/quick-start-docker.html
https://github.com/nacos-group/nacos-docker

nacos-server安装、运行 (docker)

标签:eth   ports   tom   dock   start   name   volumes   div   orm   

原文地址:https://www.cnblogs.com/wintersoft/p/11234073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!