Skills2026年4月15日·1 分钟阅读

Nacos — Dynamic Service Discovery & Config Management

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

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Nacos Guide
先审查命令
npx -y tokrepo@latest install a7a61cf9-3918-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

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.

常见问题

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.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产