关于程序员:用户手册遥测服务之推送至-MinIO

创立TelemetryService Yaml 文件

#telemetry_service.yaml
apiVersion: shifu.edgenesis.io/v1alpha1
kind: TelemetryService
metadata:
  name: push-file-mp4
  namespace: devices
spec:
  telemetrySeriveEndpoint: http://telemetryservice.shifu-service.svc.cluster.local
  serviceSettings:
    MinIOSetting:
      # MinIO服务应用的Secret,或者你能够指定AccessKey和SecretKey
      Secret: minio-secret
      # deviceShifu发送给TelemetryService的申请的超时工夫
      RequestTimeoutMS: 2500
      # 你要上传到的Bucket
      Bucket: test-bucket
      # 上传的文件后缀名
      FileExtension: mp4
      # MinIO服务的地址
      ServerAddress: minio.data.svc.cluster.local:9000

创立Secret

usernamepassword域中填写在MinIO GUI中创立的AccessId和AccessKey,或者间接填写装置MinIO时指定的用户名和明码。

kubectl create secret generic minio-secret --from-literal=username=your_username --from-literal=password=your_password -n devices

备注

如果你有多个遥测服务,你能够把它们写在一个文件里,用—进行宰割。

编辑Configmap Yaml文件

# configmap.yaml
data:
  telemetries: |
    telemetrySettings:
      # 每次遥测服务的间隔时间
      telemetryUpdateIntervalInMilliseconds: 10000
      # shifuDevice从edgeDevice取得文件内容的申请的超时工夫
      telemetryTimeoutInMilliseconds: 2500
    telemetries:
      push-file:
        properties:
          # 拜访你的edgeDevice的这个办法,取得要发送给TelemetryService的数据
          instruction: get_file_mp4
          pushSettings:
            # 将其批改为你刚创立TelemetryService的名字
            telemetryCollectionService: push-file-mp4

再次部署deviceShifu

而后你须要再次部署deviceShifu,这样TelemetryService就会将采集到的文件内容存到MinIO中。 文件名会按{device-name}/{time(RFC3339)}.{file-extension}的格局存入对应的Bucket内。

例子

上面是一个例子,帮忙你更好地理解如何应用它。如果你想测试能够在本地运行mockdevice.go而后批改edgedevice.yaml中的address,改为本人本地的IP即可。

https://github.com/Edgenesis/…

本文由边无际受权公布

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理