Viewing ERRORLOG files in SQL Server Big Data Cluster

Recently I was deploying a SQL Server 2019 Big Data Cluster for a client. I was having an issue, and I wanted to look at some of the logs within the BDC

platform, but aren’t in the ERRORLOG in SQL Server. So this meant doing something that you aren’t supposed to have to do, I need to be able to get onto the BDC cluster and log into the container so that I could look at the raw log files.

Once I got the commands straight to do this, it was pretty straight forward, and it didn’t require installing anything on the containers, or the cluster itself.

The first thing you need to do is to set up kubectl so that it’ll talk to your aks cluster (I’m assuming that you are using an Azure-hosted Kubernetes environment. This is done with the az aks command as shown below.

az aks get-credentials --name aks-cluster --resource-group aks-resource-group

Once kubectl knows how to talk and auth to your aks cluster, you need to ask kubectl what pods you have hosted on your aks cluster. In this example, my pods are all within the namespace bdc. If we don’t remember the name of our namespace, we can ask the aks platform using the get namespace command.

kubectl get namespace

Once we have the namespace (or if we remember it) we can get a list of the pods we have using the get pods command.

kubectl get pods --namespace bdc

Once we have the list of pods we can figure out which one we want to connect to. It this case we want to connect to the head of our BDC so we want to connect to “master-0”. But because there are three instances of the pod running (that’s what the 3/3 means) we need to know which of those three we want to connect to. That requires running get pods again, but with a few new parameters, like so.

kubectl get pods master-0 -o jsonpath='{.spec.containers[*].name}' --namespace bdc

This will output a basic list like this.

mssql-server collectd fluentbit

From here we want to shell into the container and we can do that by listing the pod of “master-0”, the container of “mssql-server” (which is the one we want to connect to) and the namespace of “bdc”.

kubectl exec -t -i master-0 -c mssql-server --namespace bdc bash

This will give you a command prompt on the container where you can do whatever Linux commands you want to run.

root@master-0:/#

If you know the name of the command that you want, you can replace “bash” with something else and it’ll run on the container and give you back the results.

Once connected to the server you can navigate to the location of the log files (/var/opt/mssql/log) and view the various log files that are available.

SQL Server Big Data Cluster requires a good amount of planning in order to have a successful deployment. The team at Denny Cherry & Associates Consulting would love to help you plan and deploy SQL Server Big Data Cluster with you. Contact the team and we’ll get the process started.

Denny

Share

Trust DCAC with your data

Your data systems may be treading water today, but are they prepared for the next phase of your business growth?