ThingWorx HA 中的 ThingWorx Flow
配置 ThingWorx Foundation HA 实例,以便可供 ThingWorx Flow 使用
要配置高可用性 ThingWorx Foundation 实例以便可供 ThingWorx Flow 使用,请完成以下步骤:
1. 在每台 ThingWorx Foundation 计算机上,停止 ThingWorx-Foundation 服务。
ThingWorx HA 中 ThingWorx Flow 的特定安装步骤
如果要在
ThingWorx HA 环境中安装
ThingWorx Flow,请注意
ThingWorx Flow 安装程序中特定于“
ThingWorx Flow 配置信息”屏幕的以下几点。有关整个
ThingWorx Flow 安装过程,请参阅
此处。
先决条件
将 platform-settings.json 文件从一台 ThingWorx Foundation 计算机复制到您的 ThingWorx Flow 计算机。
步骤
1. 在“ThingWorx Foundation IP 地址或主机名”字段中,指定负载均衡器 (HAProxy) 的主机名。
2. 在“ThingWorx Foundation 本地端口”字段中,指定部署 ThingWorx Foundation 的 HTTPS 端口。默认值为 8443。
3. 在“ThingWorx Foundation 访问协议”下,选择“HTTPS (安全)”。
4. 在
“ThingWorx Foundation 设置文件路径 (platform-settings.json)”字段中,单击
![](../../../ThingWorx/images/BrowseSettingsInstallation.png)
以指定
ThingWorx Flow 计算机上本地
platform-settings.json 文件的位置。
安装后步骤
2. 在每台
ThingWorx Foundation 计算机上,将
ThingWorx Flow 密钥存储在
ThingWorx Foundation KeyStore 中,以在
ThingWorx Flow 与
ThingWorx Foundation 之间建立安全通信。
此处提供了执行此任务的详细步骤。
在 ThingWorx HA 中配置 ThingWorx Flow
在下列文件中,用 <Load_Balancer_Host>:<Load_Balancer_Port> 替换 <NGinx_Host>:<NGinx_Port> 的所有具体值:
1. 在 <ThingWorx_Flow_Installation_Folder>\modules\ux\deploymentConfig.json 文件中,将
"api_endpoint": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Flow",
"ENDPOINT": "http://localhost:8003",
"view": {
"oauth_server": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Oauths"
},
"oauth": {
"host": "http://localhost:7070"
},
"service_api_endpoint": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Lookups",
"lookup": {
"host": "http://localhost:8077"
},
"trigger_server": {
"host": "http://localhost:8004"
},
"twx_endpoint": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx"
复制到
"api_endpoint": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Flow",
"ENDPOINT": "http://localhost:8003",
"view": {
"oauth_server": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Oauths"
},
"oauth": {
"host": "http://localhost:7070"
},
"service_api_endpoint": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Lookups",
"lookup": {
"host": "http://localhost:8077"
},
"trigger_server": {
"host": "http://localhost:8004"
},
"twx_endpoint": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx"
2. 在 <ThingWorx_Flow_Installation_Folder>\modules\lookup\deploymentConfig.json 文件中,将
"ENDPOINT": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Lookups"
复制到
"ENDPOINT": https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Lookups
3. 在 <ThingWorx_Flow_Installation_Folder>\modules\oauth\deploymentConfig.json 文件中,执行以下操作:
a. 更改
"UI_ENDPOINT": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Composer/apps/flow",
"ENDPOINT": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Oauths"
复制到
"UI_ENDPOINT": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Composer/apps/flow",
"ENDPOINT": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Oauths"
b. 请确保负载均衡器主机名出现在 WHITE_LIST_DOMAINS 部分中:
"WHITE_LIST_DOMAINS": [
"<NGinx_Host>",
"<Load_Balancer_Host>",
"localhost"
4. 在 <ThingWorx_Flow_Installation_Folder>\modules\trigger\deploymentConfig.json 文件中,将
"DOMAIN": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Triggers",
"LISTENER_URL": "http://localhost:8004",
"TRIGGER_HOST": "https://<NGinx_Host>:<NGinx_Port>/Thingworx/Triggers"
复制到
"DOMAIN": "https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Triggers",
"LISTENER_URL": "http://localhost:8004",
"TRIGGER_HOST":https://<Load_Balancer_Host>:<Load_Balancer_Port>/Thingworx/Triggers"
为 ThingWorx Flow 配置负载均衡器
先决条件
步骤
4. 为负载均衡器创建自签名证书。有关详细信息,请参阅
创建自签名证书。
有关
ThingWorx Flow 的
frontend 和
backend 的配置示例,请参阅
HAProxy 示例。
启动服务器
请按下列顺序启动服务器:
1. 启动 RabbitMQ。
检查 RabbitMQ 日志文件以验证 RabbitMQ 是否已启动。
Windows:<ThingWorx_Flow_Install_Location>\modules\RabbitMQ\log
Linux:/var/log/rabbitmq
2. 启动 ZooKeeper。如果有多个 Zookeeper,请启动其他 Zookeeper 服务器。
使用命令提示符/终端验证 Zookeeper 服务器是否已启动。
3. 逐个启动 ThingWorx 平台实例。例如 platform1、platform 2 等。
检查 <Path_To_Shared_Storage>/ThingworxStorage/logs/ApplicationLog.log 文件以验证 ThingWorx 平台实例是否已启动。特定 ThingWorx 平台实例的日志文件包含平台实例名称。
4. 启动 Nginx 服务器。
检查 Nginx 日志文件以验证 Nginx 服务器是否已启动。
Windows:C:\Program Files\nginx-<版本>\logs
Linux:/var/log/nginx
5. 启动 ThingWorx Flow 服务器。
要进行验证,请以管理员身份启动命令提示符或终端,然后运行以下命令:
Windows:pm2 ls
Linux:sudo pm2 ls
6. 启动负载均衡器 (HAProxy)。
访问 HAProxy (负载均衡器) 的统计报告,以验证所有内容是否已启动并运行:
http://{load_balancer_host_with_full_domain}:1936/
提供在 haproxy.cfg 中配置的 <stats_user> 和 <stats_password> 以进行登录。