OpenEBS for NuoDB
NuoDB’s distributed SQL database combines the elastic scale and continuous availability of the cloud with the transactional consistency and durability that databases of record demand. NuoDB is deployed usually as a on Kubernetes and requires persistent storage for each instance of NuoDB StorageManager instance. OpenEBS provides persistent volumes on the fly when StorageManagers are scaled up.
Advantages of using OpenEBS for NuoDB database:
- No need to manage the local disks, they are managed by OpenEBS
- Large size PVs can be provisioned by OpenEBS and NuoDB
- Start with small storage and add disks as needed on the fly. Sometimes NuoDB instances are scaled up because of capacity on the nodes. With OpenEBS persistent volumes, capacity can be thin provisioned and disks can be added to OpenEBS on the fly without disruption of service
- If required, take backup of the NuoDB data periodically and back them up to S3 or any object storage so that restoration of the same data is possible to the same or any other Kubernetes cluster
Note: NuoDB can be deployed both as deployment
or as statefulset
. When NuoDB deployed as statefulset
, you don’t need to replicate the data again at OpenEBS level. When NuoDB is deployed as deployment
, consider 3 OpenEBS replicas, choose the StorageClass accordingly.
Deployment model
Install OpenEBS
If OpenEBS is not installed in your K8s cluster, this can done from . If OpenEBS is already installed, go to the next step.
Configure cStor Pool
After OpenEBS installation, cStor pool has to be configured. If cStor Pool is not configured in your OpenEBS cluster, this can be done from here. Sample YAML named openebs-config.yaml for configuring cStor Pool is provided in the Configuration details below. During cStor Pool creation, make sure that the maxPools parameter is set to >=3. If cStor pool is already configured, go to the next step.
Create Storage Class
Download the YAML spec files from OpenEBS litmus repository.
Edit the above YAML spec files and update them with correct StorageClass. For example, replace
openebs-cstor-sparse
withopenebs-cstor-disk
Launch and test NuoDB
Create a namespace called testns and apply following YAML files to deploy NuoDB application. Sample YAML files are provided in the Configuration details below.
kubectl apply -f nuodb.yaml -n testns
kubectl apply -f nuodb-sm.yaml -n testns
kubectl apply -f nuodb-te.yaml -n testns
Reference at openebs.ci
Deployment YAML spec files for NuoDB and OpenEBS resources are found
Monitor OpenEBS Volume size
It is not seamless to increase the cStor volume size (refer to the roadmap item). Hence, it is recommended that sufficient size is allocated during the initial configuration.
As in most cases, cStor pool may not be dedicated to just NuoDB database alone. It is recommended to watch the pool capacity and add more disks to the pool before it hits 80% threshold. See cStorPool metrics
Configuration details
openebs-config.yaml
openebs-sc-disk.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: openebs-cstor-disk
annotations:
openebs.io/cas-type: cstor
cas.openebs.io/config: |
- name: StoragePoolClaim
value: "cstor-disk"
- name: ReplicaCount
value: "1"
provisioner: openebs.io/provisioner-iscsi
reclaimPolicy: Delete
nuodb.yaml
nuodb-sm.yaml
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: sm
labels:
app: nuodb
group: nuodb
serviceName: sm
replicas: 1
selector:
matchLabels:
nodetype: sm
database: nuodb
app: sm
group: nuodb
podManagementPolicy: Parallel
template:
metadata:
labels:
nodetype: sm
database: nuodb
app: sm
group: nuodb
spec:
securityContext:
runAsUser: 0
fsGroup: 0
containers:
- name: sm
image: nuodb/nuodb-ce:latest
imagePullPolicy: IfNotPresent
args: [ "nuosm", "--servers-ready-timeout", "300" ]
env:
- name: NODE_NAME
valueFrom:
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- { name: DB_NAME, value: "nuodb"}
- { name: DB_USER, value: "dba"}
- { name: DB_PASSWORD, value: "goalie"}
- { name: NUOCMD_API_SERVER, value: "admin.testns.svc:8888"}
- { name: PEER_ADDRESS, value: "admin.testns.svc" }
- { name: NUODB_OPTIONS, value: "mem 1g" }
ports:
- containerPort: 48006
protocol: TCP
resources:
requests:
memory: "1Gi"
cpu: "200m"
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/opt/nuodb/archive
name: archive
volumeClaimTemplates:
- metadata:
name: archive
annotations:
volume.beta.kubernetes.io/storage-class: openebs-cstor-sparse
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
nuodb-te.yaml
Feedback
Was this page helpful?
YesNo
Thanks for the feedback. Open an issue in the if you want to report a problem or suggest an improvement. Engage and get additional help on https://kubernetes.slack.com/messages/openebs/.