R-Nacos Default Ports (8848, 9848, 10848): Configuration and Usage

R-nacos exposes three default ports—8848 for HTTP OpenAPI, 9848 for high-performance gRPC (calculated as HTTP+1000), and 10848 for a standalone web console (HTTP+2000)—all configurable via RNACOS_* environment variables.

The nacos-group/r-nacos repository provides a lightweight, Rust-based implementation of the Nacos service registry and configuration center. Understanding the r-nacos default ports is essential for deployment planning, firewall configuration, and client connectivity.

The Three Default Ports of R-Nacos

R-nacos binds three independent services to specific ports defined in src/common/mod.rs within the AppSysConfig::init_from_env function. Each port serves a distinct architectural purpose, from legacy HTTP support to high-performance gRPC communication.

Port 8848: HTTP API for OpenAPI and Configuration

Port 8848 serves as the primary HTTP API endpoint, handling the classic Nacos OpenAPI (v1/v2) for configuration management and service discovery.

The default value is hardcoded in src/common/mod.rs lines 38-41, where the RNACOS_HTTP_PORT environment variable defaults to 8848:

// From src/common/mod.rs
http_port: std::env::var("RNACOS_HTTP_PORT")
    .ok()
    .and_then(|s| s.parse().ok())
    .unwrap_or(8848),

All RESTful operations target this port. For example, fetching a configuration:

curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=my-config&group=DEFAULT_GROUP"

Registering a service instance:

curl -X POST "http://127.0.0.1:8848/nacos/v1/ns/instance" \
  -d "serviceName=my-service&ip=10.0.0.5&port=8080&namespaceId=public&healthy=true"

Port 9848: High-Performance gRPC API

Port 9848 exposes the gRPC API, providing the Nacos 2.x protocol for high-performance clients and internal Raft consensus replication.

Rather than a hardcoded default, this port is calculated dynamically. In src/common/mod.rs lines 46-49, the RNACOS_GRPC_PORT environment variable defaults to the HTTP port plus 1000:

// From src/common/mod.rs
grpc_port: std::env::var("RNACOS_GRPC_PORT")
    .ok()
    .and_then(|s| s.parse().ok())
    .unwrap_or(http_port + 1000),

When the HTTP port is 8848, the gRPC port automatically becomes 9848. This port handles long-lived connections, push notifications, and the internal Raft protocol used for cluster consensus.

Rust clients typically connect directly to this port:

use nacos_sdk::grpc::NamingClient;

let client = NamingClient::new_with_addrs(
    "127.0.0.1:9848,127.0.0.1:9848", // default gRPC port
    "public",
    None,
);
let instances = client.get_instances("my-service").await?;
println!("{:?}", instances);

Port 10848: Standalone Web Console

Port 10848 hosts the standalone web console, a separate web UI that can be exposed independently of the legacy console.

This port is disabled by default (set to 0) and must be explicitly enabled via the RNACOS_HTTP_CONSOLE_PORT environment variable. When enabled, it defaults to the HTTP port plus 2000, as implemented in src/common/mod.rs lines 50-53:

// From src/common/mod.rs
http_console_port: std::env::var("RNACOS_HTTP_CONSOLE_PORT")
    .ok()
    .and_then(|s| s.parse().ok())
    .unwrap_or(http_port + 2000),

With the standard HTTP port of 8848, the console port calculates to 10848. Access the console at:


http://127.0.0.1:10848/rnacos/

Alternatively, the legacy console remains available on the main HTTP port at http://127.0.0.1:8848/rnacos/.

Configuring R-Nacos Ports via Environment Variables

All three ports can be overridden at runtime using environment variables, avoiding the need to recompile the binary:

Port Environment Variable Default Logic
8848 RNACOS_HTTP_PORT Hardcoded to 8848
9848 RNACOS_GRPC_PORT HTTP_PORT + 1000
10848 RNACOS_HTTP_CONSOLE_PORT HTTP_PORT + 2000 (disabled by default, set to 0)

A typical Docker Compose configuration exposes all three ports as shown in docker/docker-compose/r-nacos-simple/docker-compose.yaml:

services:
  nacos:
    image: nacos/r-nacos:latest
    ports:
      - "8848:8848"
      - "9848:9848"
      - "10848:10848"
    environment:
      - RNACOS_HTTP_PORT=8848
      - RNACOS_GRPC_PORT=9848
      - RNACOS_HTTP_CONSOLE_PORT=10848

Summary

  • Port 8848 serves the HTTP OpenAPI for configuration and service discovery, defined in src/common/mod.rs with the environment variable RNACOS_HTTP_PORT.
  • Port 9848 provides the high-performance gRPC API and Raft consensus, automatically calculated as HTTP_PORT + 1000 via RNACOS_GRPC_PORT.
  • Port 10848 hosts the optional standalone web console, calculated as HTTP_PORT + 2000 via RNACOS_HTTP_CONSOLE_PORT and disabled by default.

Frequently Asked Questions

Can I run r-nacos on ports other than 8848, 9848, and 10848?

Yes. You can override any port using the respective environment variables (RNACOS_HTTP_PORT, RNACOS_GRPC_PORT, RNACOS_HTTP_CONSOLE_PORT). The gRPC and console ports will still calculate relative offsets if you only change the HTTP port, but explicit values always take precedence as handled in src/common/mod.rs.

Why does the gRPC port default to 1000 above the HTTP port?

This convention aligns with the Java Nacos 2.x server architecture, where the gRPC port is offset by 1000 from the main HTTP port to maintain consistency for clients expecting the Nacos 2.x protocol. The calculation http_port + 1000 is hardcoded in the AppSysConfig::init_from_env fallback logic.

Is the standalone console on 10848 required for r-nacos to function?

No. The standalone console defaults to 0 (disabled) and is entirely optional. The legacy console remains accessible on the main HTTP port (8848) at /rnacos/. Enable the standalone console only when you need to expose the web UI on a separate port from the API endpoints.

How do I check which ports r-nacos is actually listening on?

Check the startup logs when running the binary or container. The server logs the bound addresses after initialization. Alternatively, inspect the environment variables passed to the process or review the AppSysConfig initialization in src/common/mod.rs to verify the logic being applied to your specific configuration.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →