thingsboard安装使用教程

1、安装tb-postgres

tb-postgres是ThingsBoard与PostgreSQL数据库的单实例。

拉取tb-postgres镜像

docker pull thingsboard/tb-postgres

创建tb-postgres容器

docker run -itd --name tb-postgres -p 9090:9090 -p 1883:1883 -p 5683:5683/udp -p 5685:5685/udp -p 5432:5432 -v ~/mytb-data:/data -v ~/mytb-logs:/var/log/thingsboard  --restart always thingsboard/tb-postgres

配置postgres远程连接

进入tb-postgres容器的/data/目录

修改pg_hba.conf

host	all		all		0.0.0.0/0		trust

修改postgresql.conf

listen_addresses = '*'

使用navicat连接postgresql数据库,数据库名和账号密码默认都是thingsboard

在浏览器中输入http://IP:9090,打开tb控制台

默认系统管理员账号 用户名:[email protected] 密码:sysadmin

默认租户管理员帐户: 用户名:[email protected] 密码:tenant

登录tb控制台,创建一个网关设备

复制网关设备的访问令牌,下面tb-gateway会用到。

2、安装tb-gateway

拉取tb-gateway镜像

docker pull thingsboard/tb-gateway

创建tb-gateway容器

docker run -itd --name tb-gateway -v ~/tb-gateway/logs:/var/log/thingsboard-gateway -v ~/tb-gateway/extensions:/var/lib/thingsboard_gateway/extensions -v ~/tb-gateway/config:/etc/thingsboard-gateway/config --restart always thingsboard/tb-gateway

进入/thingsboard-gateway/config目录

修改tb_gateway.yaml

thingsboard:
  host: 192.168.1.100
  port: 1883
  remoteShell: false
  remoteConfiguration: false
  statistics:
    enable: true
    statsSendPeriodInSeconds: 3600
    configuration: statistics.json
  maxPayloadSizeBytes: 1024
  minPackSendDelayMS: 0
  checkConnectorsConfigurationInSeconds: 60
  handleDeviceRenaming: true
  checkingDeviceActivity:
    checkDeviceInactivity: false
    inactivityTimeoutSeconds: 120
    inactivityCheckPeriodSeconds: 10
  security:
    accessToken: yKyniKO5CAtX8fsWn2p6
  qos: 1

修改配置文件中的host为tb-postgres的IP,修改accessToken为上面复制的访问令牌。

修改mqtt.json

​​​​​​​
​​​​​​​ 修改为mqtt-server的信息

猜你喜欢

转载自blog.csdn.net/watson2017/article/details/131228874