端口和服务管理(操作员指南)
本页介绍检查正在运行的 PlantPulse 的端口状态并解决问题的流程。完整的端口目录请参考安装指南 - 端口配置信息页面。
日常巡检清单
1. 服务状态检查
status.sh — 堆栈整体状态(主机)
首先在主机上查看堆栈状态。它汇总了服务列表、容器状态、健康状态和卷,并且退出代码是契约——0 为正常,2 为异常,可直接用于监控自动化。
cd /opt/kopens/plantpulse-platform-docker/bin
./status.sh
plantpulse-certs 也是持续运行且 (healthy) 为正常。证书烧录一次后,会持续监控其过期时间。
各模块端口占用(数据湖容器内)
要查看基础设施组件的端口占用 / PID / CPU / 内存(PSS),请在数据湖容器内使用 status.sh。
cd /opt/kopens/plantpulse-platform-docker/bin
./shell.sh
/opt/kopens/plantpulse-platform/plantpulse-datalake-cli/bin/pd status
输出示例:
==============================================================================================================
PLANTPULSE PLATFORM - ALL SERVICE STATUS
==============================================================================================================
<SYSTEM RESOURCE OVERVIEW>
CPU LOAD (AVG) : 12.3% (48 cores)
MEMORY USAGE : 65.2% (123.1G / 188.7G)
DATA DISK USAGE : 45.8% (2.2T / 4.8T)
<SERVICE STATUS BY PORT>
SERVICE | PORT | STATUS | PID | CPU | MEMORY (PSS)
PP_MESSAGING[KAFKA] | 9092 | RUNNING | 12345 | 2.3% | 8.5G ( 4.5%)
PP_STORAGE[CASSANDRA] | 9042 | RUNNING | 12567 | 5.1% | 16.2G ( 8.6%)
PP_SERVER | 80 | RUNNING | 12890 | 1.2% | 4.8G ( 2.5%)
...
<SERVICE SUMMARY>
TOTAL SERVICES : 25 RUNNING / 0 STOPPED
TOTAL CPU (SUM) : 42.3%
TOTAL MEMORY (PSS) : 78.5% (148.0G)
ops-check.sh — 健康状态 + 最近 critical 日志
./ops-check.sh
自动执行以下操作:
- 检查 HTTPS 健康端点(
https://127.0.0.1:4950/api/health)的响应 - 收集最近的 critical / fatal 日志消息
- 测量各模块的响应时间
外部健康检查(监控系统集成)
# 호스트 / 외부에서 — 4950 이 유일하게 publish 되는 헬스 포트입니다
curl -kfsS https://[HOST]:4950/api/health | jq
# 컨테이너 안에서 — 어떤 구성에서도 동작합니다
docker exec plantpulse-datalake curl -kfsS https://127.0.0.1:4950/api/health | jq
控制台和健康 API 在两个端口上都提供服务——4950(HTTPS)和 4949(明文 HTTP)。它们是相同的控制台和相同的 API,只是方案不同。4949 不再重定向到 4950。
4949 是明文——登录密码和会话 Cookie 会直接以明文传输。在不可信网络中,请使用 4950。4949 是专为自签名证书警告实际会阻止操作员前进的环境而提供的选项。
2. 各端口快速诊断
| 端口 | 模块 | 快速检查 |
|---|---|---|
| 80 / 443 | server | curl -fsS http://[HOST]/api/v5/ping |
| 9042 | Aster TSDB | pd node status 集群状态 |
| 5432 | PostgreSQL | pd node psql 连接后执行 SELECT 1; |
| 6379 | Valkey | redis-cli -a $PP_REDIS_PASSWORD ping |
| 9000 | RustFS | pd status storage — RustFS 没有健康端点 |
| 9092 | Kafka | kafka-broker-api-versions.sh --bootstrap-server [HOST]:9092 |
| 1883 | MQTT | mosquitto_pub -h [HOST] -p 1883 -u mq -P $PP_MQ_PASSWORD -t test -m hi |
| 7400 | CEP | curl -fsS -H "X-API-Key: $PP_CEP_API_KEY" http://[HOST]:7400/api/v1/status |
| 5500 | Data Gateway | curl -fsS http://[HOST]:5500/api/health(匿名就绪检查——仅 UP 时返回 200) |
| 7800 | TSE | curl -fsS http://[HOST]:7800/api/health |
| 7077 | Spark Master | curl -fsS http://[HOST]:4440/json/ | jq .workers |
| 10000 | Kyuubi | beeline -u "jdbc:hive2://[HOST]:10000" -e "SELECT 1" |
| 19001 | Gravitino | curl -fsS -u gravitino:$PP_GRAVITINO_PASSWORD http://[HOST]:19001/api/metalakes |
| 7233 | Temporal | temporal --address [HOST]:7233 namespace list |
| 8380 | Kestra | curl -fsS -u admin@plantpulse.io:$PP_KESTRA_ADMIN_PASSWORD http://[HOST]:8380/api/v1/flows |
| 11004 | OPC-UA | 使用 UaExpert 等工具进行 opc.tcp://[HOST]:11004 连接 |
| 10210 | HA 守护进程 | curl -fsS http://[HOST]:10210/api/health |
| 4950 | 监控 | curl -kfsS https://[HOST]:4950/api/health | jq .status |
80 · 443 · 1883 · 1884 由 plantpulse-proxy 发布到主机,11004 · 11005 由 OPC-UA 插件发布,10210 由 HA 容器发布,其余由 plantpulse-datalake 发布到主机。四个应用(server-web · batch-web · warehouse · aasx)不打开主机端口,因此请通过 ./status.sh · ./logs.sh <컨테이너> 确认 → 端口配置信息
pd node status · pd node psql 等工具位于数据湖容器内(通过 ./shell.sh 进入)。
3. 端口冲突诊断
确认占用进程
# 특정 포트
ss -tlnp | grep ":<port> "
sudo lsof -i :<port>
# 일괄 (PlantPulse 모든 핵심 포트)
ss -tlnp | grep -E ':(80|443|1883|1884|3000|4000|4950|5432|5500|6379|7077|7233|7400|7800|8233|8380|9000|9042|9092|10000|10210|11004|19001)\s'
冲突解决
| 情况 | 措施 |
|---|---|
| 外部服务占用端口 | 将外部服务移至其他端口 |
| 残留旧的 PlantPulse 进程 | 如果原生存在于主机上,请执行 pkill -ef plantpulse。如果是容器侧,请执行 bin/down.sh 后,使用 docker ps -a 确认残留 |
| 公司策略禁止使用默认端口 | 暴露到主机的端口由 compose/docker-compose.yml 的 ports: 决定。更改映射后执行 bin/restart.sh |
4. 防火墙运维
查看当前允许规则
# RHEL/Rocky/Oracle (firewalld)
sudo firewall-cmd --list-ports
sudo firewall-cmd --list-rich-rules
sudo firewall-cmd --list-services
# Ubuntu (ufw)
sudo ufw status numbered
sudo ufw status verbose
运维中新增允许端口
# firewalld
sudo firewall-cmd --permanent --add-port=<port>/tcp
sudo firewall-cmd --reload
# ufw
sudo ufw allow <port>/tcp
仅允许新的源 IP
# firewalld rich rule
sudo firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=192.168.10.0/24 port port=9042 protocol=tcp accept"
sudo firewall-cmd --reload
# ufw
sudo ufw allow from 192.168.10.0/24 to any port 9042
5. JMX 端口运维
JMX 端口(6199~7899)应仅允许来自监控/管理节点的 IP。使用 JConsole / VisualVM 连接时:
# SSH 터널로 안전하게 접속 (권장)
ssh -L 7099:127.0.0.1:7099 root@[HOST]
# 로컬에서
jconsole 127.0.0.1:7099
详细的 JMX 端口映射,请参考安装:端口配置信息 - JMX。
6. 常见问题
| 症状 | 原因 | 首要措施 |
|---|---|---|
| 部分容器异常 | 依赖容器宕机 / 资源不足 | 在主机上执行 ./status.sh → 如果是应用则执行 docker compose … restart <서비스>,如果是基础设施则在容器内执行 restart-<module>.sh |
| 端口处于 LISTEN 状态但健康检查失败 | 启动未完成 / 后端依赖未就绪 | 使用 ./stack-verify-boot.sh 判断就绪状态。全新安装稳定需要 15~18 分钟 |
| 全部宕机 | 堆栈已停止 | 在主机上执行 ./up.sh(等待就绪,0 = 可用) |
address already in use | 外部进程占用 | 上述端口冲突诊断流程 |
| 外部无法访问(内部可以) | 主机防火墙或云安全组 | 检查 firewall-cmd --list-ports 和云安全组 |
TLS 握手失败(仅通过 TimeoutException 可见) | 证书 SAN 不匹配 | 检查 PP_TLS_SAN_DNS / PP_TLS_SAN_IPS。证书由 plantpulse-certs 烧录 → 安全设置 |
| 实时更新中断 | 防火墙/代理的空闲超时 | 提高前端代理的 proxy_read_timeout。实时推送通过 443 端口发出 |
7. 运维自动化
健康检查 cron
# /etc/cron.d/plantpulse-health (호스트에서)
*/5 * * * * root /opt/kopens/plantpulse-platform-docker/bin/ops-check.sh >> /var/log/plantpulse-ops.log 2>&1
要使用退出代码进行判断,status.sh 更合适——0 = 正常 / 2 = 异常是契约。
*/5 * * * * root /opt/kopens/plantpulse-platform-docker/bin/status.sh >/dev/null 2>&1 || logger -t plantpulse "status.sh reported unhealthy"
Prometheus / Grafana 集成
配置 Prometheus 抓取管理控制台 API(plantpulse-datalake-admin-api)暴露的 /metrics 端点。
# prometheus.yml
scrape_configs:
- job_name: plantpulse
scheme: https
tls_config:
insecure_skip_verify: true # 자체 서명 CA 를 쓰는 경우
static_configs:
- targets: ['[HOST]:4950']
4949 也提供相同的 API,但是明文。如果在私有网络内且证书验证负担较大,请使用 4949,否则请使用 4950。
4950/metrics 提供的是容器、端口、健康状态等堆栈自身状态。
如果您想使用 PromQL 查看来自设备的值或系统指标,则位置不同。
| 想查看的内容 | 位置 |
|---|---|
| 堆栈是否存活(容器、端口) | 此处——4950/metrics |
| 使用 PromQL 查询系统指标(JMX、边缘计数器) | Prometheus 集成——TSE 的兼容适配器 |
| 将系统指标显示为仪表板 | 在 PlantPulse Dashboard 中创建仪表板——捆绑的 PlantPulse Dashboard(3000) |
| 设备传感器值 | 时序数据库——CQL |
相关文档
- 安装:端口配置信息 — 完整端口目录
- 监控 — Prometheus / PlantPulse Dashboard / 报警
- 故障排除
- 管理控制台 — 提供
/metrics的地方 - 模块:startup