CanoDB is a distributed key-value database. It provides TCP client and server, expanding the goLevelDB database.
- Implemented by pure Go, lightweight and fast.
- Based on gRPC protocol, supports SSL/TLS encryption.
- The environmental requirement is at least
Go 1.22
. Protocol buffer v3
andGo plugins for the protocol compiler
is necessary. Please refer to the official documentation for detailed information.
The client part is introduced into the code through go import
. The server part is compiled and run in binary form or Docker image form.
Download client package:
go get github.com/lindsuen/canodb/client
Import client package and connect to a database:
import "github.com/lindsuen/canodb/client"
// ...
// The default port of CanoDB server is 4644.
db, err := client.Connect("127.0.0.1:4644")
// ...
defer db.Close()
// ...
Read or modify the database content:
// ...
err := db.Put([]byte("key"), []byte("value"))
// ...
err = db.Delete([]byte("key"))
// ...
value, err = db.Get([]byte("key"))
// ...
Place the downloaded or compiled binary file canodb
in the corresponding directory, and then execute:
./canodb
It is recommended to build on the Debian or Ubuntu operating system. The make
tool is necessary, and you can install it through the command apt install -y build-essential
.
cd canodb/ && go build -o bin/canodb -ldflags "-s -w" .
cd canodb/ && make build
docker build --no-cache -t canodb/canodb-server:latest .
- Synchronize data in the cluster by gRPC protocol.
BSD-2-Clause license