Batata is a high-performance, Rust-based implementation of a dynamic service discovery, configuration management, and service management platform. It is fully compatible with Nacos V2/V3 APIs and Consul APIs, making it an ideal drop-in replacement for cloud-native applications.
- Configuration Management - Centralized, dynamic configuration with real-time updates
- Service Discovery - Service registration, discovery, and health checking
- Namespace Isolation - Multi-tenant support with namespace-based resource isolation
- Cluster Mode - High availability with Raft consensus protocol
- Nacos API - Full compatibility with Nacos V2 and V3 APIs (V1 intentionally not supported)
- Consul API - Compatible with Consul Agent, Health, Catalog, KV, and ACL APIs
- gRPC Support - High-performance bidirectional streaming for SDK clients
- Config Import/Export - Batch configuration migration in Nacos ZIP or Consul JSON format
- Gray/Beta Release - Gradual configuration rollout with gray release support
- Authentication & Authorization - JWT-based authentication with RBAC permission model, LDAP, OAuth2/OIDC
- Rate Limiting - Configurable rate limiting for API protection
- Circuit Breaker - Resilience patterns for fault tolerance
- Metrics & Observability - Prometheus-compatible metrics endpoint
- Service Mesh - xDS protocol support (EDS, CDS, LDS, RDS, ADS)
- Multi-Datacenter - Locality-aware replication with cross-DC sync
- DNS Service - UDP-based DNS for service discovery
- Distributed Lock - Raft-based distributed locking
- AI Integration - MCP (Model Content Protocol) and A2A (Agent-to-Agent) registry
- Database Migration - Automatic schema migration on startup via
batata-migrationcrate
- Fast Startup - ~1-2 seconds vs 30-60 seconds for Java-based Nacos
- Low Memory - ~50-100MB vs 1-2GB for Java-based Nacos
- High Throughput - Optimized async I/O with Tokio runtime
- Efficient Storage - RocksDB for persistent storage with tuned caching
Batata implements ~98% of Nacos features and can serve as a production-ready drop-in replacement.
| Feature | Nacos | Batata | Status |
|---|---|---|---|
| Configuration Management | |||
| Config CRUD | ✅ | ✅ | Full |
| Config Search & Pagination | ✅ | ✅ | Full |
| Config History & Rollback | ✅ | ✅ | Full |
| Config Listening (Long Polling) | ✅ | ✅ | Full |
| Gray/Beta Release | ✅ | ✅ | Full |
| Config Import/Export (ZIP) | ✅ | ✅ | Full |
| Config Tags | ✅ | ✅ | Full |
| Config Encryption | ✅ | ✅ | Full (AES-128-CBC) |
| Config Capacity Quota | ✅ | ✅ | Full |
| Aggregate Config (datumId) | ✅ | ✅ | Full |
| Service Discovery | |||
| Instance Register/Deregister | ✅ | ✅ | Full |
| Service Discovery Query | ✅ | ✅ | Full |
| Health Check | ✅ | ✅ | Full |
| Heartbeat | ✅ | ✅ | Full |
| Subscribe/Push | ✅ | ✅ | Full |
| Weight Routing | ✅ | ✅ | Full |
| Ephemeral Instances | ✅ | ✅ | Full |
| Persistent Instances | ✅ | ✅ | Full |
| Service Metadata | ✅ | ✅ | Full |
| DNS-based Discovery | ✅ | ✅ | Full |
| Namespace | |||
| Namespace CRUD | ✅ | ✅ | Full |
| Multi-tenant Isolation | ✅ | ✅ | Full |
| Cluster | |||
| Cluster Node Discovery | ✅ | ✅ | Full |
| Node Health Check | ✅ | ✅ | Full |
| Raft Consensus (CP) | ✅ | ✅ | Full |
| Distro Protocol (AP) | ✅ | ✅ | Full |
| Multi-Datacenter Sync | ✅ | ✅ | Full |
| Auth | |||
| User Management | ✅ | ✅ | Full |
| Role Management | ✅ | ✅ | Full |
| Permission (RBAC) | ✅ | ✅ | Full |
| JWT Token | ✅ | ✅ | Full |
| LDAP Integration | ✅ | ✅ | Full |
| OAuth2/OIDC | ✅ | ✅ | Full |
| API | |||
| Nacos V2 API | ✅ | ✅ | Full |
| Nacos V3 API | ✅ | ✅ | Full |
| Nacos V1 API | ✅ | ❌ | Intentionally not supported |
| gRPC Bi-directional Streaming | ✅ | ✅ | Full |
| Consul API Compatibility | ❌ | ✅ | Extra |
| Observability | |||
| Prometheus Metrics | ✅ | ✅ | Full |
| Health Endpoint | ✅ | ✅ | Full |
| OpenTelemetry | ✅ | ✅ | Full |
| Operation Audit Logs | ✅ | ✅ | Full |
| Feature | Description |
|---|---|
| Consul API Compatibility | Full support for Agent, Health, Catalog, KV, ACL APIs |
| PostgreSQL Support | In addition to MySQL |
| Consul JSON Import/Export | Migration support for Consul KV store |
| Built-in Circuit Breaker | Resilience pattern for cluster health checks |
| OpenTelemetry Tracing | OTLP export for distributed tracing (Jaeger, Zipkin, etc.) |
| Multi-datacenter Support | Locality-aware replication with local-first sync |
| Service Mesh (xDS) | EDS, CDS, LDS, RDS, ADS protocol support |
| AI Integration | MCP Server Registry and A2A Agent Registry |
| Distributed Lock | Raft-based distributed locking mechanism |
| Kubernetes Sync | Bidirectional service sync with Kubernetes |
| Database Migration | Automatic schema migration via batata-migration crate |
| Module | Completeness | Notes |
|---|---|---|
| Configuration Management | 100% | Full AES-GCM encryption support |
| Service Discovery | 95% | UDP Push not implemented (gRPC push used) |
| Namespace | 100% | Fully supported |
| Cluster Management | 95% | Single Raft group (Multi-Raft partial) |
| Authentication | 100% | JWT, LDAP, OAuth2/OIDC |
| API Compatibility | 100%+ | Full Nacos V2/V3 + Consul APIs |
| Cloud Native | 85% | K8s, Prometheus, xDS (basic) |
| Overall | ~98% | Production ready |
Batata uses a multi-crate workspace architecture with 19 internal crates for modularity and maintainability:
batata/
├── crates/
│ ├── batata-common/ # Common utilities & types
│ ├── batata-api/ # API definitions & gRPC proto
│ ├── batata-persistence/ # Database entities (SeaORM)
│ ├── batata-migration/ # Database schema migration
│ ├── batata-auth/ # Authentication & authorization
│ ├── batata-consistency/ # Raft consensus protocol
│ ├── batata-core/ # Core abstractions & cluster
│ ├── batata-server-common/ # Shared server infrastructure
│ ├── batata-config/ # Configuration service
│ ├── batata-naming/ # Service discovery
│ ├── batata-plugin/ # Plugin interfaces
│ ├── batata-plugin-consul/ # Consul compatibility plugin
│ ├── batata-plugin-cloud/ # Prometheus & Kubernetes plugin
│ ├── batata-console/ # Console backend service
│ ├── batata-client/ # Client SDK
│ ├── batata-maintainer-client/ # Maintainer client utilities
│ ├── batata-consul-client/ # Consul client utilities
│ ├── batata-ai/ # AI integration (MCP/A2A)
│ ├── batata-mesh/ # Service mesh (xDS, Istio MCP)
│ └── batata-server/ # Main server (HTTP, gRPC, Console)
│ ├── src/
│ │ ├── api/ # API handlers (HTTP, gRPC, Consul)
│ │ ├── auth/ # Auth HTTP handlers
│ │ ├── config/ # Config models (re-exports)
│ │ ├── console/ # Console API handlers
│ │ ├── middleware/ # HTTP middleware
│ │ ├── model/ # Application state & config
│ │ ├── service/ # gRPC handlers
│ │ ├── startup/ # Server initialization
│ │ ├── lib.rs # Library exports
│ │ └── main.rs # Entry point
│ ├── tests/ # Integration tests
│ └── benches/ # Performance benchmarks
├── conf/ # Configuration files
├── docs/ # Documentation
└── proto/ # Protocol buffer definitions
batata-server (main binary)
├── batata-api (API types, gRPC proto)
├── batata-auth (JWT, RBAC, LDAP, OAuth2)
├── batata-config (config service)
├── batata-naming (service discovery)
├── batata-console (console backend)
├── batata-core (cluster, connections, datacenter)
├── batata-server-common (shared server infrastructure)
├── batata-mesh (xDS, Istio MCP)
├── batata-ai (MCP/A2A registry)
├── batata-plugin-consul (Consul API)
├── batata-plugin-cloud (Prometheus, K8s)
├── batata-migration (database migration)
└── batata-persistence (database)
- Rust 1.85+ (Edition 2024)
- MySQL 5.7+ / 8.0+ or PostgreSQL 12+ (optional -- embedded mode requires no database)
The fastest way to get started. Batata runs with an embedded RocksDB store:
# Clone the repository
git clone https://github.com/easynet-cn/batata.git
cd batata
# Build and run in embedded mode
cargo build --release -p batata-server
./target/release/batata-server --batata.sql.init.platform=embedded
# Or use the convenience script
./scripts/start-embedded.shOn first startup, initialize the admin user:
curl -X POST http://localhost:8848/nacos/v3/auth/user/admin \
-d "username=nacos&password=nacos"# Clone the repository
git clone https://github.com/easynet-cn/batata.git
cd batata
# Initialize database
mysql -u root -p < conf/mysql-schema.sql
mysql -u root -p < conf/consul-mysql-schema.sql
# Edit conf/application.yml with your database credentials
# Then build and run
cargo build --release -p batata-server
./target/release/batata-serverAlternatively, enable auto-migration instead of manually importing schemas:
./target/release/batata-server --batata.db.migration.enabled=true# Initialize database
psql -U user -d batata -f conf/postgresql-schema.sql
# Edit conf/application.yml:
# batata.sql.init.platform: postgresql
# batata.db.url: postgres://user:password@localhost:5432/batata
cargo build --release -p batata-server
./target/release/batata-server| Port | Service | Description |
|---|---|---|
| 8848 | Main HTTP API | Nacos-compatible API |
| 8081 | Console HTTP API | Web management console |
| 9848 | SDK gRPC | Client SDK communication |
| 9849 | Cluster gRPC | Inter-node communication |
| 15010 | xDS gRPC | Service mesh xDS/ADS protocol |
Main configuration file: conf/application.yml
All configuration keys use the flat batata.* prefix. Keys can be overridden via:
- Environment variables:
BATATA_*(e.g.,BATATA_SERVER_MAIN_PORT=9090) - CLI property overrides:
--batata.server.main.port=9090
# Server
batata.server.main.port: 8848
batata.server.context_path: /nacos
batata.standalone: true
#batata.deployment.type: merged
# Console
batata.console.port: 8081
batata.console.context_path:
# Database
batata.sql.init.platform: mysql
batata.db.url: "mysql://user:password@localhost:3306/batata"
batata.db.pool.max_connections: 100
batata.db.pool.min_connections: 10
batata.db.migration.enabled: false
# Authentication
batata.core.auth.enabled: true
batata.core.auth.system.type: nacos
batata.core.auth.plugin.nacos.token.secret.key: "your-base64-encoded-secret-key"
batata.core.auth.plugin.nacos.token.expire.seconds: 18000export BATATA_DB_URL="mysql://user:pass@localhost:3306/batata"
export BATATA_SERVER_MAIN_PORT=8848
export BATATA_CORE_AUTH_ENABLED=true
export RUST_LOG=info| Key | Default | Description |
|---|---|---|
batata.server.main.port |
8848 |
Main HTTP server port |
batata.server.context_path |
/nacos |
Server web context path |
batata.standalone |
true |
Standalone mode (true=single, false=cluster) |
batata.deployment.type |
merged |
Deployment type: merged/server/console/serverWithMcp |
| Key | Default | Description |
|---|---|---|
batata.console.port |
8081 |
Console HTTP server port |
batata.console.context_path |
(empty) | Console web context path |
batata.console.remote.server_addr |
(empty) | Remote server address (console-only mode) |
batata.console.remote.username |
(empty) | Remote server username |
batata.console.remote.password |
(empty) | Remote server password |
| Key | Default | Description |
|---|---|---|
batata.sql.init.platform |
(empty) | Storage platform: mysql, postgresql, or empty (=embedded) |
batata.db.url |
(empty) | Database connection URL |
batata.db.pool.max_connections |
100 |
Max pool connections |
batata.db.pool.min_connections |
10 |
Min pool connections |
batata.db.pool.connect_timeout |
30 |
Connection timeout (seconds) |
batata.db.pool.acquire_timeout |
30 |
Acquire timeout (seconds) |
batata.db.pool.idle_timeout |
600 |
Idle timeout (seconds) |
batata.db.pool.max_lifetime |
1800 |
Max connection lifetime (seconds) |
batata.db.migration.enabled |
false |
Auto-run database migrations on startup |
| Key | Default | Description |
|---|---|---|
batata.core.auth.enabled |
true |
Enable authentication |
batata.core.auth.admin.enabled |
true |
Enable admin API auth |
batata.core.auth.console.enabled |
true |
Enable console API auth |
batata.core.auth.system.type |
nacos |
Auth type: nacos, ldap, or oauth |
batata.core.auth.plugin.nacos.token.secret.key |
(required) | JWT secret (Base64-encoded) |
batata.core.auth.plugin.nacos.token.expire.seconds |
18000 |
Token expiry (seconds) |
batata.core.auth.server.identity.key |
(empty) | Server identity key for inter-node trust |
batata.core.auth.server.identity.value |
(empty) | Server identity value |
| Key | Default | Description |
|---|---|---|
batata.ratelimit.enabled |
false |
Enable API rate limiting |
batata.ratelimit.max_requests |
10000 |
Max requests per window |
batata.ratelimit.window_seconds |
60 |
Rate limit window (seconds) |
batata.ratelimit.auth.enabled |
false |
Enable auth rate limiting |
batata.ratelimit.auth.max_attempts |
5 |
Max auth attempts per window |
batata.ratelimit.auth.lockout_seconds |
300 |
Auth lockout duration (seconds) |
| Key | Default | Description |
|---|---|---|
batata.otel.enabled |
false |
Enable OpenTelemetry |
batata.otel.endpoint |
http://localhost:4317 |
OTLP gRPC endpoint |
batata.otel.service_name |
batata |
Service name for traces |
batata.otel.sampling_ratio |
0.1 |
Sampling ratio (0.0 to 1.0) |
batata.otel.export_timeout_secs |
10 |
Export timeout (seconds) |
batata.logs.path |
logs |
Log directory |
batata.logs.level |
info |
Log level: trace/debug/info/warn/error |
batata.logs.console.enabled |
true |
Enable console (stdout) logging |
batata.logs.file.enabled |
true |
Enable file logging |
| Key | Default | Description |
|---|---|---|
batata.member.list |
(empty) | Comma-separated member addresses (ip:port) |
batata.core.member.lookup.type |
file |
Member lookup type: file or address-server |
| Key | Default | Description |
|---|---|---|
batata.config.retention.days |
30 |
Config history retention days |
batata.config.encryption.enabled |
false |
Enable config encryption |
batata.config.encryption.plugin.type |
aes-gcm |
Encryption algorithm |
batata.config.encryption.key |
(empty) | Encryption key (32-byte Base64-encoded) |
| Key | Default | Description |
|---|---|---|
batata.mesh.xds.enabled |
false |
Enable xDS protocol |
batata.mesh.xds.port |
15010 |
xDS gRPC server port |
batata.mesh.xds.server.id |
batata-xds-server |
xDS server identifier |
batata.mesh.xds.sync.interval.ms |
5000 |
Service sync interval (ms) |
batata.mesh.xds.generate.listeners |
true |
Generate LDS resources |
batata.mesh.xds.generate.routes |
true |
Generate RDS resources |
batata.mesh.xds.default.listener.port |
15001 |
Default listener port |
| Key | Default | Description |
|---|---|---|
batata.plugin.consul.enabled |
false |
Enable Consul API compatibility |
batata.plugin.consul.port |
8500 |
Consul API port |
batata.plugin.consul.datacenter |
dc1 |
Consul datacenter name |
| Key | Default | Description |
|---|---|---|
batata.ai.mcp.registry.enabled |
false |
Enable MCP Registry |
batata.ai.mcp.registry.port |
9080 |
MCP Registry port |
Enable distributed tracing with OpenTelemetry OTLP export:
application.yml:
batata.otel.enabled: true
batata.otel.endpoint: "http://localhost:4317"
batata.otel.service_name: "batata"
batata.otel.sampling_ratio: 1.0
batata.otel.export_timeout_secs: 10Environment Variables (override config file):
export BATATA_OTEL_ENABLED=true
export BATATA_OTEL_ENDPOINT="http://localhost:4317"
export BATATA_OTEL_SERVICE_NAME="batata"
export BATATA_OTEL_SAMPLING_RATIO=1.0
export BATATA_OTEL_EXPORT_TIMEOUT_SECS=10Compatible backends: Jaeger, Zipkin, Tempo, Datadog, Honeycomb, and any OTLP-compatible collector.
Enable locality-aware clustering with datacenter, region, and zone settings:
Environment Variables:
export BATATA_DATACENTER="dc1"
export BATATA_REGION="us-east"
export BATATA_ZONE="zone-a"
export BATATA_LOCALITY_WEIGHT=1.0
export BATATA_CROSS_DC_REPLICATION=true
export BATATA_CROSS_DC_SYNC_DELAY_SECS=1
export BATATA_REPLICATION_FACTOR=1Features:
- Locality-aware member selection (local-first sync)
- Cross-datacenter replication with configurable delay
- Automatic datacenter topology discovery
- Region/zone hierarchy support
Enable xDS protocol support for Envoy proxies and Istio service mesh:
application.yml:
batata.mesh.xds.enabled: true
batata.mesh.xds.port: 15010
batata.mesh.xds.server.id: "batata-xds-server"
batata.mesh.xds.sync.interval.ms: 5000
batata.mesh.xds.generate.listeners: true
batata.mesh.xds.generate.routes: true
batata.mesh.xds.default.listener.port: 15001Supported xDS Resources:
- EDS (Endpoint Discovery Service) - Service endpoints
- CDS (Cluster Discovery Service) - Upstream clusters
- LDS (Listener Discovery Service) - Listeners configuration
- RDS (Route Discovery Service) - Route configuration
- ADS (Aggregated Discovery Service) - All resources via single stream
Compatible with: Envoy Proxy, Istio, and any xDS-compatible service mesh.
| Endpoint | Method | Description |
|---|---|---|
/nacos/v2/cs/config |
GET | Get configuration |
/nacos/v2/cs/config |
POST | Create/update configuration |
/nacos/v2/cs/config |
DELETE | Delete configuration |
| Endpoint | Method | Description |
|---|---|---|
/v3/console/cs/config |
GET | Get config detail (console) |
/v3/console/cs/config/list |
GET | List configs with pagination |
/v3/console/cs/config/export |
GET | Export configs (ZIP) |
/v3/console/cs/config/import |
POST | Import configs (ZIP) |
| Endpoint | Method | Description |
|---|---|---|
/nacos/v2/ns/instance |
POST | Register instance |
/nacos/v2/ns/instance |
PUT | Update instance |
/nacos/v2/ns/instance |
DELETE | Deregister instance |
/nacos/v2/ns/instance/list |
GET | List service instances |
| Endpoint | Method | Description |
|---|---|---|
/v1/agent/service/register |
PUT | Register service |
/v1/agent/service/deregister/{id} |
PUT | Deregister service |
/v1/health/service/{service} |
GET | Get service health |
/v1/catalog/services |
GET | List all services |
/v1/kv/{key} |
GET | Get KV value |
/v1/kv/{key} |
PUT | Set KV value |
/v1/kv/{key} |
DELETE | Delete KV value |
/v1/kv/export |
GET | Export KV (JSON) |
/v1/kv/import |
PUT | Import KV (JSON) |
| Endpoint | Method | Description |
|---|---|---|
/v3/console/namespace/list |
GET | List namespaces |
/v3/console/namespace |
POST | Create namespace |
/v3/console/core/cluster/nodes |
GET | List cluster nodes |
/v3/console/core/cluster/health |
GET | Get cluster health |
# Export configurations
curl -O "http://localhost:8081/v3/console/cs/config/export?namespaceId=public"
# Import with conflict policy (ABORT, SKIP, OVERWRITE)
curl -X POST "http://localhost:8081/v3/console/cs/config/import?namespaceId=public&policy=OVERWRITE" \
-F "file=@export.zip"# Export KV store
curl "http://localhost:8848/v1/kv/export?namespaceId=public" > configs.json
# Import KV store
curl -X PUT "http://localhost:8848/v1/kv/import?namespaceId=public" \
-H "Content-Type: application/json" \
-d @configs.json┌─────────────────────────────────────────────────────────────────┐
│ Batata Server │
├─────────────────────────────────────────────────────────────────┤
│ ┌───────────────┐ ┌───────────────┐ ┌─────────────────────┐ │
│ │ HTTP API │ │ gRPC API │ │ Console API │ │
│ │ (Actix) │ │ (Tonic) │ │ (Actix) │ │
│ │ Port:8848 │ │ Port:9848 │ │ Port:8081 │ │
│ └───────┬───────┘ └───────┬───────┘ └──────────┬──────────┘ │
│ │ │ │ │
│ ┌───────▼──────────────────▼──────────────────────▼───────────┐ │
│ │ Service Layer │ │
│ │ ┌──────────┐ ┌──────────┐ ┌────────┐ ┌───────────────┐ │ │
│ │ │ Config │ │ Naming │ │ Auth │ │ Namespace │ │ │
│ │ │ Service │ │ Service │ │Service │ │ Service │ │ │
│ │ └──────────┘ └──────────┘ └────────┘ └───────────────┘ │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Storage Layer │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │ │
│ │ │ MySQL/PgSQL │ │ RocksDB │ │ Moka Cache │ │ │
│ │ │ (SeaORM) │ │ (Raft Log) │ │ (In-Memory) │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Cluster Layer │ │
│ │ ┌─────────────────────────────────────────────────────────┐│ │
│ │ │ Raft Consensus (OpenRaft) ││ │
│ │ │ Port: 9849 ││ │
│ │ └─────────────────────────────────────────────────────────┘│ │
│ └─────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
Batata supports four deployment modes, controlled by batata.deployment.type or the -d CLI flag:
| Mode | Flag | Description |
|---|---|---|
merged (default) |
-d merged |
Console (8081) + Main Server (8848) in same process |
server |
-d server |
Main Server only (8848) + gRPC (9848/9849), no console |
console |
-d console |
Console only (8081), connects to remote server |
serverWithMcp |
-d serverWithMcp |
Main Server + MCP Registry (9080) |
Convenience scripts are provided in the scripts/ directory:
# Start in embedded mode (no database required)
./scripts/start-embedded.sh
# Start server-only (main server on 8848, no console)
./scripts/start-server.sh
# Start console-only (connects to a remote server)
./scripts/start-console.sh [server_addr]
# Start with MySQL database
./scripts/start-mysql.sh [db_url]
# Initialize admin user (required on first startup)
./scripts/init-admin.sh [username] [password] [server_url]
# Test console/server route separation
./scripts/test-separation.sh# Run directly
cargo run --release -p batata-server
# Or with explicit standalone flag
./target/release/batata-server --batata.standalone=true-
Configure
conf/cluster.confwith member addresses:192.168.1.1:8848 192.168.1.2:8848 192.168.1.3:8848 -
Update
conf/application.yml:batata.standalone: false #batata.member.list: "192.168.1.10:8848,192.168.1.11:8848,192.168.1.12:8848"
-
Start all nodes
# Build image
podman build -t batata:latest .
# Run container
podman run -d \
-p 8848:8848 \
-p 8081:8081 \
-p 9848:9848 \
-v $(pwd)/conf:/app/conf \
batata:latest# Embedded mode (no DB)
podman-compose up batata
# With MySQL
podman-compose --profile mysql up
# With PostgreSQL
podman-compose --profile postgres up
# 3-node cluster
podman-compose --profile cluster up
# Server + Console separated
podman-compose --profile split upBatata supports MySQL, PostgreSQL, and embedded RocksDB (no external database).
mysql -u root -p < conf/mysql-schema.sql
mysql -u root -p < conf/consul-mysql-schema.sqlConfigure in conf/application.yml:
batata.sql.init.platform: mysql
batata.db.url: "mysql://user:password@localhost:3306/batata"psql -U user -d batata -f conf/postgresql-schema.sqlConfigure in conf/application.yml:
batata.sql.init.platform: postgresql
batata.db.url: "postgres://user:password@localhost:5432/batata"For development or single-node deployments, no external database is required:
batata.sql.init.platform:
batata.standalone: trueOr start with: --batata.sql.init.platform=embedded
Instead of manually importing SQL schema files, you can enable automatic database migration via the batata-migration crate:
batata.db.migration.enabled: trueWhen enabled, Batata will automatically create or update the database schema on startup. This is the recommended approach for new deployments and upgrades.
# For MySQL:
sea-orm-cli generate entity \
-u "mysql://user:pass@localhost:3306/batata" \
-o ./crates/batata-persistence/src/entity \
--with-serde both
# For PostgreSQL:
sea-orm-cli generate entity \
-u "postgres://user:pass@localhost:5432/batata" \
-o ./crates/batata-persistence/src/entity \
--with-serde both# Build all crates
cargo build
# Build server only (faster)
cargo build -p batata-server
# Release build (optimized)
cargo build --release -p batata-server
# Run tests (all crates)
cargo test --workspace
# Run specific crate tests
cargo test -p batata-server
# Run benchmarks
cargo bench -p batata-server
# Format code
cargo fmt --all
# Lint with Clippy
cargo clippy --workspace
# Generate documentation
cargo doc --workspace --open- ~50,000+ lines of Rust code
- 19 internal crates in workspace
- 333 unit tests with comprehensive coverage
- 3 benchmark suites for performance testing
Batata is compatible with existing Nacos and Consul client SDKs:
Properties properties = new Properties();
properties.setProperty("serverAddr", "localhost:8848");
ConfigService configService = NacosFactory.createConfigService(properties);
String config = configService.getConfig("dataId", "group", 5000);client, _ := clients.NewConfigClient(
vo.NacosClientParam{
ServerConfigs: []constant.ServerConfig{
{IpAddr: "localhost", Port: 8848},
},
},
)
config, _ := client.GetConfig(vo.ConfigParam{DataId: "dataId", Group: "group"})client, _ := api.NewClient(api.DefaultConfig())
kv, _, _ := client.KV().Get("key", nil)import nacos
client = nacos.NacosClient(server_addresses="localhost:8848")
config = client.get_config("dataId", "group")Prometheus metrics available at /nacos/actuator/prometheus:
# HELP batata_http_requests_total Total HTTP requests
# TYPE batata_http_requests_total counter
batata_http_requests_total{method="GET",path="/nacos/v2/cs/config"} 1234
# HELP batata_config_count Current configuration count
# TYPE batata_config_count gauge
batata_config_count{namespace="public"} 100
# HELP batata_service_count Current service count
# TYPE batata_service_count gauge
batata_service_count{namespace="public"} 50
# HELP batata_cluster_member_count Cluster member count
# TYPE batata_cluster_member_count gauge
batata_cluster_member_count 3
- Persistent service instances (database storage)
- Distro protocol enhancement (AP mode)
- Config encryption at rest (AES-128-CBC)
- OpenTelemetry integration (OTLP export)
- Multi-datacenter support (locality-aware sync)
- Service Mesh xDS protocol (EDS, CDS, LDS, RDS, ADS)
- AI Integration (MCP Server Registry, A2A Agent Registry)
- Kubernetes sync (bidirectional service sync)
- LDAP authentication
- OAuth2/OIDC authentication (Google, GitHub, Microsoft)
- Distributed locking (Raft-based)
- DNS-based service discovery
- Gray/Beta release API
- Operation audit logs
- Database auto-migration
- Kubernetes Operator
- Web UI (backend API only, use Nacos UI or custom frontend)
Contributions are welcome! Please feel free to submit issues and pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.