Table of contents
1. Install Docker on Linux system
2. Docker install and run tb-gateway
3. Modify the config configuration file
Because database ODBC data is required to be uploaded, I chose to deploy it separately in a docker container on the remote server. The principle is roughly as follows:
Compiling and installing according to the instructions given on the official website is not enough. The pitfalls inside need to be stepped on one by one.
1. Install Docker on Linux system
The detailed installation tutorial will not be described in detail here. There is a related blog that writes in detail: Complete Tutorial on Installing Docker on Linux
If you find it slow to download and install Linux, you can also download it manually. The officially recommended docker is: Install Docker CE
The installation is complete, you can verify whether the installation is successful:
Then there is an important point to note:
Prerequisites for odbc: 1. Install Python in docker, at least version 3.8.0 or above is required, which is a necessary environment for later running gateway; 2. Install the ODBC package; 3. Install the ODBC driver (docker installation and running tb-gateway Do this step later)
1.docker install Python
#如果装过python的话,就不用执行安装python的命令了
sudo apt install python3-pip
sudo apt install python3-dev
2. Install the ODBC package
sudo apt install unixodbc-dev
pip3 install --user pyodbc
2. Docker install and run tb-gateway
Execute the following command:
docker run -it -v /tb-gateway/logs:/thingsboard_gateway/logs -v /tb-gateway/extensions:/thingsboard_gateway/extensions -v /tb-gateway/config:/thingsboard_gateway/config --name tb-gateway --restart always thingsboard/tb-gateway
Instruction description:
docker run
- Run the container-it
- Connect terminal session with gateway process output-v /tb-gateway/config:thingsboard-gateway/config
- Mount the host directoryconfig
to the gateway configuration directory-v /tb-gateway/extensions:thingsboard_gateway/extensions
- Mount the host directoryextensions
to the gateway extension directory-v /tb-gateway/logs:/thingsboard-gateway
/logs
- Mount the host directorylogs
to the gateway log directory--name tb-gateway
- The alias of the gateway on this machine--restart always
- Automatically launch ThingsBoard after system restart or failure.thingsboard/tb-gateway
- docker image
After successful installation, it will automatically start running:
3. Modify the config configuration file
Because editing files in Linux is troublesome, I recommend using WinScp, which can directly SFTP files to edit documents under the win system.
The configuration process is the same as the TB-Gateway ODBC data upload (4) of ThingsBoard 3.1.1 running locally in the window .
4. Install ODBC driver
apt-get install libmyodbc
When installing libmyodbc, an error will usually be reported:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libmyodbc is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libmyodbc' has no installation candidate
So you need to download it manually, download address: MySQL:: Download Connector/ODBC
After downloading, put the DEB package in the designated folder of linux and mount it to docker. I put it in extensions
the folder.
Then execute the command:
dpkg -i mysql-connector-odbc_8.0.20-1ubuntu18.04_amd64.deb
5. Restart docker
Successfully run |: Connected to the remote database, odbc data uploaded.
If there’s anything you don’t understand, you can just leave a comment below!