Deploy a MemSQL Cluster min read

Now that your various object definition files are created, you will use kubectl to do the actual object creation and cluster deployment.

  1. Install the RBAC resources.

    kubectl create -f  rbac.yaml
  2. Install the MemSQL Cluster cluster resource definition.

    kubectl create -f memsql-cluster-crd.yaml
  3. Deploy the MemSQL Operator.

    kubectl create -f deployment.yaml
  4. Verify the deployment was successful by checking the status of the pods in your Kube cluster. You should see the MemSQL Operator with a status of Running.

    kubectl get pods
  5. Finally, create the MemSQL cluster.

    kubectl create -f memsql-cluster.yaml
  6. After a couple minutes, run kubectl get pods again to verify the aggregator and leaf nodes all started and have a status of Running.

    kubectl get pods

    If you see no pods are in the Running state, then run kubectl get statefulsets to see if the statefulsets are running. If you need to debug an inoperable cluster, check the Operator logs by running kubectl logs deployment memsql-operator and then look at the various objects to see what is failing.

Accessing your cluster

The MemSQL Operator creates two services intended for access by clients and database users:

  • One created service has “DML” in its name. Use the DML endpoint (load balancer amongst other aggregators) for read/write workloads.
  • The other created service has “DDL” in its name. Use the DDL endpoint for creating tables.

To connect to the MemSQL cluster, run the following from a machine that can access the Kubernetes cluster. Use the admin database user with the password you defined when creating the memsql-cluster.yaml definition file.

mysql -u admin -h <hostname> -P <port> -p<password>

Scaling and managing your cluster

Currently, the MemSQL Operator supports scaling and changing the following parts of the memsql-cluster.yaml file:

  • units
  • height
  • nodeImage
  • adminHashedPassword
  • license
  • redundancyLevel

Deleting your cluster

To delete the MemSQL cluster, run the following:

kubectl delete -f memsql-cluster.yaml