Quick Start for Nacos Docker

Steps

Run the following command:

  • Clone project

    1. git clone https://github.com/nacos-group/nacos-docker.git
    2. cd nacos-docker
  • Stand-alone Derby

    1. docker-compose -f example/standalone-derby.yaml up
  • Stand-alone MySQL

To use MySQL 5.7, run

  1. docker-compose -f example/standalone-mysql-5.7.yaml up

To use MySQL 8, run

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

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

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

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

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

    1. 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,ip2,ip3
PREFER_HOST_MODEWhether hostname are supportedhostname/ip default ip
NACOS_SERVER_PORTnacos server portdefault 8848
NACOS_SERVER_IPcustom nacos server ip when network was mutil-network
SPRING_DATASOURCE_PLATFORMstandalone support mysqlmysql / empty default empty
MYSQL_MASTER_SERVICE_HOSTmysql master host
MYSQL_MASTER_SERVICE_PORTmysql master database portdefault : 3306
MYSQL_MASTER_SERVICE_DB_NAMEmysql master database name
MYSQL_MASTER_SERVICE_USERusername of master database
MYSQL_MASTER_SERVICE_PASSWORDpassword of master database
MYSQL_SLAVE_SERVICE_HOSTmysql slave host
MYSQL_SLAVE_SERVICE_PORTmysql slave database portdefault :3306
MYSQL_DATABASE_NUMIt indicates the number of databasedefault :2
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 + Grafana + Prometheus

Usage reference:Nacos monitor-guide

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

Related Projects