Network layer #
Two independent networks exist, and they solve different problems. Confusing them is the most common architectural mistake when reading about IceFireDB.
| Intra-site network | Inter-site network | |
|---|---|---|
| Purpose | One consistent copy of the data | Replicate across sites / regions |
| Technology | Raft (hashicorp/raft) | libp2p + pubsub (crdt, ipfs-log, ipfs-synckv drivers) |
| Topology | Leader + voters, quorum required | Peer-to-peer, no leader, eventual |
| Configured by | -a, -j, --advertise, --raft-backend, --auth, TLS | --servicename, --nettopic, --datatopic |
| Enabled by | Always | Only with a P2P storage backend |
A common deployment runs a Raft cluster per site (strong consistency inside), with one node per site using a P2P backend to exchange data between sites (eventual consistency across). The engine does not combine the two for you — they are separate layers, and the P2P layer is a property of the driver, not of the server.
Intra-site: Raft #
- Each node listens on exactly one socket. Peer connections identify themselves with a transport marker plus the auth token, so replication traffic and client traffic share the port and the TLS certificate.
- The Raft log and stable store live in
<data-dir>/IceFireDB/<node-id>/store/, inleveldb(default) orbolt(--raft-backend). --advertisesets the address other nodes store for this node. Without it, the bound address is used, which is wrong behind NAT or in containers.- Joining:
-j <addr>(the node adds itself) orRAFT SERVER ADD id addressfrom the leader. - Snapshots: taken by the Raft layer, written to
snapshots/<id>/state.binviawriteSnapshot; the log is truncated behind them. - Clock: Raft drives the machine clock through the internal replicated
TICKcommand (default every 200 ms) so that time-dependent commands agree across replicas.--localtimereplaces the remote time source with the local one, which is faster and riskier.
Inter-site: P2P drivers #
The crdt, ipfs-log and ipfs-synckv drivers open a libp2p host as part of the storage layer:
| Driver | Discovery / transport | Data model | Identity |
|---|---|---|---|
crdt | libp2p DHT + pubsub, namespaced | icefiredb-crdt-kv CRDT map over a local Badger/LevelDB | --servicename + --nettopic |
ipfs-log | IPFS pubsub + icefiredb-ipfs-log | Append-only operation log, merged per peer | --ipfs-log-dbname |
ipfs-synckv | IPFS node + ipfs-log, optional AES-256 | Versioned KV, IPFS as source of truth, local mirror | --ipfs-synckv-key for encryption |
Operational consequences:
- All three flags must match across the nodes that should see each other.
--servicename,--nettopicand--datatopicare the rendezvous: a mismatch silently creates two independent networks rather than an error. - No quorum, no leader. Writes succeed locally and propagate when peers connect; a partitioned peer keeps accepting writes and merges on rejoin (CRDT semantics), which is a very different contract from the Raft layer above.
- IPFS must be reachable at
--ipfs-endpoint(http://localhost:5001, the API port) foripfs,ipfs-synckvandipfs-log. A gateway on:8080is not an API endpoint. - Peers are trusted at the network level. The mesh relies on the shared discovery names; there is no per-peer authorization. See Security.
Ports in a typical deployment #
| Port | Protocol | Purpose |
|---|---|---|
11001 | RESP / TLS | Clients and Raft peers (single socket) |
11002 | HTTP | /healthz, /readyz, /metrics (--metrics) |
26063 | HTTP | pprof (--pprof) |
5001 | HTTP API | IPFS daemon, reachable from the node (not exposed by it) |
| random | libp2p | P2P driver connections, egress + ephemeral inbound |
What the network layer does not do #
- No service mesh integration, no gossip-based membership beyond libp2p discovery.
- No cross-site consistency guarantee: the P2P layer is eventual, the Raft layer is per-cluster.
- No multi-cluster federation: two Raft clusters do not merge automatically.