创立TelemetryService Yaml 文件
apiVersion: shifu.edgenesis.io/v1alpha1kind: TelemetryServicemetadata: name: push-endpoint-1 namespace: devicesspec: telemetrySeriveEndpoint: http://telemetryservice.shifu-service.svc.cluster.local serviceSettings: SQLSetting: serverAddress: 192.168.14.163:6041 secret: my-secret dbName: shifu dbTable: testTable2 dbtype: TDengine
telemetrySeriveEndpoint
是telemetryService的端点地址serverAddress
示意数据库地址username
示意你的数据库用户名secret
示意存储你的数据库用户名与明码的Secret名字dbName
示意数据库名dbTable
示意数据库表(table)名dbtype
示意数据库类型
创立Secret
以下面的secret
中内容为名创立Secret
,在username
和password
域中别离填写数据库用户名与明码。
kubectl create secret generic my-secret --from-literal=username=your_username --from-literal=password=your_password -n devices
备注
如果你有多个遥测服务,你能够把它们写在一个文件里,用---进行宰割。
编辑Configmap Yaml文件
# configmap.yamldata: telemetries: | telemetries: device_health1: properties: instruction: status pushSettings: telemetryCollectionService: push-endpoint-1 # Edit it to the name same with TelemetryService's name
而后编辑Configmap.yaml文件,确保telemetryCollectionService的值与你在上一步创立的遥测服务的名称雷同。
再次部署deviceShifu
而后你须要再次部署deviceShifu ,这样TelemetryService就会将采集到的数据推送到TDengine中。
例子
上面是一个例子,帮忙你更好地理解如何应用它。
https://github.com/Edgenesis/shifu/tree/main/examples/tdengineTelemetryService/deployment