技术交流

学习资料

立即试用 商务报价
社区版
社区版 专业版 云服务 Edge Edge PE 网关 授权服务 Trendz分析 Mobile 应用程序 Mobile PE应用程序
安装 > 本地环境 > Ubuntu
入门 文档 指南
架构 API 常见问题

本页目录

Ubuntu安装

先决条件

本指南介绍了如何在Ubuntu Server 18.04/Ubuntu 20.04 LTS上安装ThingsBoard。
硬件要求取决于选择的数据库和连接到系统的设备数量。
需要一台1G内存的服务器运行ThingsBoard和PostgreSQL。
需要一台8G内存的服务器运行ThingsBoard和Cassandra。

步骤1. 安装Java 11(OpenJDK)

ThingsBoard服务运行在Java 11请按照以下说明安装OpenJDK 11:

1
2
sudo apt update
sudo apt install openjdk-11-jdk

使用以下命令设置默认版本是OpenJDK 11:

1
sudo update-alternatives --config java

可以使用以下命令检查安装:

1
java -version

命令输出结果:

1
2
3
openjdk version "11.0.xx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (build ...)

步骤2. 安装服务

下载安装包。

1
wget https://github.com/thingsboard/thingsboard/releases/download/v3.5.1/thingsboard-3.5.1.deb

安装服务

1
sudo dpkg -i thingsboard-3.5.1.deb

步骤3. 配置数据库

ThingsBoard能够使用SQL或hybrid数据库方式。
有关更多详细信息请参见相应的体系结构页面

ThingsBoard团队建议将PostgreSQL用于负载(<5000消息/秒)的开发和生产环境,使用公有云托管的PostgreSQL数据库服务对于某些ThingsBoard实例而言是一种经济高效的方式。

PostgreSQL安装

PostgreSQL安装说明

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# install **wget** if not already installed:
sudo apt install -y wget

# import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# add repository contents to your system:
RELEASE=$(lsb_release -cs)
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list

# install and launch the postgresql service:
sudo apt update
sudo apt -y install postgresql-12
sudo service postgresql start

创建一个新用户或为主用户设置密码

1
2
3
4
sudo su - postgres
psql
\password
\q

按“Ctrl+D”返回控制台并连接到数据库创建ThingsBoard数据库:

1
2
3
psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE thingsboard;
\q
PostgreSQL配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

将下面内容添加到配置文件中并替换“PUT_YOUR_POSTGRESQL_PASSWORD_HERE”为postgres帐户密码

1
2
3
4
5
6
7
# DB Configuration 
export DATABASE_TS_TYPE=sql
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
# Specify partitioning size for timestamp key-value storage. Allowed values: DAYS, MONTHS, YEARS, INDEFINITE.
export SQL_POSTGRES_TS_KV_PARTITIONING=MONTHS

ThingsBoard团队建议使用混合数据库的方式在你的生产中使用1M+设备或高频数据采集(>5000消息/秒)使用Cassandra存储时间序列数据而PostgreSQL用于主要实体(设备/资产/仪表板/客户)。

PostgreSQL安装

PostgreSQL安装说明

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# install **wget** if not already installed:
sudo apt install -y wget

# import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# add repository contents to your system:
RELEASE=$(lsb_release -cs)
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list

# install and launch the postgresql service:
sudo apt update
sudo apt -y install postgresql-12
sudo service postgresql start

创建一个新用户或为主用户设置密码

1
2
3
4
sudo su - postgres
psql
\password
\q

按“Ctrl+D”返回控制台并连接到数据库创建ThingsBoard数据库:

1
2
3
psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE thingsboard;
\q
Cassandra安装

Cassandra安装说明

1
2
3
4
5
6
7
8
# Add cassandra repository
echo "deb http://downloads.apache.org/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
sudo apt-get update
## Cassandra installation
sudo apt-get install cassandra
## Tools installation
sudo apt-get install cassandra-tools

可以使用Astra DB云代替自己安装的Cassandra See how to connect ThingsBoard to Astra DB

ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

将下面内容添加到配置文件中并替换“PUT_YOUR_POSTGRESQL_PASSWORD_HERE”为postgres帐户密码

1
2
3
4
5
# DB Configuration 
export DATABASE_TS_TYPE=cassandra
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE

将下面内容添加到配置文件中连接到Cassandra:

1
2
3
4
5
6
export CASSANDRA_CLUSTER_NAME=Thingsboard Cluster
export CASSANDRA_KEYSPACE_NAME=thingsboard
export CASSANDRA_URL=127.0.0.1:9042
export CASSANDRA_USE_CREDENTIALS=false
export CASSANDRA_USERNAME=
export CASSANDRA_PASSWORD=

ThingsBoard团队建议具有在生产环境使用TimescaleDB经验的公司使用Timescale数据库把时间序列数据存储在TimescaleDB Hypertable中并将PostgreSQL用于主要实体(设备/资产/仪表板/客户)。

PostgreSQL安装

PostgreSQL安装说明

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# install **wget** if not already installed:
sudo apt install -y wget

# import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# add repository contents to your system:
RELEASE=$(lsb_release -cs)
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list

# install and launch the postgresql service:
sudo apt update
sudo apt -y install postgresql-12
sudo service postgresql start

创建一个新用户或为主用户设置密码

1
2
3
4
sudo su - postgres
psql
\password
\q

按“Ctrl+D”返回控制台并连接到数据库创建ThingsBoard数据库:

1
2
3
psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE thingsboard;
\q
TimescaleDB安装

请参考Ubuntu发行版上的官方TimescaleDB安装页面并根据安装的PostgreSQL版本按照说明进行操作。

软件包安装后需要在ThingsBoard数据库中创建TimescaleDB扩展:

1
2
3
psql -U postgres -h localhost -d thingsboard
CREATE EXTENSION IF NOT EXISTS timescaledb;
\q
ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

将下面内容添加到配置文件中并替换“PUT_YOUR_POSTGRESQL_PASSWORD_HERE”为postgres帐户密码

1
2
3
4
5
6
7
# DB Configuration 
export DATABASE_TS_TYPE=timescale
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
# Specify Interval size for data chunks storage. Please note that this value can be set only once.
export SQL_TIMESCALE_CHUNK_TIME_INTERVAL=604800000 # Number of miliseconds. The current value corresponds to one week.

步骤4. 选择消息队列服务

ThingsBoard使用消息系统存储服务之间的通信,请正确选择队列?

  • 内存 适用于开发环境(开发)

  • Kafka 适用于生产环境(集群)

  • RabbitMQ 适用生产环境(单体)

  • AWS SQS 适用生产环境(AWS公有云)

  • Google发布/订阅 适用生产环境(Google公有云)

  • Azure服务总线 适用生产环境(Azure公有云)

  • Confluent云 适用于生产环境(托管)

参见相应的架构页面和规则引擎页面以获取更多详细信息。

默认使用内存队列无需其他配置。

Kafka安装

Apache Kafka是一个开源的流式数据处理平台。

ZooKeeper安装

Kafka基于ZooKeeper运行需要先安装 ZooKeeper 服务:

1
sudo apt-get install zookeeper
Kafka安装
1
2
3
4
5
wget https://archive.apache.org/dist/kafka/2.6.0/kafka_2.13-2.6.0.tgz

tar xzf kafka_2.13-2.6.0.tgz

sudo mv kafka_2.13-2.6.0 /usr/local/kafka
设置ZooKeeper启动服务

创建一个Zookeeper系统文件:

1
sudo nano /etc/systemd/system/zookeeper.service

Add below contnet:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Unit]
Description=Apache Zookeeper server
Documentation=http://zookeeper.apache.org
Requires=network.target remote-fs.target
After=network.target remote-fs.target

[Service]
Type=simple
ExecStart=/usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties
ExecStop=/usr/local/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal

[Install]
WantedBy=multi-user.target
设置Kafka启动服务

创建一个Kafka系统文件:

1
sudo nano /etc/systemd/system/kafka.service

添加以下内容替换系统的“PUT_YOUR_JAVA_PATH”为实际的JAVA_HOME路径默认路径是“/usr/lib/jvm/java-11-openjdk-xxx”:

1
2
3
4
5
6
7
8
9
10
11
12
13
[Unit]
Description=Apache Kafka Server
Documentation=http://kafka.apache.org/documentation.html
Requires=zookeeper.service

[Service]
Type=simple
Environment="JAVA_HOME=PUT_YOUR_JAVA_PATH"
ExecStart=/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties
ExecStop=/usr/local/kafka/bin/kafka-server-stop.sh

[Install]
WantedBy=multi-user.target
启动 ZooKeeper 和 Kafka:
1
2
3
sudo systemctl start zookeeper

sudo systemctl start kafka
ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

添加下面配置并将”localhost:9092”替换成真实的Kafka服务器地址:

1
2
export TB_QUEUE_TYPE=kafka
export TB_KAFKA_SERVERS=localhost:9092

Kafka安装

Apache Kafka是一个开源的流式数据处理平台。

Kafka安装

使用此说明在Docker容器中安装Kafka。

ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

添加下面配置并将”localhost:9092”替换成真实的Kafka服务器地址:

1
2
export TB_QUEUE_TYPE=kafka
export TB_KAFKA_SERVERS=localhost:9092

AWS SQS配置

首先需要创建AWS账户然后访问AWS SQS服务。

使用此说明创建AWS SQS服务凭证。

  • Access key ID
  • Secret access key
ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

添加配置将”YOUR_KEY”和”YOUR_SECRET”替换为真实的AWS用户凭证并将”YOUR_REGION”替换成AWS SQS帐户区域:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export TB_QUEUE_TYPE=aws-sqs
export TB_QUEUE_AWS_SQS_ACCESS_KEY_ID=YOUR_KEY
export TB_QUEUE_AWS_SQS_SECRET_ACCESS_KEY=YOUR_SECRET
export TB_QUEUE_AWS_SQS_REGION=YOUR_REGION

# These params affect the number of requests per second from each partitions per each queue.
# Number of requests to particular Message Queue is calculated based on the formula:
# ((Number of Rule Engine and Core Queues) * (Number of partitions per Queue) + (Number of transport queues)
#  + (Number of microservices) + (Number of JS executors)) * 1000 / POLL_INTERVAL_MS
# For example, number of requests based on default parameters is:

# Rule Engine queues:
# Main 10 partitions + HighPriority 10 partitions + SequentialByOriginator 10 partitions = 30
# Core queue 10 partitions
# Transport request Queue + response Queue = 2
# Rule Engine Transport notifications Queue + Core Transport notifications Queue = 2
# Total = 44
# Number of requests per second = 44 * 1000 / 25 = 1760 requests

# Based on the use case, you can compromise latency and decrease number of partitions/requests to the queue, if the message load is low.
# By UI set the parameters - interval (1000) and partitions (1) for Rule Engine queues.
# Sample parameters to fit into 10 requests per second on a "monolith" deployment: 

export TB_QUEUE_CORE_POLL_INTERVAL_MS=1000
export TB_QUEUE_CORE_PARTITIONS=2
export TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS=1000
export TB_QUEUE_VC_INTERVAL_MS=1000
export TB_QUEUE_VC_PARTITIONS=1

可以使用UI更新默认规则引擎队列配置(轮询间隔和分区)有关ThingsBoard规则引擎队列的更多信息请参阅文档

Google发布/订阅配置

创建一个Google帐户并访问发布/订阅服务。

使用此说明创建一个项目并使用发布/订阅服务。

使用此说明创建服务帐户凭据并编辑角色管理员后保存json凭据步骤9的文件此处

ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

添加下面配置内容使用真正用户密码替换“YOUR_PROJECT_ID”, “YOUR_SERVICE_ACCOUNT”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export TB_QUEUE_TYPE=pubsub
export TB_QUEUE_PUBSUB_PROJECT_ID=YOUR_PROJECT_ID
export TB_QUEUE_PUBSUB_SERVICE_ACCOUNT=YOUR_SERVICE_ACCOUNT

# These params affect the number of requests per second from each partitions per each queue.
# Number of requests to particular Message Queue is calculated based on the formula:
# ((Number of Rule Engine and Core Queues) * (Number of partitions per Queue) + (Number of transport queues)
#  + (Number of microservices) + (Number of JS executors)) * 1000 / POLL_INTERVAL_MS
# For example, number of requests based on default parameters is:

# Rule Engine queues:
# Main 10 partitions + HighPriority 10 partitions + SequentialByOriginator 10 partitions = 30
# Core queue 10 partitions
# Transport request Queue + response Queue = 2
# Rule Engine Transport notifications Queue + Core Transport notifications Queue = 2
# Total = 44
# Number of requests per second = 44 * 1000 / 25 = 1760 requests

# Based on the use case, you can compromise latency and decrease number of partitions/requests to the queue, if the message load is low.
# By UI set the parameters - interval (1000) and partitions (1) for Rule Engine queues.
# Sample parameters to fit into 10 requests per second on a "monolith" deployment: 

export TB_QUEUE_CORE_POLL_INTERVAL_MS=1000
export TB_QUEUE_CORE_PARTITIONS=2
export TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS=1000
export TB_QUEUE_VC_INTERVAL_MS=1000
export TB_QUEUE_VC_PARTITIONS=1

可以使用UI更新默认规则引擎队列配置(轮询间隔和分区)有关ThingsBoard规则引擎队列的更多信息请参阅文档

Azure服务总线配置

创建Azure帐户并访问Azure服务总线。

通过使用说明了解并使用总线服务。

使用说明创建共享访问签名。

ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

添加下面配置内容使用真正的服务总线名称空间替换”YOUR_NAMESPACE_NAME”和”YOUR_SAS_KEY_NAME”及”YOUR_SAS_KEY”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export TB_QUEUE_TYPE=service-bus
export TB_QUEUE_SERVICE_BUS_NAMESPACE_NAME=YOUR_NAMESPACE_NAME
export TB_QUEUE_SERVICE_BUS_SAS_KEY_NAME=YOUR_SAS_KEY_NAME
export TB_QUEUE_SERVICE_BUS_SAS_KEY=YOUR_SAS_KEY

# These params affect the number of requests per second from each partitions per each queue.
# Number of requests to particular Message Queue is calculated based on the formula:
# ((Number of Rule Engine and Core Queues) * (Number of partitions per Queue) + (Number of transport queues)
#  + (Number of microservices) + (Number of JS executors)) * 1000 / POLL_INTERVAL_MS
# For example, number of requests based on default parameters is:

# Rule Engine queues:
# Main 10 partitions + HighPriority 10 partitions + SequentialByOriginator 10 partitions = 30
# Core queue 10 partitions
# Transport request Queue + response Queue = 2
# Rule Engine Transport notifications Queue + Core Transport notifications Queue = 2
# Total = 44
# Number of requests per second = 44 * 1000 / 25 = 1760 requests

# Based on the use case, you can compromise latency and decrease number of partitions/requests to the queue, if the message load is low.
# By UI set the parameters - interval (1000) and partitions (1) for Rule Engine queues.
# Sample parameters to fit into 10 requests per second on a "monolith" deployment: 

export TB_QUEUE_CORE_POLL_INTERVAL_MS=1000
export TB_QUEUE_CORE_PARTITIONS=2
export TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS=1000
export TB_QUEUE_VC_INTERVAL_MS=1000
export TB_QUEUE_VC_PARTITIONS=1

可以使用UI更新默认规则引擎队列配置(轮询间隔和分区)有关ThingsBoard规则引擎队列的更多信息请参阅文档

RabbitMQ安装

你可以使用官方文档安装RabbitMQ或按照以下说明:

由于RabbitMQ是用Erlang编写的因此需要先安装Erlang才能使用RabbitMQ:

1
sudo apt-get install erlang

安装rabbitmq:

1
sudo apt-get install rabbitmq-server

启动服务

1
2
sudo systemctl start rabbitmq-server.service
sudo systemctl enable rabbitmq-server.service

RabbitMQ会默认创建一个名为”guest”的用户密码为”guest”。
你还可以使用以下命令在RabbitMQ服务器上创建自己的管理员帐户。
替换对应用户名和密码“PUT_YOUR_USER_NAME”和”PUT_YOUR_PASSWORD”:

1
2
3
sudo rabbitmqctl add_user PUT_YOUR_USER_NAME PUT_YOUR_PASSWORD 
sudo rabbitmqctl set_user_tags PUT_YOUR_USER_NAME administrator
sudo rabbitmqctl set_permissions -p / PUT_YOUR_USER_NAME ".*" ".*" ".*"
ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

将以下行添加到配置文件将“YOUR_USERNAME”和“YOUR_PASSWORD”替换为真实的信息将“localhost”和“5672”替换为真实的RabbitMQ主机和端口

1
2
3
4
5
export TB_QUEUE_TYPE=rabbitmq
export TB_QUEUE_RABBIT_MQ_USERNAME=YOUR_USERNAME
export TB_QUEUE_RABBIT_MQ_PASSWORD=YOUR_PASSWORD
export TB_QUEUE_RABBIT_MQ_HOST=localhost
export TB_QUEUE_RABBIT_MQ_PORT=5672

Confluent配置

你应该创建一个帐户后访问Confluent云然后创建一个Kafka集群API Key

ThingsBoard配置

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

添加下面配置内容使用真正的Confluent云服务器地址替换”CLUSTER_API_KEY”, “CLUSTER_API_SECRET”和”localhost:9092”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
export TB_QUEUE_TYPE=kafka
export TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD=true
export TB_KAFKA_SERVERS=localhost:9092
export TB_QUEUE_KAFKA_REPLICATION_FACTOR=3
export TB_QUEUE_KAFKA_CONFLUENT_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username="CLUSTER_API_KEY" password="CLUSTER_API_SECRET";}

# These params affect the number of requests per second from each partitions per each queue.
# Number of requests to particular Message Queue is calculated based on the formula:
# ((Number of Rule Engine and Core Queues) * (Number of partitions per Queue) + (Number of transport queues)
#  + (Number of microservices) + (Number of JS executors)) * 1000 / POLL_INTERVAL_MS
# For example, number of requests based on default parameters is:

# Rule Engine queues:
# Main 10 partitions + HighPriority 10 partitions + SequentialByOriginator 10 partitions = 30
# Core queue 10 partitions
# Transport request Queue + response Queue = 2
# Rule Engine Transport notifications Queue + Core Transport notifications Queue = 2
# Total = 44
# Number of requests per second = 44 * 1000 / 25 = 1760 requests

# Based on the use case, you can compromise latency and decrease number of partitions/requests to the queue, if the message load is low.
# By UI set the parameters - interval (1000) and partitions (1) for Rule Engine queues.
# Sample parameters to fit into 10 requests per second on a "monolith" deployment: 

export TB_QUEUE_CORE_POLL_INTERVAL_MS=1000
export TB_QUEUE_CORE_PARTITIONS=2
export TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS=1000
export TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS=1000
export TB_QUEUE_VC_INTERVAL_MS=1000
export TB_QUEUE_VC_PARTITIONS=1

可以使用UI更新默认规则引擎队列配置(轮询间隔和分区)有关ThingsBoard规则引擎队列的更多信息请参阅文档

步骤5. [可选]低性能配置(1GB内存)

编辑配置文件

1
sudo nano /etc/thingsboard/conf/thingsboard.conf

将以下行添加到配置文件

1
2
# Update ThingsBoard memory usage and restrict it to 256MB in /etc/thingsboard/conf/thingsboard.conf
export JAVA_OPTS="$JAVA_OPTS -Xms256M -Xmx256M"

步骤6. 运行安装脚本

执行以下脚本安装ThingsBoard服务并初始化演示数据:

1
2
# --loadDemo option will load demo data: users, devices, assets, rules, widgets.
sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo

步骤7. 启动服务

执行以下命令以启动ThingsBoard:

1
sudo service thingsboard start

启动后使用以下链接打开Web UI:

1
http://localhost:8080/

如果在安装脚本的执行过程中指定了-loadDemo则可以使用以下默认帐号:

  • System Administrator: sysadmin@thingsboard.org / sysadmin
  • Tenant Administrator: tenant@thingsboard.org / tenant
  • Customer User: customer@thingsboard.org / customer

可以在帐户详情页面中更改每个帐户的密码。

如果是1-2核CPU或1-2G内存的计算机请等待90秒后启动界面。

安装完成并配置

配置HAProxy启用HTTPS

可能要使用HAProxy配置HTTPS访问。
如果在云端托管ThingsBoard并为实例分配了有效的DNS名称则这样做。
请按照此指南安装HAProxy并使用密钥生成的有效SSL证书。

故障排查

ThingsBoard日志存储在以下目录中:

1
/var/log/thingsboard

执行如下命令检查后面是否有错误:

1
cat /var/log/thingsboard/thingsboard.log | grep ERROR

下一步

  • 入门指南 - 快速学习ThingsBoard相关功能。

  • 连接设备 - 学习如何根据你的连接方式或解决方案连接设备。

  • 可 视 化 - 学习如何配置复杂的ThingsBoard仪表板说明。

  • 数据处理 - 学习如何使用ThingsBoard规则引擎。

  • 数据分析 - 学习如何使用规则引擎执行基本的分析任务。

  • 硬件样品 - 学习如何将各种硬件平台连接到ThingsBoard。

  • 高级功能 - 学习高级ThingsBoard功能。

  • 开发指南 - 学习ThingsBoard中的贡献和开发。