产品定价 立即试用
PE MQTT Broker
安装 > Minikube (Kubernetes) 集群
入门 文档
架构 API 常见问题
目录

使用 Kubernetes 在 Minikube 上部署 TBMQ PE 集群

本指南将帮助你在Minikube集群模式下部署TBMQ PE。

前置要求

需具备Kubernetes集群,且 kubectl 命令行工具已配置为可与集群通信。 若未安装Minikube,请按此说明操作。

克隆TBMQ PE K8S仓库

1
2
git clone -b release-2.2.0 https://github.com/thingsboard/tbmq-pe-k8s.git
cd tbmq-pe-k8s/minikube

安装

要安装TBMQ PE,执行以下命令:

1
./k8s-install-tbmq.sh

获取许可证密钥

在继续之前,请确保已选择订阅计划或购买永久许可证。 若尚未完成,请访问定价页面比较可用选项 并获取许可证密钥。

注意: 本指南中,我们将用 YOUR_LICENSE_KEY_HERE 表示您的许可证密钥。

配置许可证密钥

使用许可证密钥创建 k8s 密钥:

1
2
export TBMQ_LICENSE_KEY=YOUR_LICENSE_KEY_HERE 
kubectl create -n thingsboard-mqtt-broker secret generic tbmq-license --from-literal=license-key=$TBMQ_LICENSE_KEY
文档信息图标

请勿忘记将 YOUR_LICENSE_KEY_HERE 替换为您的许可证密钥值。

运行

执行以下命令部署TBMQ PE:

1
./k8s-deploy-tbmq.sh

所有资源成功启动后,可在浏览器中打开 http://{your-cluster-ip}:30001(例如 http://192.168.49.2:30001)。 可使用以下命令查看集群IP:

1
minikube ip

您将看到TBMQ登录页面。请使用以下 System Administrator(系统管理员)默认凭据:

用户名

1
sysadmin@thingsboard.org

密码

1
sysadmin

首次登录时,系统将要求您将默认密码修改为自定义密码,然后使用新凭据重新登录。

日志、删除StatefulSet和服务

遇到问题时,可查看服务日志排查错误。 例如,查看TBMQ节点日志:

1) 获取运行中的tbmq pod列表:

1
kubectl get pods -l app=tbmq

2) 获取tbmq pod的日志:

1
kubectl logs -f TBMQ_POD_NAME

Where:-TBMQ_POD_NAME-tbmq pod name obtained from the list of the running tbmq pods.

Or use the next command to see the state of all the pods.

1
kubectl get pods

Use the next command to see the state of all the services.

1
kubectl get services

Use the next command to see the state of all the deployments.

1
kubectl get deployments

Use the next command to see the state of all the statefulsets.

1
kubectl get statefulsets

See kubectl Cheat Sheet command reference for more details.

Execute the following command to delete TBMQ nodes:

1
./k8s-delete-tbmq.sh

Execute the following command to delete all resources (including the databases):

1
./k8s-delete-all.sh

Upgrading

查看 release notes升级说明 了解最新变更详情。

若文档未涵盖您的升级场景,请联系我们以获取进一步指导。

Backup and restore (Optional)

While backing up your PostgreSQL database is highly recommended, it is optional before proceeding with the upgrade. For further guidance, follow the next instructions.

从 TBMQ CE 升级到 TBMQ PE(v2.2.0)

要将现有 TBMQ 社区版 (CE) 升级到 TBMQ 专业版 (PE),请确保在开始前已运行最新的 TBMQ CE 2.2.0 版本。 将当前配置与最新的 TBMQ PE K8S 脚本 合并。 请勿忘记配置许可证密钥

运行以下命令(包含升级脚本)以迁移 PostgreSQL 数据库数据(从 CE 到 PE):

1
2
3
./k8s-delete-tbmq.sh
./k8s-upgrade-tbmq.sh --fromVersion=ce
./k8s-deploy-tbmq.sh

下一步