Data Replication and partitions in Badger


We are planning to use Go as programming lang and Badger as data store for Profile Data . It would be helpful to get some pointers to Replications and partitioning of data in Badger based on id .


Badger is an embedded DB. It does NOT do replication or partitioning of data. That’s something you’d have to do at your end.

Hi Manish,

Thanks a lot for replying .

Understood . I was wondering to get some ideas or pointers how dgraph is using synchronous replication and key Distribution .

Sorry for dumb questions .:slight_smile:


There’s slightly outdated information here:

Hi Manish,

Thanks for response .

Can you please help with following points in badgerdb source code . (if code pointers that will be great)

  1. write ahead logs
  2. Write path for key and value

Thanks and Regards

Badger has a value log which also acts as a WAL, here is the code that writes to that badger/value.go at master · dgraph-io/badger · GitHub. This is also the code which writes values.

The code for writing the keys is at badger/db.go at master · dgraph-io/badger · GitHub

Hi, is there any document about how Dgraph achieves replication over embedded badger db? The document shared above looks a bit old.

We use raft for replicating the data across the node.

You can have a look this etcd package for raft. etcd/raft at master · etcd-io/etcd · GitHub