Replicator
With a publisher-subscriber setup, a node subscribes to updates broadcasted by other nodes. It is the recipients who decide to be part of the community and keep in sync with the collection's shared state.
With a replicator peering, a node sends updates for a selected collection to another node. One node imposes its will onto another.
note
This page assumes you have (at least) two running instances of DefraDB (see Peer-to-peer setup).
Create a common collection
Both peers must know about the collection they are going to send/receive updates about. The collection must have the same fields across both peers.
Create the "User" collection on Node1
defradb client collection add '
type User {
name: String
age: Int
verified: Boolean
points: Float
}
' --url localhost:9181
Create the "User" collection on Node2
defradb client collection add '
type User {
name: String
age: Int
verified: Boolean
points: Float
}
' --url localhost:9182