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

    1. 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.

    2. Connect to Kubera (Optional) : Connecting the Kubernetes cluster to Kubera provides good visibility of storage resources. Kubera has various support options for enterprise customers.

    3. Configure cStor Pool

    4. Create Storage Class

      You must configure a StorageClass to provision cStor volume on given cStor pool. StorageClass is the interface through which most of the OpenEBS storage policies are defined. In this solution we are using a StorageClass to consume the cStor Pool which is created using external disks attached on the Nodes. Since NuoDB is a statefulset application, it requires only single storage replica. So cStor volume replicaCount is =1. Sample YAML named openebs-sc-disk.yaml to consume cStor pool with cStoveVolume Replica count as 1 is provided in the configuration details below.

    5. Download the YAML spec files from OpenEBS litmus repository.

    6. Edit the above YAML spec files and update them with correct StorageClass. For example, replace openebs-cstor-sparse with openebs-cstor-disk

    7. 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.

      1. kubectl apply -f nuodb.yaml -n testns
      2. kubectl apply -f nuodb-sm.yaml -n testns
      3. kubectl apply -f nuodb-te.yaml -n testns

    Reference at openebs.ci

    Deployment YAML spec files for NuoDB and OpenEBS resources are found

    OpenEBS-CI dashboard of NuoDB

    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. However, an alert can be setup for volume size threshold using Kubera.

    Monitor cStor Pool size

    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

    Configuration details

    openebs-config.yaml

    openebs-sc-disk.yaml

    1. apiVersion: storage.k8s.io/v1
    2. kind: StorageClass
    3. metadata:
    4. name: openebs-cstor-disk
    5. annotations:
    6. openebs.io/cas-type: cstor
    7. cas.openebs.io/config: |
    8. - name: StoragePoolClaim
    9. value: "cstor-disk"
    10. - name: ReplicaCount
    11. value: "1"
    12. provisioner: openebs.io/provisioner-iscsi
    13. reclaimPolicy: Delete

    nuodb.yaml

    nuodb-sm.yaml

    1. ---
    2. apiVersion: apps/v1beta1
    3. kind: StatefulSet
    4. metadata:
    5. name: sm
    6. labels:
    7. app: nuodb
    8. group: nuodb
    9. serviceName: sm
    10. replicas: 1
    11. selector:
    12. matchLabels:
    13. nodetype: sm
    14. database: nuodb
    15. app: sm
    16. group: nuodb
    17. podManagementPolicy: Parallel
    18. template:
    19. metadata:
    20. labels:
    21. nodetype: sm
    22. database: nuodb
    23. app: sm
    24. group: nuodb
    25. spec:
    26. securityContext:
    27. runAsUser: 0
    28. fsGroup: 0
    29. containers:
    30. - name: sm
    31. image: nuodb/nuodb-ce:latest
    32. imagePullPolicy: IfNotPresent
    33. args: [ "nuosm", "--servers-ready-timeout", "300" ]
    34. env:
    35. - name: NODE_NAME
    36. valueFrom:
    37. fieldPath: spec.nodeName
    38. - name: POD_NAME
    39. valueFrom:
    40. fieldPath: metadata.name
    41. - name: NAMESPACE
    42. valueFrom:
    43. fieldRef:
    44. fieldPath: metadata.namespace
    45. - { name: DB_NAME, value: "nuodb"}
    46. - { name: DB_USER, value: "dba"}
    47. - { name: DB_PASSWORD, value: "goalie"}
    48. - { name: NUOCMD_API_SERVER, value: "admin.testns.svc:8888"}
    49. - { name: PEER_ADDRESS, value: "admin.testns.svc" }
    50. - { name: NUODB_OPTIONS, value: "mem 1g" }
    51. ports:
    52. - containerPort: 48006
    53. protocol: TCP
    54. resources:
    55. requests:
    56. memory: "1Gi"
    57. cpu: "200m"
    58. terminationMessagePath: /dev/termination-log
    59. terminationMessagePolicy: File
    60. volumeMounts:
    61. - mountPath: /var/opt/nuodb/archive
    62. name: archive
    63. volumeClaimTemplates:
    64. - metadata:
    65. name: archive
    66. annotations:
    67. volume.beta.kubernetes.io/storage-class: openebs-cstor-sparse
    68. spec:
    69. accessModes: [ "ReadWriteOnce" ]
    70. resources:
    71. requests: