Configure Core Dumps
On this page
A core dump can be generated for a single pod, or for all pods in the SingleStore cluster.
Enable Core Dumps
Core dumps can be enabled on individual pods, or across all pods.
Individual Pods
-
List all pods in the cluster.
kubectl get pods -l app.kubernetes.io/name=memsql-cluster,app.kubernetes.io/instance=<cluster-name> -
Confirm that a core dump will be produced upon crash.
kubectl exec <pod-name> -c node -- memsqlctl query --sql "SELECT @@core_file"+-------------+ | @@core_file | +-------------+ | 1 | +-------------+
The default value for
@@core_
isfile 1
, which indicates that creating a core dump on crash is enabled.If this value is 0
, creating a core dump on crash is disabled.To enable it, run the following command. kubectl exec <pod-name> -c node -- memsqlctl -y update-config --key core_file --value ONRestart the node for this change to take effect.
kubectl exec <pod-name> -c node -- memsqlctl -y restart-node -
Configure the core dump to be either partial or full.
By default, a partial core dump is created. Refer to the core_
engine variable for more information on partial and full core dumps.file_ mode Run the following command to check the current value.
kubectl exec node-<cluster-name>-master-0 -c node -- memsqlctl query --sql "SELECT @@core_file_mode"+------------------+ | @@core_file_mode | +------------------+ | PARTIAL | +------------------+
Run the following command to change this value.
For a partial core dump:
kubectl exec <pod-namne> -c node -- memsqlctl -y update-config --key core_file_mode --value PARTIALFor a full core dump:
kubectl exec <pod-name> -c node -- memsqlctl -y update-config --key core_file_mode --value FULLRestart the node for this change to take effect.
kubectl exec <pod-name> -c node -- memsqlctl -y restart-node
Across all Pods
-
To make the above core dump changes across all pods, add the following subsection to the sdb-cluster.
yaml file’s spec section. Refer to the core_
engine variable for more information on partial and full core dumps.file_ mode globalVariables:core_file: "ON"core_file_mode: "FULL" # or "PARTIAL", depending on your goal -
Apply these values to enable core dumps on all pods.
kubectl apply -f sdb-cluster.yaml
Generate Core Dumps
-
Display the pods and the nodes they are on.
Note that the following output may vary. kubectl get pods -l app.kubernetes.io/name=memsql-cluster,app.kubernetes.io/instance=<cluster-name> -o wideNAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES node-memsql-cluster-aggregator-0 2/2 Running 0 4h13m 10.4.0.20 gke-foo-1-default-pool-ed7b330b-2q1r <none> <none> node-memsql-cluster-leaf-ag1-0 2/2 Running 0 4h13m 10.4.3.10 gke-foo-1-default-pool-ed7b330b-w12w <none> <none> node-memsql-cluster-leaf-ag2-0 2/2 Running 0 4h13m 10.4.1.8 gke-foo-1-default-pool-ed7b330b-64r5 <none> <none> node-memsql-cluster-master-0 2/2 Running 0 4h13m 10.4.4.24 gke-foo-1-default-pool-ed7b330b-klnz <none> <none>
Using an SSH Connection
Note: These steps affect all core dump generation for processes on the nodes, not just SingleStore containers on the nodes.
-
For each node that contains the pods you want to generate a core dump for, SSH into the node and run the following command.
echo "core.%d" > /proc/sys/kernel/core_pattern
Using a DaemonSet
Note: These steps affect all core dump generation for processes on the nodes, not just SingleStore containers on the nodes.
-
Create a
sdb-coredump.
file using the following template.yaml apiVersion: apps/v1kind: DaemonSetmetadata:name: singlestore-sysreqlabels:"app.kubernetes.io/name": "singlestore-sysreq"spec:selector:matchLabels:"app.kubernetes.io/name": "singlestore-sysreq"updateStrategy:type: RollingUpdatetemplate:metadata:labels:"app.kubernetes.io/name": "singlestore-sysreq"spec:hostPID: truevolumes:- name: syshostPath:path: /sysaffinity:podAffinity:requiredDuringSchedulingIgnoredDuringExecution:- labelSelector:matchLabels:app.kubernetes.io/instance: CLUSTER_NAMEapp.kubernetes.io/name: memsql-cluster#Add this line if you only want to generate core for Master Aggregator#app.kubernetes.io/component: master#change master to aggregator or leaf if you only want to generate core#for child aggregator or for leaf#Add this line if you only want to generate core for one particular pod,#substitute POD_NAME with the name of the pod#statefulset.kubernetes.io/pod-name: POD_NAMEtopologyKey: kubernetes.io/hostnameinitContainers:- name: sysreqimage: busyboxsecurityContext:privileged: truevolumeMounts:- name: sysmountPath: /rootfs/syscommand:- "/bin/sh"- "-c"- |echo “core.%d” > /proc/sys/kernel/core_patterncontainers:- name: pauseimage: gcr.io/google_containers/pause -
Edit the following placeholders in this file:
-
Change
CLUSTER_
to the SingleStore cluster name.NAME -
To generate the core dump in a specific pod, change
POD_
to the desired pod.NAME
-
-
Enable the core dump(s) at the Kubernetes host level.
Note that you must have cluster admin privileges to run this command. kubectl apply -f sdb-coredump.yaml
Last modified: November 21, 2022