ScalarDB Server
ScalarDB Server is a gRPC server that implements ScalarDB interface. With ScalarDB Server, you can use ScalarDB features from multiple programming languages that are supported by gRPC.
Currently, we provide only a Java client officially, and we will support other language clients officially in the future. Of course, you can generate language-specific client stubs by yourself. However, note that it is not necessarily straightforward to implement a client since it's using a bidirectional streaming RPC in gRPC, and you need to be familiar with it.
This document explains how to install and use ScalarDB Server.
Install prerequisites
ScalarDB Server is written in Java. So one of the following Java Development Kits (JDKs) is required to run it:
- Oracle JDK LTS version (8, 11, 17, or 21)
- OpenJDK LTS version (8, 11, 17, or 21) from Eclipse Temurin, Amazon Corretto, or Microsoft
Install ScalarDB Server
We have Docker images in our repository and zip archives of ScalarDB Server available in releases.
If you are interested in building from source, run the following command:
$ ./gradlew installDist
Of course, you can archive the jar and libraries by ./gradlew distZip
and so on.
Configure ScalarDB Server
You need a property file holding the configuration for ScalarDB Server. It contains two sections: ScalarDB Server configurations and underlying storage/database configurations.
#
# ScalarDB Server configurations
#
# Port number of ScalarDB Server. 60051 by default
scalar.db.server.port=60051
# Prometheus exporter port. Use 8080 if this is not given. Prometheus exporter will not be started if a negative number is given.
scalar.db.server.prometheus_exporter_port=8080
# The maximum message size allowed to be received. If not specified, use the gRPC default value.
scalar.db.server.grpc.max_inbound_message_size=
# The maximum size of metadata allowed to be received. If not specified, use the gRPC default value.
scalar.db.server.grpc.max_inbound_metadata_size=
#
# Underlying storage/database configurations
#
# Comma separated contact points. For DynamoDB, the region is specified by this parameter.
scalar.db.contact_points=localhost
# Port number for all the contact points. Default port number for each database is used if empty.
#scalar.db.contact_port=
# Credential information to access the database. For Cosmos DB, username isn't used. For DynamoDB, AWS_ACCESS_KEY_ID is specified by the username and AWS_ACCESS_SECRET_KEY is specified by the password.
scalar.db.username=cassandra
scalar.db.password=cassandra
# Storage implementation. "cassandra" or "cosmos" or "dynamo" or "jdbc" or "grpc" can be set. Default storage is "cassandra".
scalar.db.storage=cassandra
# The type of the transaction manager. "consensus-commit" or "jdbc" or "grpc" can be set. The default is "consensus-commit".
scalar.db.transaction_manager=consensus-commit
# Isolation level used for ConsensusCommit. Either SNAPSHOT or SERIALIZABLE can be specified. SNAPSHOT is used by default.
scalar.db.consensus_commit.isolation_level=SNAPSHOT
# Serializable strategy used for ConsensusCommit transaction manager.
# Either EXTRA_READ or EXTRA_WRITE can be specified. EXTRA_READ is used by default.
# If SNAPSHOT is specified in the property "scalar.db.consensus_commit.isolation_level", this is ignored.
scalar.db.consensus_commit.serializable_strategy=
# This is only usable for Consensus Commit.
# If set to "true", Get and Scan operations results will contain transaction metadata. To see the transaction metadata columns details for a given table, you can use the `DistributedTransactionAdmin.getTableMetadata()`
# method which will return the table metadata augmented with the transaction metadata columns. Using this configuration can be useful to investigate transaction related issues.
# The default is false.
scalar.db.consensus_commit.include_metadata.enabled=false
Start ScalarDB Server
Docker images
For Docker images, you need to pull the ScalarDB Server image first:
$ docker pull ghcr.io/scalar-labs/scalardb-server:<version>
And then, you can start ScalarDB Server with the following command:
$ docker run -v <your local property file path>:/scalardb/server/database.properties.tmpl -d -p 60051:60051 -p 8080:8080 ghcr.io/scalar-labs/scalardb-server:<version>