tree: 6fc0114bcdbd6fc68fec881d586daf47f5c5b029 [path history] [tgz]
  1. build/
  2. env/
  3. example/
  4. changlog
  5. README.md
  6. README_ZH.md
nacos-docker/README.md

Nacos Docker

Docker Pulls

This project contains a Docker image meant to facilitate the deployment of Nacos.

中文

Project directory

  • build:Nacos makes the source code of the docker image
  • env: Environment variable file for compose yaml
  • example: Docker compose example for Nacos server

Precautions

  • The database master-slave image has been removed, after the latest nacos/nacos-server:latest image. For specific reasons, refer to Removing the Master-Slave Image Configuration
  • Since Nacos 1.3.1 version, the database storage has been upgraded to 8.0, and it is backward compatible

Quick Start

Run the following command:

  • Clone project

    git clone --depth 1 https://github.com/nacos-group/nacos-docker.git
    cd nacos-docker
    
  • Standalone Derby

    docker-compose -f example/standalone-derby.yaml up
    
  • Standalone Mysql

    docker-compose -f example/standalone-mysql.yaml up
    
  • Cluster

    docker-compose -f example/cluster-hostname.yaml up 
    
  • Service registration

    curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
    
  • Service discovery

    curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instances?serviceName=nacos.naming.serviceName'
    
  • Publish config

    curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
    
  • Get config

      curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"
    
  • Open the Nacos console in your browser

    link:http://127.0.0.1:8848/nacos/

Common property configuration

namedescriptionoption
MODEcluster/standalonecluster/standalone default cluster
NACOS_SERVERSnacos cluster addresseg. ip1:port1 ip2:port2 ip3:port3
PREFER_HOST_MODEWhether hostname are supportedhostname/ip default ip
NACOS_APPLICATION_PORTnacos server portdefault 8848
NACOS_SERVER_IPcustom nacos server ip when network was mutil-network
SPRING_DATASOURCE_PLATFORMstandalone support mysqlmysql / empty default empty
MYSQL_SERVICE_HOSTmysql host
MYSQL_SERVICE_PORTmysql database portdefault : 3306
MYSQL_SERVICE_DB_NAMEmysql database name
MYSQL_SERVICE_USERusername of database
MYSQL_SERVICE_PASSWORDpassword of database
MYSQL_SSL_ENABLEuse ssldefault : false
MYSQL_MASTER_SERVICE_HOSTThe latest version of the image removes this attribute, using MYSQL_SERVICE_HOST
MYSQL_MASTER_SERVICE_PORTThe latest version of the image removes this attribute, using MYSQL_SERVICE_PORTdefault : 3306
MYSQL_MASTER_SERVICE_DB_NAMEThe latest version of the image removes this attribute, using MYSQL_SERVICE_DB_NAME
MYSQL_MASTER_SERVICE_USERThe latest version of the image removes this attribute, using MYSQL_SERVICE_USER
MYSQL_MASTER_SERVICE_PASSWORDThe latest version of the image removes this attribute, using MYSQL_SERVICE_PASSWORD
MYSQL_SLAVE_SERVICE_HOSTThe latest version of the image removes this attribute
MYSQL_SLAVE_SERVICE_PORTThe latest version of the image removes this attributedefault :3306
MYSQL_DATABASE_NUMIt indicates the number of databasedefault :1
JVM_XMS-Xmsdefault :2g
JVM_XMX-Xmxdefault :2g
JVM_XMN-Xmndefault :1g
JVM_MS-XX:MetaspaceSizedefault :128m
JVM_MMS-XX:MaxMetaspaceSizedefault :320m
NACOS_DEBUGenable remote debugy/n default :n
TOMCAT_ACCESSLOG_ENABLEDserver.tomcat.accesslog.enableddefault :false
NACOS_AUTH_SYSTEM_TYPEThe auth system to use, currently only ‘nacos’ is supporteddefault :nacos
NACOS_AUTH_ENABLEIf turn on auth systemdefault :false
NACOS_AUTH_TOKEN_EXPIRE_SECONDSThe token expiration in secondsdefault :18000
NACOS_AUTH_TOKENThe default tokendefault :SecretKey012345678901234567890123456789012345678901234567890123456789
NACOS_AUTH_CACHE_ENABLETurn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.default : false
MEMBER_LISTSet the cluster list with a configuration file or command-line argumenteg:192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809
EMBEDDED_STORAGEUse embedded storage in cluster mode without mysqlembedded default : none

Nacos + Grafana + Prometheus

Usage reference:Nacos monitor-guide

Note: When Grafana creates a new data source, the data source address must be http://prometheus:9090