将 Amazon Kinesis Video Streams Video Streams 边缘代理作为原生进程运行 - Amazon Kinesis Video Streams

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

将 Amazon Kinesis Video Streams Video Streams 边缘代理作为原生进程运行

将 Amazon Kinesis Video Streams Video Streams Edge Agent 设置为系统服务。此为可选步骤。

systemd是 Linux 设备上的系统和服务管理器。 systemd是管理该过程的推荐方法,因为如果应用程序遇到错误或运行该应用程序的设备断电,它将重启 Amazon Kinesis Video Streams Edge Agent。

执行以下操作:

将 Amazon Kinesis Video Streams Video Streams 边缘代理作为原生进程运行
  1. 在中创建一个新文件/etc/systemd/system并将其命名aws.kinesisvideo.edge-runtime-agent.service

    粘贴以下内容:

    [Unit] Description=AWS Kinesis Video Streams edge agent After=network.target StartLimitBurst=3 StartLimitInterval=30 [Service] Type=simple Restart=on-failure RestartSec=10 WorkingDirectory=/download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion Environment="GST_PLUGIN_PATH=/download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion" Environment="LD_LIBRARY_PATH=/download-location/kvs-edge-agent/KvsEdgeComponent/artifacts/aws.kinesisvideo.KvsEdgeComponent/EdgeAgentVersion/lib" ... Environment="AWS_IOT_CORE_DATA_ATS_ENDPOINT=data-account-specific-prefix.iot.aws-region.amazonaws.com" ExecStart=/usr/lib/jvm/java-11-amazon-corretto/bin/java --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true -cp kvs-edge-agent.jar:libs.jar com.amazonaws.kinesisvideo.edge.controller.ControllerApp [Install] WantedBy=multi-user.target

    有关systemd服务配置文件接受的参数的更多信息,请参阅文档

    注意

    ...位置添加所需的环境变量,如中所述构建 Amazon Kinesis Video Streams 边缘代理

  2. 重新加载服务文件以包含新服务。

    键入 sudo systemctl daemon-reload

  3. 启动 服务。

    键入 sudo systemctl start aws.kinesisvideo.edge-runtime-agent.service

  4. 检查 Amazon Kinesis Video Streams Video Streams Edge Agent 服务的状态以验证其是否正在运行。

    键入 sudo systemctl status aws.kinesisvideo.edge-runtime-agent.service

    以下是您将看到的输出示例。

    aws.kinesisvideo.edge-runtime-agent.service - AWS Kinesis Video Streams edge agent Loaded: loaded (/etc/systemd/system/aws.kinesisvideo.edge-runtime-agent.service; disabled; vendor preset: enabled) Active: active (running) since Thu 2023-06-08 19:15:02 UTC; 6s ago Main PID: 506483 (java) Tasks: 23 (limit: 9518) Memory: 77.5M CPU: 4.214s CGroup: /system.slice/aws.kinesisvideo.edge-runtime-agent.service └─506483 /usr/lib/jvm/java-11-amazon-corretto/bin/java -cp kvs-edge-agent.jar:libs.jar com.amazonaws.kinesisvideo.edge.controller.ControllerApp
  5. 检查日志中是否存在任何错误。

    键入 journalctl -e -u aws.kinesisvideo.edge-runtime-agent.service

  6. 键入systemctl --help以查看用于管理流程的选项的完整列表systemctl

    以下是管理 Amazon Kinesis Video Streams Edge Agent 的一些常用命令:

    • 要重新启动,请键入sudo systemctl restart aws.kinesisvideo.edge-runtime-agent.service

    • 要停止,请键入sudo systemctl stop aws.kinesisvideo.edge-runtime-agent.service

    • 要在每次设备重启时自动启动,请键入sudo systemctl enable aws.kinesisvideo.edge-runtime-agent.service