HugeGraph PD (Placement Driver) is a meta server that provides cluster management and coordination services for HugeGraph distributed deployments. It serves as the central control plane responsible for:
PD uses SOFA-jraft for Raft consensus and RocksDB for persistent metadata storage, ensuring high availability and consistency in distributed environments.
HugeGraph PD is a Maven multi-module project consisting of 8 modules:
| Module | Description |
|---|---|
| hg-pd-grpc | gRPC protocol definitions (.proto files) and generated Java stubs for inter-service communication |
| hg-pd-common | Shared utilities, constants, and helper classes used across PD modules |
| hg-pd-core | Core PD logic: Raft integration, metadata stores, partition allocation, store monitoring, task scheduling |
| hg-pd-service | gRPC service implementations and REST API (Spring Boot) for management and metrics |
| hg-pd-client | Java client library for applications to communicate with PD cluster |
| hg-pd-cli | Command-line utilities for PD administration and debugging |
| hg-pd-test | Unit and integration tests for all PD components |
| hg-pd-dist | Distribution assembly: packaging, configuration templates, startup scripts |
For detailed architecture and design, see Architecture Documentation.
From the project root (build PD and all dependencies):
mvn clean package -pl hugegraph-pd -am -DskipTests
Or build from the hugegraph-pd directory:
cd hugegraph-pd mvn clean install -DskipTests
The assembled distribution will be available at:
hugegraph-pd/hg-pd-dist/target/hugegraph-pd-<version>.tar.gz
Extract the distribution package and start PD:
tar -xzf hugegraph-pd-<version>.tar.gz cd hugegraph-pd-<version> # Start PD server bin/start-hugegraph-pd.sh # Stop PD server bin/stop-hugegraph-pd.sh
bin/start-hugegraph-pd.sh [-g GC_TYPE] [-j "JVM_OPTIONS"] [-y ENABLE_OTEL]
-g: GC type (g1 or ZGC, default: g1)-j: Custom JVM options (e.g., -j "-Xmx4g -Xms4g")-y: Enable OpenTelemetry tracing (true or false, default: false)Key configuration file: conf/application.yml
| Parameter | Default | Description |
|---|---|---|
grpc.host | 127.0.0.1 | gRPC server bind address (use actual IP for production) |
grpc.port | 8686 | gRPC server port |
server.port | 8620 | REST API port for management and metrics |
raft.address | 127.0.0.1:8610 | Raft service address for this PD node |
raft.peers-list | 127.0.0.1:8610 | Comma-separated list of all PD nodes in the Raft cluster |
pd.data-path | ./pd_data | Directory for storing PD metadata and Raft logs |
grpc: host: 127.0.0.1 port: 8686 server: port: 8620 raft: address: 127.0.0.1:8610 peers-list: 127.0.0.1:8610 pd: data-path: ./pd_data
For a production 3-node PD cluster, configure each node:
Node 1 (192.168.1.10):
grpc: host: 192.168.1.10 port: 8686 raft: address: 192.168.1.10:8610 peers-list: 192.168.1.10:8610,192.168.1.11:8610,192.168.1.12:8610
Node 2 (192.168.1.11):
grpc: host: 192.168.1.11 port: 8686 raft: address: 192.168.1.11:8610 peers-list: 192.168.1.10:8610,192.168.1.11:8610,192.168.1.12:8610
Node 3 (192.168.1.12):
grpc: host: 192.168.1.12 port: 8686 raft: address: 192.168.1.12:8610 peers-list: 192.168.1.10:8610,192.168.1.11:8610,192.168.1.12:8610
For detailed configuration options and production tuning, see Configuration Guide.
Check if PD is running:
# Check process ps aux | grep hugegraph-pd # Test REST API curl http://localhost:8620/actuator/health # Check logs tail -f logs/hugegraph-pd.log
PD exposes several gRPC services for cluster management. Key services include:
PDGrpc): Store registration, partition queries, leader electionKvServiceGrpc): Distributed key-value operations for metadataHgPdWatchGrpc): Watch for partition and store changesHgPdPulseGrpc): Heartbeat and health monitoringProto definitions are located in:
hugegraph-pd/hg-pd-grpc/src/main/proto/
For API reference and usage examples, see API Reference.
Run PD tests:
# All PD tests mvn test -pl hugegraph-pd/hg-pd-test -am # Specific test class mvn test -pl hugegraph-pd/hg-pd-test -am -Dtest=YourTestClass
Build PD Docker image:
# From project root docker build -f hugegraph-pd/Dockerfile -t hugegraph-pd:latest . # Run container docker run -d \ -p 8620:8620 \ -p 8686:8686 \ -p 8610:8610 \ -v /path/to/conf:/hugegraph-pd/conf \ -v /path/to/data:/hugegraph-pd/pd_data \ --name hugegraph-pd \ hugegraph-pd:latest
For Docker Compose examples with HugeGraph Store and Server, see:
hugegraph-server/hugegraph-dist/docker/example/
(N-1)/2 node failures (e.g., 1 failure in 3-node cluster)8620 (REST), 8686 (gRPC), 8610 (Raft)PD exposes metrics via REST API at:
http://<pd-host>:8620/actuator/healthhttp://<pd-host>:8620/actuator/metricsContributions are welcome! Please read our Development Guide and follow the Apache HugeGraph contribution guidelines.