1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/// Example YAML configuration for a 5-node production cluster with PostgreSQL
///
/// Usage:
/// - Copy to commy-cluster-prod.yaml
/// - Update node addresses to match your infrastructure
/// - Set PostgreSQL connection URL and credentials
/// - Pass to: ClusteringConfig::from_yaml_file("commy-cluster-prod.yaml")
server_id: "server-1"
nodes:
- id: "server-1"
address: "10.0.1.10:9001"
max_connections: 20
tls:
cert_path: "/etc/commy/certs/server-1.crt"
key_path: "/etc/commy/certs/server-1.key"
ca_path: "/etc/commy/certs/ca.crt"
verify_peer: true
- id: "server-2"
address: "10.0.1.11:9001"
max_connections: 20
tls:
cert_path: "/etc/commy/certs/server-2.crt"
key_path: "/etc/commy/certs/server-2.key"
ca_path: "/etc/commy/certs/ca.crt"
verify_peer: true
- id: "server-3"
address: "10.0.1.12:9001"
max_connections: 20
tls:
cert_path: "/etc/commy/certs/server-3.crt"
key_path: "/etc/commy/certs/server-3.key"
ca_path: "/etc/commy/certs/ca.crt"
verify_peer: true
- id: "server-4"
address: "10.0.1.13:9001"
max_connections: 20
tls:
cert_path: "/etc/commy/certs/server-4.crt"
key_path: "/etc/commy/certs/server-4.key"
ca_path: "/etc/commy/certs/ca.crt"
verify_peer: true
- id: "server-5"
address: "10.0.1.14:9001"
max_connections: 20
tls:
cert_path: "/etc/commy/certs/server-5.crt"
key_path: "/etc/commy/certs/server-5.key"
ca_path: "/etc/commy/certs/ca.crt"
verify_peer: true
replication:
# Aggressive sync for production consistency
sync_interval_ms: 50
batch_size: 2000
max_concurrent_tasks: 8
gossip_enabled: true
replication_timeout_ms: 10000
enable_checksums: true
enable_resume: true
consistency:
# Last-Write-Wins for deterministic conflict resolution
strategy:
last_write_wins:
tie_breaker: null
enable_vector_clocks: true
quorum_size: 3 # Require 3 of 5 servers for writes
detect_conflicts: true
conflict_log_enabled: true
conflict_log_path: "/var/log/commy/conflicts.log"
network:
# Shorter heartbeat for faster failure detection
heartbeat_interval_ms: 500
heartbeat_timeout_ms: 2000
max_heartbeat_failures: 2
connection_pooling: true
max_queue_size: 50000
tcp_keepalive: true
tcp_keepalive_ms: 10000
storage:
# PostgreSQL for distributed state
backend:
postgresql:
url: "postgresql://commy_user:secure_password@10.0.2.10:5432/commy_cluster"
max_connections: 20
persist_cluster_state: true
metadata_dir: "/var/lib/commy/cluster"
enable_snapshots: true
snapshot_interval_ms: 30000