使用Docke在Linux或 Mac OS系统中安装ThingsBoard
This guide will help you to install and start ThingsBoard using Docker on Linux or Mac OS.
本章描述如何使用Docker在Linux或Mac OS中安装并启动ThingsBoard.
安装步骤
- Install Docker
- Install Docker Compose (Linux only) - Mac OS Docker installation already contains Docker Compose.
- Make a folder to store docker files:
- 安装Docker
- 安装Docker Compose (Linux only) - Mac OS Docker 安装包包含Docker Compose.
- 创建一个文件夹来存储docker文件:
mkdir <docker-folder>
cd <docker-folder>
- Download the following files from thingsboard repo:
- docker-compose.yml - main docker-compose file.
- .env - main env file that contains default location of cassandra data folder and cassandra schema.
- tb.env - default thingsboard environment variables.
- 从thingsboard repo中下载如下文件:
- docker-compose.yml - 主要的docker-compose文件.
- .env - 主要的env文件,该文件包含cassandra数据文件夹和cassandra schema的默认位置.
- tb.env - 默认thingsboard环境变量.
curl -L https://raw.githubusercontent.com/thingsboard/thingsboard/release-1.3/docker/docker-compose.yml > docker-compose.yml
curl -L https://raw.githubusercontent.com/thingsboard/thingsboard/release-1.3/docker/.env > .env
curl -L https://raw.githubusercontent.com/thingsboard/thingsboard/release-1.3/docker/tb.env > tb.env
- If you have already installed ThingsBoard using docker and want to upgrade or cleanup your installation, please cleanup HSQLDB data directory
- 如果你想升级或者清除使用docker安装的ThingsBoard,请清除HSQLDB数据目录。
sudo rm -rf /home/docker/hsqldb_volume
- If you would like to create system and demo data and to start ThingsBoard node execute next command
- 执行如下命令可创建系统,创建演示数据并启动ThingsBoard节点。
ADD_SCHEMA_AND_SYSTEM_DATA=true ADD_DEMO_DATA=true bash -c 'docker-compose up -d tb'
- In case you would like to skip creation of system and demo data or you have already added and you only need to start ThingsBoard node then execute docker-compose command
- 如果你只想启动ThingsBoard节点,请执行docker-compose命令:
docker-compose up -d tb
- Once started, you will be able to open Web UI using following link:
节点启动后,可通过以下链接打开Web页面:
http://localhost:8080/
高级应用
.env file
One can modify .env file to configure following parameters:
- CASSANDRA_DATA_DIR - location of cassandra data folder on host machine
- POSTGRES_DATA_DIR - location of postgres data folder on host machine
- HSQLDB_DATA_DIR - location of hsqldb data folder on host machine
- ADD_SCHEMA_AND_SYSTEM_DATA - create schema and add system user, plugins and rules. by default false
- ADD_DEMO_DATA - add demo accounts, plugins and rules. by default false
- CASSANDRA_URL - url of cassandra container
可以通过修改.env文件配置以下参数:
- CASSANDRA_DATA_DIR - cassandra数据文件夹在主机上的位置。
- POSTGRES_DATA_DIR - postgres数据文件夹在主机上的位置。
- HSQLDB_DATA_DIR - hsqldb数据文件夹在主机上的位置。
- ADD_SCHEMA_AND_SYSTEM_DATA - 创建schema,添加系统用户、 插件以及规则. 默认为false。
- ADD_DEMO_DATA - 添加演示账户,插件以及规则. 默认为false。
- CASSANDRA_URL - cassandra container的URL。
tb.env file
One can set thingsboard service environment variables using this file. See configuration for more details.
可通过此tb.env file设置ThingsBoard环境变量。
故障排除
DNS issues
注意:如果您发现有关于DNS issues的错误, 例如:
127.0.1.1:53: cannot unmarshal DNS message
You may configure your system to use Google public DNS servers. See corresponding Linux and Mac OS instructions.
可以使用Google public DNS配置您的系统。