本文将介绍单机运行thingsboard的方法
略
新建任意一个目录,这将影响之后的docker容器组的命名
vi docker-compose.yml
输入以下内容
version: '2.2'
services:
mytb:
restart: always
image: "thingsboard/tb-postgres"
ports:
- "9090:9090"
- "1883:1883"
- "7070:7070"
- "5683-5688:5683-5688/udp"
environment:
TB_QUEUE_TYPE: in-memory
volumes:
- ~/.mytb-data:/data
- ~/.mytb-logs:/var/log/thingsboard
mkdir -p ~/.mytb-data
sudo chown -R 799:799 ~/.mytb-data
mkdir -p ~/.mytb-logs
sudo chown -R 799:799 ~/.mytb-logs
#按照官方文档报错,无法创建数据库,执行一下两条命令后解决
chmod -R 777 ~/.mytb-data
chmod -R 777 ~/.mytb-logs
docker-compose pull
docker-compose up -d
如果不用yml配置文件,则直接用docker命令启动容器
docker run -it -p 9090:9090 -p 1883:1883 -p 7070:7070 -p 5683-5688:5683-5688/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-postgres
等待容器内的日志出现如下成功:
stdout: done
stdout: server started
stdout: Postgresql is ready
stdout: Starting ThingsBoard ...
stdout: ______ __ _ ____ __
stdout: /_ __/ / /_ (_) ____ ____ _ _____ / __ ) ____ ____ _ _____ ____/ /
stdout: / / / __ \ / / / __ \ / __ `/ / ___/ / __ | / __ \ / __ `/ / ___/ / __ /
stdout: / / / / / / / / / / / / / /_/ / (__ ) / /_/ / / /_/ // /_/ / / / / /_/ /
stdout: /_/ /_/ /_/ /_/ /_/ /_/ \__, / /____/ /_____/ \____/ \__,_/ /_/ \__,_/
stdout: /____/
stdout:
stdout: ===================================================
stdout: :: ThingsBoard :: (v3.6.1)
stdout: ===================================================
网页打开:
http://localhost:9090
可用的登录账号
Systen Administrator: sysadmin@thingsboard.org / sysadmin
Tenant Administrator: tenant@thingsboard.org / tenant
Customer User: customer@thingsboard.org / customer
重新挂上docker终端,查看日志
docker attach mytb
启动容器
docker stop mytb
重启容器
docker start mytb
docker pull thingsboard/tb-postgres
docker stop mytb
docker run -it -v ~/.mytb-data:/data --rm thingsboard/tb-postgres upgrade-tb.sh
docker rm mytb
docker run -it -p 9090:9090 -p 1883:1883 -p 7070:7070 -p 5683-5688:5683-5688/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-postgres
二进制文件强制升级安装
rpm -ivh --replacefiles --force --nodeps thingsboard.rpm