solidb
solidb copied to clipboard
A Distributed Content-Addressable Database
SoliDB
A Distributed Content-Addressable Database
Features
- Immutability
- Scalability
- Fault-tolerance
- High availability
Components
Node
Node runs as a service to manage slices of the whole data collection. A cluster is composed with several nodes.
Master
A command line tool to manage cluster.
Quickstart
Get source code
$ git clone https://github.com/vechain/solidb.git
Compile & install
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.
Start a node
$ solidb node
To get help for more options:
$ solidb node -h
Maintain
Create a cluster
$ 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
Add node
$ solidb add addr-of-node
Display list of nodes
$ solidb list
Remove node
Remove first node in the list.
$ solidb remove 0
Addr or ID can also be specified as argument of remove command.
Alternate node
$ solidb alter 0 --addr new-addr --weight 2
Propose config
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.
Sync command
Tell all nodes in newest config to sync slices that are allocated.
$ solidb sync
Query status of nodes
$ 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
Approve config
Once all nodes achieve 'synced' state, the 'approve' command can be sent to make newest config take effect.
$ solidb approve
Access Blobs
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