- Prerequisites
- Step 1. Install Java 11 (OpenJDK)
- Step 2. ThingsBoard service installation
- Step 3. Obtain and configure license key
- Step 4. Configure ThingsBoard database
- Step 5. Choose ThingsBoard queue service
- Step 6. [Optional] Memory update for slow machines (1GB of RAM)
- Step 7. Run installation script
- Step 8. Start ThingsBoard service
- Step 9. Install ThingsBoard Web Report Server component
- Troubleshooting
- Windows firewall settings
- Next steps
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数据库方式。
有关更多详细信息请参见相应的体系结构页面 。
PostgreSQL安装下载安装文件(PostgreSQL 11.7或更高版本)此处并按照安装说明进行操作。 在PostgreSQL安装时系统将提示您输入超级用户(postgres)密码。 请一定牢记此密码,为了方便记忆我们将密码替换为postgres。 创建ThingsBoard数据库安装成功后启动”pgAdmin”并使用超级用户(postgres)身份登录。 ThingsBoard配置如果已将PostgreSQL超级用户密码指定为”postgres”则可以跳过此步骤。 以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标然后选择”以管理员身份运行”)。
找到”SQL DAO Configuration”代码块将postgres用户密码替换”postgres”:
找到”SQL_POSTGRES_TS_KV_PARTITIONING”参数以覆盖时间戳键值存储分区大小的默认值:
|
PostgreSQL安装下载安装文件(PostgreSQL 11.7或更高版本)此处并按照安装说明进行操作。 在PostgreSQL安装时系统将提示您输入超级用户(postgres)密码。 请一定牢记此密码,为了方便记忆我们将密码替换为postgres。 创建ThingsBoard数据库安装成功后启动”pgAdmin”并使用超级用户(postgres)身份登录。 ThingsBoard配置以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标然后选择”以管理员身份运行”)。
找到”SQL DAO Configuration”代码块将postgres用户密码替换”postgres”:
找到”DATABASE_TS_TYPE”参数将”sql”替换为”timescale”。
可以选择调整引用Timescale DB配置的参数”sql”配置块中的”timescale”配置块。
|
Step 5. Choose ThingsBoard queue service
ThingsBoard使用消息系统存储服务之间的通信,请正确选择队列?
-
内存 适用于开发环境(开发)
-
Kafka 适用于生产环境(集群)
-
RabbitMQ 适用生产环境(单体)
-
AWS SQS 适用生产环境(AWS公有云)
-
Google发布/订阅 适用生产环境(Google公有云)
-
Azure服务总线 适用生产环境(Azure公有云)
-
Confluent云 适用于生产环境(托管)
默认使用内存队列无需其他配置。 |
Kafka安装Apache Kafka是一个开源的流式数据处理平台。 Kafka安装使用此说明在Docker容器中安装Kafka。 ThingsBoard配置以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
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:
|
AWS SQS配置首先需要创建AWS账户然后访问AWS SQS服务。 使用此说明创建AWS SQS服务凭证。
ThingsBoard配置以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
添加配置将”YOUR_KEY”和”YOUR_SECRET”替换为真实的AWS用户凭证并将”YOUR_REGION”替换成AWS SQS帐户区域:and “YOUR_REGION” with your real AWS SQS account 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:
可以使用UI更新默认规则引擎队列配置(轮询间隔和分区)有关ThingsBoard规则引擎队列的更多信息请参阅文档。 |
Google发布/订阅配置创建一个Google帐户并访问发布/订阅服务。 使用此说明创建一个项目并使用发布/订阅服务。 使用此说明创建服务帐户凭据并编辑角色或管理员后保存json凭据步骤9的文件此处。 ThingsBoard配置以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
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):
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:
可以使用UI更新默认规则引擎队列配置(轮询间隔和分区)有关ThingsBoard规则引擎队列的更多信息请参阅文档。 |
Azure服务总线配置创建Azure帐户并访问Azure服务总线。 通过使用说明了解并使用总线服务。 使用说明创建共享访问签名。 ThingsBoard配置以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
添加下面配置内容使用真正的服务总线名称空间替换”YOUR_NAMESPACE_NAME”和”YOUR_SAS_KEY_NAME”及”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 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:
可以使用UI更新默认规则引擎队列配置(轮询间隔和分区)有关ThingsBoard规则引擎队列的更多信息请参阅文档。 |
RabbitMQ安装你可以使用官方文档安装RabbitMQ或按照以下说明: ThingsBoard配置以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
将以下行添加到配置文件将“YOUR_USERNAME”和“YOUR_PASSWORD”替换为真实的信息将“localhost”和“5672”替换为真实的RabbitMQ主机和端口:
|
Confluent配置你应该创建一个帐户后访问Confluent云然后创建一个Kafka集群和 API Key。 ThingsBoard配置以管理员用户身份打开记事本或其他编辑器(右键单击应用程序图标,然后选择“以管理员身份运行”)。
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:
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:
可以使用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
可以在帐户详情页面中更改每个帐户的密码。
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”:
- Click “Advanced settings” on the left panel:
- Select “Inbound Rules” on the left panel, then click “New Rule…” on the right “Actions” panel:
- Now new “New Inbound Rule Wizard” window will open. On the first step “Rule Type” select “Port” option:
- On the “Protocol and Ports” step select “TCP” protocol and enter port list 8080, 1883, 5683 in the “Specific local ports” field:
- On the “Action” step leave “Allow the connection” option selected:
- On the “Profile” step select Windows network profiles when to apply this rule:
- Finally, give the name to this rule (for ex. “ThingsBoard Service Networking”) and click “Finish”.
Next steps
-
入门指南 - 快速学习ThingsBoard相关功能。
-
连接设备 - 学习如何根据你的连接方式或解决方案连接设备。
-
可 视 化 - 学习如何配置复杂的ThingsBoard仪表板说明。
-
数据处理 - 学习如何使用ThingsBoard规则引擎。
-
数据分析 - 学习如何使用规则引擎执行基本的分析任务。
-
硬件样品 - 学习如何将各种硬件平台连接到ThingsBoard。
-
高级功能 - 学习高级ThingsBoard功能。
-
开发指南 - 学习ThingsBoard中的贡献和开发。