A Distributed Content-Addressable Database
- Immutability
- Scalability
- Fault-tolerance
- High availability
Node runs as a service to manage slices of the whole data collection. A cluster is composed with several nodes.
A command line tool to manage cluster.
$ git clone https://github.com/vechain/solidb.git
Golang tool chain is required to be installed. Also, glide is required for package management.
$ cd solidb
$ glide install
$ make install
You'll get solidb command in $GOPATH/bin.
$ solidb node
To get help for more options:
$ solidb node -h
$ solidb new path-of-master-dir
Master dir can be relative or absolute path. To specify number of redundant copies for the whole data collection, add option '—replicas n', where n must be >= 1, defaults to 2.
Enter master dir to perform further configurations.
$ cd path-of-master-dir.solidb
$ solidb add addr-of-node
$ solidb list
Remove first node in the list.
$ solidb remove 0
Addr or ID can also be specified as argument of remove command.
$ solidb alter 0 --addr new-addr --weight 2
Generate cluster config according to current draft, and send the config to all nodes.
$ solidb propose
The count of nodes in cluster should be >= replicas, or an error will be printed.
Tell all nodes in newest config to sync slices that are allocated.
$ solidb sync
$ solidb status
This command will display status of nodes in proposed config, e.g.
a97c…0ecc 192.168.31.182:3001 3,3,2 103/103
abe0…0a10 192.168.31.182:3002 3,3,2 103/103
a121…d57e 192.168.31.182:3003 3,3,2 102/102
1617…b42f 192.168.31.182:3004 3,3,2 102/102
34a5…d372 192.168.31.182:3005 3,3,2 102/102
column 0: ID of node column 1: address of node column 3: config revisions, newest/synced/approved column 4: synced slice count/total slice count
Once all nodes achieve 'synced' state, the 'approve' command can be sent to make newest config take effect.
$ solidb approve
We call blobs for data stored in solidb. The content type of blob is not cared about.
To store a blob:
$ curl -X POST -d "hello world" http://addr-of-one-node/blobs
{"key":"256c83b297114d201b30179f3f0ef0cace9783622da5974326b436178aeef6"}
to retrive it back:
$ curl http://addr-of-one-node/blobs/256c83b297114d201b30179f3f0ef0cace9783622da5974326b436178aeef6
hello world