Microservice System
Microservice System
Section titled “Microservice System”This advanced example shows how multiple go-zero services collaborate using etcd for service discovery.
Services Overview
Section titled “Services Overview”order-api ──→ order-rpc ──→ MySQL ↓ inventory-rpc ──→ Redis ↓ payment-rpc ──→ MySQLPrerequisites
Section titled “Prerequisites”- etcd running on
localhost:2379 - MySQL and Redis available
Service Configuration
Section titled “Service Configuration”Each service registers itself with etcd:
Name: order.rpcListenOn: 0.0.0.0:8080Etcd: Hosts: - 127.0.0.1:2379 Key: order.rpcRPC Client Configuration
Section titled “RPC Client Configuration”OrderRpc: Etcd: Hosts: - 127.0.0.1:2379 Key: order.rpcObservability
Section titled “Observability”Enable Prometheus metrics and Jaeger tracing:
Telemetry: Name: order-api Endpoint: http://jaeger:14268/api/traces Sampler: 1.0 Batcher: jaegerKey Concepts Demonstrated
Section titled “Key Concepts Demonstrated”- Service discovery via etcd
- Multi-hop RPC call chains
- Distributed tracing across services
- Rate limiting and circuit breaking in action