How to debug InfluxDB remotely using Visual Studio Code

InfluxDB is implemented in Go language. So, we need build and debug tools in Go language.

1. Prerequisites

Version of InfluxDB: InfluxDB 2.0

Target Machine: CentOS7

Host Machine: Windows10

2. Preparation in taget machine

Perform the follwing steps in target machine

(1) Install gvm(go version manager)

bash < <(curl -s -S -L

(2) Install build tools for Go language

gvm install go1.15
gvm use go1.15 --default

(3) Install Git

yum -y install
yum -y install git --enablerepo=ius --disablerepo=base,epel,extras,updates

(4) Install Bazaar which is a version control system

yum -y install bzr

(5) Install nodejs

yum install

(6) Install yarn which is a package manager for nodejs

yum install yarn

(7) Install build tools for Rust language

curl -sSf | sh
source ~/.cargo/env

(8) Install clang which is a C language compiler

yum install clang
yum install llvm-devel
export LLVM_CONFIG_PATH=/bin/llvm-config
export LIBCLANG_PATH=/usr/lib64/llvm

(9) Download the source code of InfluxDB. Hereinafter, we call <src> the directory in which you download source codes of InfluxDB.

Download link:

3. Preparation in host machine

Install Visual Studio Code and enable remote debugging using vscode-go. For these steps, Refet to 6.(2) and so on.

4. Building InfluxDB

(1) Change directory to <src>

(2) Change “GO_BUILD_ARGS” in ./MakeFile for debugging




GO_BUILD_ARGS := -tags ‘$(GO_BUILD_TAGS)’ -gcflags=all=’-N -l’

(3) Build with make command


5. Debugging

Perform the following steps in Visual Studio Code for debugging influxd which is a backend process of InfluxDB.

(1) Connect to remote machine from host machine

(2) Select [Run]>[Add Configuration]>[Go launch file] and add the following configuration

    "version": "0.2.0",
    "configurations": [
            "name": "Launch file",
            "type": "go",
            "request": "launch",
            "mode": "exec",
            "program": "<src>/bin/linux/influxd"

(3) Create any break point on main function “<src>/influxdb-2.0/cmd/main.go”

(4) Press “F5” for starting debug

6. References

(1) Build InfluxDB 2.0 from source codes

(2) Debuging using vscode-go

Published by ktke109

I love open souce database management systems.