REPL Commands
BangDB works in three different ways:
- Embedded - BangDB is part of application process. On server or device
- Server - BangDB runs as a service and clients connect to it. User applications use client libs. This is Master - Slave model
- Distributed - BangDB runs as a p2p based cluster. There is no master or slave, and entire cluster is part of virtual network overlay Replication in this context is for option 2, when server runs in master slave model.
There is always a single master and there could be one or more slaves attached to it. All the writes (from clients) will happen on master and it will sync data with slaves.
Replication to the slaves happen in sync /async fashion based on setting and the replica (slaves) can be added at run time without bringing the master to halt and all operations on the server can continue while initial sync and replication is in progress.
Below are the list of all supported commands for replication on CLI
server repl state change command register master where server = ip:port
register slave where server = ip:port and master = ip:port
show servertype
show servertype where server = ip:port
Make a server running at ip:port as master
register master where server = 192.168.1.25:10101
Make a server running at ip:port as slave to a master running at some other ip:port
register slave where server = 192.168.1.26:10101 and master = 192.168.1.25:10101
See the type of the server [ Master or Salve ]
show servertype
Or
show servertype where server = 192.168.1.25:10101