ScalarDB Cluster
ScalarDB Cluster is a distributed transaction state manager for ScalarDB. It consists of multiple cluster nodes that have ScalarDB capabilities and a routing mechanism.
Docker images
The docker images are available on our repository. Since they are available under a commercial license, you need to get the license and permission to access them. For more details, please contact us.
How to run ScalarDB Cluster on Kubernetes
This explains how to run ScalarDB Cluster on Kubernetes with an example. This example uses MySQL as an underlying database.
Supported Kubernetes versions
- 1.25.x, 1.24.x, 1.23.x, 1.22.x, 1.21.x
Create a Kubernetes configuration file
You can create a Kubernetes configuration file (scalardb-cluster.yaml) as follows:
#
# Service Account configurations. We need this because cluster nodes need to access the kubernetes endpoint API for membership
#
apiVersion: v1
kind: ServiceAccount
metadata:
name: scalardb-cluster
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: role-ep-read
namespace: default
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: scalardb-cluster-rolebinding
namespace: default
subjects:
- kind: ServiceAccount
name: scalardb-cluster
roleRef:
kind: Role
name: role-ep-read
apiGroup: rbac.authorization.k8s.io
---
#
# For ScalarDB Cluster
#
apiVersion: apps/v1
kind: Deployment
metadata:
name: scalardb-cluster-node
labels:
app: scalardb-cluster-node
spec:
replicas: 3
selector:
matchLabels:
app: scalardb-cluster-node
template:
metadata:
labels:
app: scalardb-cluster-node
spec:
containers:
- name: scalardb-cluster-node
image: ghcr.io/scalar-labs/scalardb-cluster-node:3.8.0
env:
- name: SCALAR_DB_STORAGE
value: "jdbc"
- name: SCALAR_DB_CONTACT_POINTS
value: "jdbc:mysql://<mysql host>:3306/"
- name: SCALAR_DB_USERNAME
value: "<mysql user>"
- name: SCALAR_DB_PASSWORD
value: "<mysql password>"
- name: SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAMESPACE_NAME
value: "default"
- name: SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAME
value: "scalardb-cluster"
livenessProbe:
exec:
command:
- /usr/local/bin/grpc_health_probe
- -addr=:60053
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
exec:
command:
- /usr/local/bin/grpc_health_probe
- -addr=:60053
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
serviceAccountName: scalardb-cluster
terminationGracePeriodSeconds: 90
---
apiVersion: v1
kind: Service
metadata:
name: scalardb-cluster
spec:
selector:
app: scalardb-cluster-node
type: LoadBalancer
ports:
- protocol: TCP
port: 60053
targetPort: 60053
---
apiVersion: v1
kind: Service
metadata:
name: scalardb-cluster-metrics
spec:
selector:
app: scalardb-cluster-node
ports:
- protocol: TCP
port: 9080
targetPort: 9080
---
apiVersion: v1
kind: Service
metadata:
name: scalardb-cluster-graphql
spec:
selector:
app: scalardb-cluster-node
type: LoadBalancer
ports:
- protocol: TCP
port: 8080
targetPort: 8080
Run ScalarDB Cluster
You can run ScalarDB Cluster with the following command:
kubectl apply -f scalardb-cluster.yaml
Client
The client libraries are available on Packages in this repository. Since they are available under a commercial license, you need to get the license and permission to access them. For more details, please contact us.
Before you add the dependency, you need to add the Maven repository using your build tool such as Gradle and Maven.
To add the Maven repository using Gradle, add the following repository to your build.gradle
:
repositories {
maven {
url = uri("https://maven.pkg.github.com/scalar-labs/scalardb-cluster")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}