ScriptsApr 15, 2026·3 min read

Nacos — Dynamic Service Discovery & Config Management

Open source service discovery, configuration, and service management platform for cloud native and microservices applications.

TL;DR
Nacos bundles service registry, dynamic configuration with hot-reload, and DNS-based discovery into a single server with one console.
§01

What it is

Nacos (Naming And Configuration Service) is an Alibaba-incubated, Apache 2.0 licensed platform that combines service registry, dynamic configuration, and service management. It targets the same problems as Eureka, Consul, and Spring Cloud Config but bundles them into a single server with one console and one SDK.

It is designed for teams building microservices with Spring Cloud, Dubbo, gRPC, or Kubernetes who need a centralized place for service discovery and configuration hot-reload.

§02

How it saves time or tokens

Running separate systems for service discovery (Eureka or Consul) and configuration (Spring Cloud Config or etcd) increases operational overhead. Nacos consolidates both into one process with one admin console. Dynamic configuration with namespace isolation and version history means developers push config changes without restarting services. The built-in health check system detects unhealthy instances and routes traffic away automatically.

§03

How to use

  1. Start a standalone Nacos server with Docker.
docker run -d --name nacos -p 8848:8848 -p 9848:9848 \
  -e MODE=standalone nacos/nacos-server:v2.4.3
  1. Open the console at http://localhost:8848/nacos (default credentials: nacos/nacos).
  1. Register a service programmatically.
curl -X POST 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=demo&ip=10.0.0.1&port=8080'
§04

Example

Publishing and reading a configuration key:

# Publish config
curl -X POST 'http://127.0.0.1:8848/nacos/v1/cs/configs' \
  -d 'dataId=app.properties&group=DEFAULT_GROUP&content=db.url=jdbc:mysql://localhost:3306/mydb'

# Read config
curl 'http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=app.properties&group=DEFAULT_GROUP'

Spring Boot apps using nacos-config-spring-boot-starter pick up changes automatically without restart.

§05

Related on TokRepo

  • DevOps tools -- Infrastructure tools for cloud-native service management.
  • Self-hosted tools -- Run your own service discovery and config management.
§06

Common pitfalls

  • Standalone mode uses embedded Derby. For production, configure an external MySQL backend for high availability.
  • Nacos 2.x uses gRPC on port 9848 in addition to HTTP on 8848. Ensure both ports are open in your firewall rules.
  • The default credentials (nacos/nacos) must be changed before exposing the console to any network beyond localhost.

Frequently Asked Questions

How does Nacos compare to Consul?+

Both provide service discovery and key-value configuration. Nacos adds first-class support for Spring Cloud and Dubbo SDKs, namespace isolation for multi-tenant environments, and a built-in configuration version history. Consul offers a stronger service mesh story with Connect. The choice often depends on your existing stack.

Does Nacos support Kubernetes?+

Yes. Nacos can sync with Kubernetes service endpoints. It also runs inside Kubernetes as a StatefulSet. For teams already using Kubernetes DNS-based discovery, Nacos adds dynamic configuration and health checking on top.

What consistency model does Nacos use?+

Nacos supports both AP (Distro protocol) for ephemeral service instances and CP (Raft) for persistent service instances and configuration data. You choose per service based on your consistency requirements.

Can Nacos handle configuration hot-reload?+

Yes. When a configuration value changes in Nacos, connected clients receive a push notification and update in-memory values without restarting. This works with Spring Boot, Dubbo, and custom SDK integrations.

Is Nacos production-ready?+

Nacos has been used in production at Alibaba and many other organizations. For production deployments, run at least three Nacos nodes with an external MySQL database for metadata storage and configure authentication.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets