立即试用 商务报价
专业版
安装 > 本地环境 > Windows

本页目录

Installing ThingsBoard PE on Windows

请使用Linux安装选项因为它是运行ThingsBoard的最稳定的平台,Windows安装将在未来被弃用可以在安装指南页面上找到Linux安装指南

Prerequisites

This guide describes how to install ThingsBoard on a Windows machine. Instructions below are provided for Windows 10/8.1/8/7 32-bit/64-bit. Hardware requirements depend on chosen database and amount of devices connected to the system. To run ThingsBoard and PostgreSQL on a single machine you will need at least 2Gb of RAM. To run ThingsBoard and Cassandra on a single machine you will need at least 8Gb of RAM.

Step 1. Install Java 11 (OpenJDK)

ThingsBoard基于Java11运行按照以下说明安装OpenJDK 11。

  • 访问Open JDK页面下载最新的OpenJDK 11(LTS) MSI软件包
  • 运行下载的MSI软件包勾选”Add to PATH“和”Set JAVA_HOME variable“选项进行安装
  • 访问PostgreSQL JDBC页面下载驱动程序
  • 复制C:\Program Files\AdoptOpenJDK\jdk-11.0.10.9-hotspot\jre\lib\ext路径添加CLASSPATH变量值为“C:\Program Files\AdoptOpenJDK\jdk-11.0.10.9-hotspot\jre\lib\ext\postgresql-42.2.18.jar”
  • 如果jre路径不存在“C:\Program Files\AdoptOpenJDK\jdk-11.0.10.9-hotspot”请创建文件夹

可以使用以下命令(使用命令提示符)检查安装:

1
java -version

命令输出结果:

1
2
3
4
C:\Users\User>java -version
openjdk version "11.0.xx"
OpenJDK Runtime Environment (AdoptOpenJDK)(...)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(...)

Step 2. ThingsBoard service installation

Download and run the installation package.

1
https://dist.thingsboard.io/thingsboard-windows-setup-3.5.1pe.exe

Note: We assume you have installed ThingsBoard to default location: C:\Program Files (x86)\thingsboard

Step 3. Obtain and configure license key

We assume you have already chosen your subscription plan or decided to purchase a perpetual license. If not, please navigate to pricing page to select the best license option for your case and get your license. See How-to get pay-as-you-go subscription or How-to get perpetual license for more details.

Once you get the license secret, you should put it to the thingsboard configuration file.

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

Scroll to the bottom of the file and locate the following configuration block:

1
2
license:
    secret: "${TB_LICENSE_SECRET:}" # license secret obtained from ThingsBoard License Portal (https://license.thingsboard.io)

and put your license secret. See example below:

1
2
license:
    secret: "${TB_LICENSE_SECRET:YOUR_LICENSE_SECRET_HERE}" # license secret obtained from ThingsBoard License Portal (https://license.thingsboard.io)

Step 4. Configure ThingsBoard database

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

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

PostgreSQL安装

下载安装文件(PostgreSQL 11.7或更高版本)此处并按照安装说明进行操作。

在PostgreSQL安装时系统将提示您输入超级用户(postgres)密码。

请一定牢记此密码,为了方便记忆我们将密码替换为postgres。

创建ThingsBoard数据库

安装成功后启动”pgAdmin”并使用超级用户(postgres)身份登录。
打开服务器并用”postgres”用户创建数据库”thingsboard”。

ThingsBoard配置

如果已将PostgreSQL超级用户密码指定为”postgres”则可以跳过此步骤。

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标然后选择”以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

找到”SQL DAO Configuration”代码块将postgres用户密码替换”postgres”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# SQL DAO Configuration
spring:
  data:
    jpa:
      repositories:
        enabled: "true"
  jpa:
    open-in-view: "false"
    hibernate:
      ddl-auto: "none"
  datasource:
    driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}"
    url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/thingsboard}"
    username: "${SPRING_DATASOURCE_USERNAME:postgres}"
    password: "${SPRING_DATASOURCE_PASSWORD:YOUR_POSTGRES_PASSWORD_HERE}"
    hikari:
      maximumPoolSize: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:5}"

找到”SQL_POSTGRES_TS_KV_PARTITIONING”参数以覆盖时间戳键值存储分区大小的默认值:

1
2
3
4
    sql:
      postgres:
        # Specify partitioning size for timestamp key-value storage. Example: DAYS, MONTHS, YEARS, INDEFINITE.
        ts_key_value_partitioning: "${SQL_POSTGRES_TS_KV_PARTITIONING:MONTHS}"

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

PostgreSQL安装

下载安装文件(PostgreSQL 11.7或更高版本)此处并按照安装说明进行操作。

在PostgreSQL安装时系统将提示您输入超级用户(postgres)密码。

请一定牢记此密码,为了方便记忆我们将密码替换为postgres。

创建ThingsBoard数据库

安装成功后启动”pgAdmin”并使用超级用户(postgres)身份登录。
打开服务器并用”postgres”用户创建数据库”thingsboard”。

ThingsBoard配置

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标然后选择”以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

找到”SQL DAO Configuration”代码块将postgres用户密码替换”postgres”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# SQL DAO Configuration
spring:
  data:
    jpa:
      repositories:
        enabled: "true"
  jpa:
    open-in-view: "false"
    hibernate:
      ddl-auto: "none"
  datasource:
    driverClassName: "${SPRING_DRIVER_CLASS_NAME:org.postgresql.Driver}"
    url: "${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/thingsboard}"
    username: "${SPRING_DATASOURCE_USERNAME:postgres}"
    password: "${SPRING_DATASOURCE_PASSWORD:YOUR_POSTGRES_PASSWORD_HERE}"
    hikari:
      maximumPoolSize: "${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:5}"

找到”DATABASE_TS_TYPE”参数将”sql”替换为”timescale”。

1
2
3
4
      ts:
        type: "${DATABASE_TS_TYPE:sql}" # cassandra, sql, or timescale (for hybrid mode, DATABASE_TS_TYPE value should be cassandra, or timescale)
    
    # note: timescale works only with postgreSQL database for DATABASE_ENTITIES_TYPE.

可以选择调整引用Timescale DB配置的参数”sql”配置块中的”timescale”配置块。

1
2
3
4
5
# SQL configuration parameters
sql:
    timescale:
      # Specify Interval size for new data chunks storage.
      chunk_time_interval: "${SQL_TIMESCALE_CHUNK_TIME_INTERVAL:604800000}"

Step 5. Choose ThingsBoard queue service

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

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

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

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

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

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

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

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

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

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

Kafka安装

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

Kafka安装

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

ThingsBoard配置

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

and locate “queue:” block. Make sure the queue type is “kafka”, and don’t forget to replace “localhost:9092” with your real Kafka bootstrap servers:

1
2
3
4
5
6
7
8
9
10
11
queue:
  type: "${TB_QUEUE_TYPE:kafka}"
...
  kafka:
    bootstrap.servers: "${TB_KAFKA_SERVERS:localhost:9092}"
    acks: "${TB_KAFKA_ACKS:all}"
    retries: "${TB_KAFKA_RETRIES:1}"
    batch.size: "${TB_KAFKA_BATCH_SIZE:16384}"
    linger.ms: "${TB_KAFKA_LINGER_MS:1}"
    buffer.memory: "${TB_BUFFER_MEMORY:33554432}"
    replication_factor: "${TB_QUEUE_KAFKA_REPLICATION_FACTOR:1}"

AWS SQS配置

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

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

  • Access key ID
  • Secret access key
ThingsBoard配置

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

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

1
2
3
4
5
6
7
queue:
  type: "${TB_QUEUE_TYPE:aws-sqs}"
...
  aws_sqs:
    access_key_id: "${TB_QUEUE_AWS_SQS_ACCESS_KEY_ID:YOUR_KEY}"
    secret_access_key: "${TB_QUEUE_AWS_SQS_SECRET_ACCESS_KEY:YOUR_SECRET}"
    region: "${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 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
queue:
...
  transport_api:
    request_poll_interval: "${TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS:1000}"
    response_poll_interval: "${TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  core:
    poll-interval: "${TB_QUEUE_CORE_POLL_INTERVAL_MS:1000}"
    partitions: "${TB_QUEUE_CORE_PARTITIONS:2}"
...    
  vc:
    partitions: "${TB_QUEUE_VC_PARTITIONS:1}"
    poll-interval: "${TB_QUEUE_VC_INTERVAL_MS:1000}"
...
  js:
    response_poll_interval: "${REMOTE_JS_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  rule-engine:
    poll-interval: "${TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS:1000}"
...
  transport:
    poll_interval: "${TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:1000}"

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

Google发布/订阅配置

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

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

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

ThingsBoard配置

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

and locate “queue:” block. Make sure the queue type is “pubsub”, and don’t forget to replace “YOUR_PROJECT_ID”, “YOUR_SERVICE_ACCOUNT” with your real Pub/Sub project id, and service account (it is whole data from json file):

1
2
3
4
5
6
7
8
queue:
  type: "${TB_QUEUE_TYPE:pubsub}"
...
  pubsub:
    project_id: "${TB_QUEUE_PUBSUB_PROJECT_ID:YOUR_PROJECT_ID}"
    service_account: "${TB_QUEUE_PUBSUB_SERVICE_ACCOUNT:YOUR_SERVICE_ACCOUNT}"
    max_msg_size: "${TB_QUEUE_PUBSUB_MAX_MSG_SIZE:1048576}" #in bytes
    max_messages: "${TB_QUEUE_PUBSUB_MAX_MESSAGES:1000}"

These params affect the number of requests per second from each partitions per each queue.

Number of requests to particular Message Queue 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
queue:
...
  transport_api:
    request_poll_interval: "${TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS:1000}"
    response_poll_interval: "${TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  core:
    poll-interval: "${TB_QUEUE_CORE_POLL_INTERVAL_MS:1000}"
    partitions: "${TB_QUEUE_CORE_PARTITIONS:2}"
...
  vc:
    partitions: "${TB_QUEUE_VC_PARTITIONS:1}"
    poll-interval: "${TB_QUEUE_VC_INTERVAL_MS:1000}"
...
  js:
    response_poll_interval: "${REMOTE_JS_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  rule-engine:
    poll-interval: "${TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS:1000}"
...
  transport:
    poll_interval: "${TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:1000}"

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

Azure服务总线配置

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

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

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

ThingsBoard配置

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

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

1
2
3
4
5
6
7
8
queue:
  type: "${TB_QUEUE_TYPE:service-bus}"
...
  service_bus:
    namespace_name: "${TB_QUEUE_SERVICE_BUS_NAMESPACE_NAME:YOUR_NAMESPACE_NAME}"
    sas_key_name: "${TB_QUEUE_SERVICE_BUS_SAS_KEY_NAME:YOUR_SAS_KEY_NAME}"
    sas_key: "${TB_QUEUE_SERVICE_BUS_SAS_KEY:YOUR_SAS_KEY}"
    max_messages: "${TB_QUEUE_SERVICE_BUS_MAX_MESSAGES:1000}"

These params affect the number of requests per second from each partitions per each queue.

Number of requests to particular Message Queue 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
queue:
...
  transport_api:
    request_poll_interval: "${TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS:1000}"
    response_poll_interval: "${TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  core:
    poll-interval: "${TB_QUEUE_CORE_POLL_INTERVAL_MS:1000}"
    partitions: "${TB_QUEUE_CORE_PARTITIONS:2}"
...
  vc:
    partitions: "${TB_QUEUE_VC_PARTITIONS:1}"
    poll-interval: "${TB_QUEUE_VC_INTERVAL_MS:1000}"
...
  js:
    response_poll_interval: "${REMOTE_JS_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  rule-engine:
    poll-interval: "${TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS:1000}"
...
  transport:
    poll_interval: "${TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:1000}"

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

RabbitMQ安装

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

ThingsBoard配置

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
queue:
  type: "${TB_QUEUE_TYPE:rabbitmq}"
...
  rabbitmq:
    exchange_name: "${TB_QUEUE_RABBIT_MQ_EXCHANGE_NAME:}"
    host: "${TB_QUEUE_RABBIT_MQ_HOST:localhost}"
    port: "${TB_QUEUE_RABBIT_MQ_PORT:5672}"
    virtual_host: "${TB_QUEUE_RABBIT_MQ_VIRTUAL_HOST:/}"
    username: "${TB_QUEUE_RABBIT_MQ_USERNAME:YOUR_USERNAME}"
    password: "${TB_QUEUE_RABBIT_MQ_PASSWORD:YOUR_PASSWORD}"
    automatic_recovery_enabled: "${TB_QUEUE_RABBIT_MQ_AUTOMATIC_RECOVERY_ENABLED:false}"
    connection_timeout: "${TB_QUEUE_RABBIT_MQ_CONNECTION_TIMEOUT:60000}"
    handshake_timeout: "${TB_QUEUE_RABBIT_MQ_HANDSHAKE_TIMEOUT:10000}"
    queue-properties:

Confluent配置

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

ThingsBoard配置

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\conf\thingsboard.yml

and locate “queue:” block. Make sure the queue type is “kafka”, replication factor is “3” and use confluent cloud is “true”.

Don’t forget to replace “CLUSTER_API_KEY”, “CLUSTER_API_SECRET” and “localhost:9092” with your real Confluent Cloud bootstrap servers:

1
2
3
4
5
6
7
8
9
10
11
queue:
  type: "${TB_QUEUE_TYPE:kafka}"
...
  kafka:
    bootstrap.servers: "${TB_KAFKA_SERVERS:localhost:9092}"
...
    replication_factor: "${TB_QUEUE_KAFKA_REPLICATION_FACTOR:3}"
...
    use_confluent_cloud: "${TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD:true}"
...
      sasl.config: "${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 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
queue:
...
  transport_api:
    request_poll_interval: "${TB_QUEUE_TRANSPORT_REQUEST_POLL_INTERVAL_MS:1000}"
    response_poll_interval: "${TB_QUEUE_TRANSPORT_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  core:
    poll-interval: "${TB_QUEUE_CORE_POLL_INTERVAL_MS:1000}"
    partitions: "${TB_QUEUE_CORE_PARTITIONS:2}"
...
  vc:
    partitions: "${TB_QUEUE_VC_PARTITIONS:1}"
    poll-interval: "${TB_QUEUE_VC_INTERVAL_MS:1000}"
...
  js:
    response_poll_interval: "${REMOTE_JS_RESPONSE_POLL_INTERVAL_MS:1000}"
...
  rule-engine:
    poll-interval: "${TB_QUEUE_RULE_ENGINE_POLL_INTERVAL_MS:1000}"
...
  transport:
    poll_interval: "${TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:1000}"

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

Step 6. [Optional] Memory update for slow machines (1GB of RAM)

以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
打开以下文件进行编辑(在文件选择对话框中选择“所有文件”而不是“文本文档”,编码为UTF-8):

1
C:\Program Files (x86)\thingsboard\thingsboard.xml

在配置文件中找到以下几行。

1
2
    <startargument>-Xms512m</startargument>
    <startargument>-Xmx1024m</startargument>

并将它们更改为

1
2
    <startargument>-Xms256m</startargument>
    <startargument>-Xmx256m</startargument>

Step 7. Run installation script

Launch windows shell (Command Prompt) as Administrator. Change directory to your ThingsBoard installation directory.

Execute install.bat script to install ThingsBoard as a Windows service (or run “install.bat –loadDemo” to install and add demo data). This means it will be automatically started on system startup. Similar, uninstall.bat will remove ThingsBoard from Windows services. The output should be similar to this one:

1
2
3
4
5
6
7
C:\Program Files (x86)\thingsboard>install.bat --loadDemo
Detecting Java version installed.
CurrentVersion 18
Java 1.8 found!
Installing thingsboard ...
...
ThingsBoard installed successfully!

Step 8. Start ThingsBoard service

现在开始启动ThingsBoard服务! 以管理员身份打开命令提示符并执行以下命令:

1
net start thingsboard

执行输出结果:

1
2
The ThingsBoard Server Application service is starting.
The ThingsBoard Server Application service was started successfully.

可以执行以下命令重新启动ThingsBoard服务:

1
2
net stop thingsboard
net start thingsboard

启动后使用以下链接打开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

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

Please allow up to 90 seconds for the Web UI to start. This is applicable only for slow machines with 1-2 CPUs or 1-2 GB RAM.

Step 9. Install ThingsBoard Web Report Server component

Download and extract the installation package.

1
https://dist.thingsboard.io/tb-web-report-windows-3.5.1pe.zip

Note: We assume you have extracted ThingsBoard Web Report Server to default location: C:\Program Files (x86)\tb-web-report

Launch windows shell (Command Prompt) as Administrator. Change directory to your ThingsBoard installation directory.

Execute install.bat script to install ThingsBoard Web Report Server as a Windows service. This means it will be automatically started on system startup. Similar, uninstall.bat will remove ThingsBoard from Windows services. The output should be like:

1
2
3
    C:\Program Files (x86)\tb-web-report>install.bat
    Installing tb-web-report ...
    tb-web-report installed successfully!  

现在开始启动ThingsBoard服务! 以管理员身份打开命令提示符并执行以下命令:

1
net start tb-web-report

执行输出结果:

1
2
3
C:\Program Files (x86)\tb-web-report>net start tb-web-report
The Thingsboard Web Report Microservice service is starting.
The Thingsboard Web Report Microservice service was started successfully.

Troubleshooting

The log files are located in logs folder (“C:\Program Files (x86)\thingsboard\logs” in our case).

The thingsboard.log file should contain following line:

1
2
YYYY-MM-DD HH:mm:ss,sss [main] INFO  o.t.s.ThingsboardServerApplication - Started ThingsboardServerApplication in x.xxx seconds (JVM running for x.xxx)

In case of any unclear errors, use general troubleshooting guide or contact us.

Windows firewall settings

In order to have external access to ThingsBoard Web UI and device connectivity (HTTP, MQTT, CoAP) you need to create a new inbound rule with Windows Firewall with Advanced Security.

  • Open “Windows Firewall” from “Control Panel”:

image

  • Click “Advanced settings” on the left panel:

image

  • Select “Inbound Rules” on the left panel, then click “New Rule…” on the right “Actions” panel:

image

  • Now new “New Inbound Rule Wizard” window will open. On the first step “Rule Type” select “Port” option:

image

  • On the “Protocol and Ports” step select “TCP” protocol and enter port list 8080, 1883, 5683 in the “Specific local ports” field:

image

  • On the “Action” step leave “Allow the connection” option selected:

image

  • On the “Profile” step select Windows network profiles when to apply this rule:

image

  • Finally, give the name to this rule (for ex. “ThingsBoard Service Networking”) and click “Finish”.

image

Next steps

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

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

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

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

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

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

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

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