Nacos 3.0 Deep Dive: Decoupled Architecture & Flexible Deployments
This article examines Nacos 3.0’s major architectural overhaul—including console‑service decoupling, independent ports, three deployment modes, a new bootstrap startup engine, and step‑by‑step embedded integration—showcasing how the redesign boosts security, performance, and flexibility for microservice ecosystems.
Architecture Upgrade: Decoupling and Security Boost
Nacos 3.0 separates the console from the server, improving system structure and overall security.
Port Separation: Dual Access Mechanism
The new version introduces independent console ports:
Traditional access :
IP:8848/nacos(2.x)
New access :
IP:8080/nacos(3.0)
This design isolates the management UI (8080) from the service API (8848), preventing unauthorized access.
Three Deployment Modes
⚡ Merged Mode (MERGED)
<code># 启动参数 merged # 默认值,无需显式指定</code>A single Nacos process provides registration, configuration, and the full console.
🔋 Server Mode (SERVER)
<code># 启动参数 server</code>Focuses on core API services without a UI, suitable for high‑availability clusters.
🖥️ Console Mode (CONSOLE)
<code># 启动参数 console</code>Runs only the management console, allowing connection to one or more remote Nacos clusters.
Core Port Overview
8080 – Console port for UI access (internal network, set permissions).
8848 – HTTP API port for service registration and configuration (internal microservice traffic).
9848 – gRPC client port for high‑performance communication (internal).
9849 – gRPC inter‑cluster port for node synchronization (cluster‑only).
7848 – JRaft protocol port for distributed consistency (cluster‑only).
New Bootstrap Startup Engine
Nacos 3.0 introduces a modular bootstrap starter that drives all components through a unified entry point, reducing coupling.
Unified Startup Entry : All components are launched by the bootstrap module.
Multi‑Stage Process : Core → Server → Console.
Modular Loading : On‑demand component activation for efficient resource use.
Embedded Nacos Integration for Microservices
Nacos 3.0 can be embedded directly into SpringBoot applications, offering version compatibility and zero external dependencies.
Three‑Step Embedded Setup
1️⃣ Add Minimal Dependencies
<code><dependencies>
<!-- Nacos integration package (personal release) -->
<dependency>
<groupId>io.github.pig-mesh.nacos</groupId>
<artifactId>nacos-console</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.github.pig-mesh.nacos</groupId>
<artifactId>nacos-server</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies></code>2️⃣ Configure Application Parameters
Edit
application.propertieswith the core Nacos settings (refer to the official template).
3️⃣ Create Efficient Startup Class
<code>public class NacosApplication {
public static void main(String[] args) {
// Standalone mode
System.setProperty(ConfigConstants.STANDALONE_MODE, "true");
// Determine deployment type (merged/server/console)
String type = System.getProperty(Constants.NACOS_DEPLOYMENT_TYPE, Constants.NACOS_DEPLOYMENT_TYPE_MERGED);
DeploymentType deploymentType = DeploymentType.getType(type);
EnvUtil.setDeploymentType(deploymentType);
// Phase 1: Core services
NacosStartUpManager.start(NacosStartUp.CORE_START_UP_PHASE);
ConfigurableApplicationContext coreContext = new SpringApplicationBuilder(NacosServerBasicApplication.class)
.web(WebApplicationType.NONE)
.run(args);
// Phase 2: Server web
NacosStartUpManager.start(NacosStartUp.WEB_START_UP_PHASE);
ConfigurableApplicationContext serverWebContext = new SpringApplicationBuilder(NacosServerWebApplication.class)
.parent(coreContext)
.run(args);
// Phase 3: Console
NacosStartUpManager.start(NacosStartUp.CONSOLE_START_UP_PHASE);
ConfigurableApplicationContext consoleContext = new SpringApplicationBuilder(NacosConsole.class)
.parent(coreContext)
.run(args);
}
}</code>4️⃣ One‑Click Launch
Run the application and access the embedded console at
http://localhost:8080/nacosfor a unified service‑governance experience.
Conclusion
Nacos 3.0’s decoupled architecture, modular design, and embedded integration dramatically improve flexibility, security, and usability, catering to both large‑scale enterprise deployments and lightweight development environments.
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.