腾龙娱乐公司开户【微kokang111】

%3CLINGO-SUB%20id%3D%22lingo-sub-2313093%22%20slang%3D%22zh-CN%22%3ETenglong%20Entertainment%20Company%20Opens%20an%20Account%20(Microkokang111)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2313093%22%20slang%3D%22zh-CN%22%3E%3CP%3EIn%20a%20real-world%20production%20environment%2C%20IoT%20devices%20can%20generate%20large%20amounts%20of%20data.%20In%20order%20to%20reduce%20the%20amount%20of%20data%20uploaded%20or%20the%20latency%20of%20control%20policies%2C%20it%20is%20sometimes%20necessary%20to%20analyze%20or%20process%20the%20data%20in%20real%20time%20on%20the%20device%20side.%20Azure%20Stream%20Analytics%20services%20are%20one%20of%20the%20great%20solutions%20where%20users%20can%20create%20azure%20Stream%20Analytics%20services%20from%20Azure%20Portal%2C%20then%20set%20them%20up%20as%20IoT%20Edge%20Module%20in%20Azure%20IoTHub%20and%20deploy%20them%20to%20Azure%20IoT%20Edge%20devices.%20This%20article%20shows%20you%20how%20to%20create%20azure%20Stream%20Analytics%20Job%20and%20deploy%20it%20to%20your%20IoT%20Edge%20device.%3C%2FP%3E%3CP%3E1.%20Create%20a%20storage%20account%3C%2FP%3E%3CP%3EFirst%2C%20in%20the%20Azure%20portal%2C%20go%20to%20New%2C%20enter%20Storage%20in%20the%20search%20box%2C%20and%20select%20Storage%20account%20-%20Blob%2C%20file%2C%20table%2C%20queue.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%2C%20in%20Create%20Storage%20Account%2C%20enter%20the%20name%20of%20the%20storage%20account%2C%20select%20the%20same%20location%20where%20IoTHub%20is%20stored%20(in%20this%20case%20East%20Asia)%2C%20and%20then%20select%20Create.%20Make%20a%20note%20of%20the%20name%20for%20later%20use.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENext%2C%20go%20to%20the%20storage%20account%20you%20just%20created%20and%20select%20Blob%20Service.%20Create%20a%20new%20container%20for%20the%20Azure%20Analytics%20module%20to%20store%20data%2C%20set%20the%20access%20level%20to%20Container%2C%20and%20select%20OK.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2241072-20171227152503488-587073204.png%22%20style%3D%22width%3A%20484px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277217iC1E154B20DD8AEE6%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2241072-20171227152503488-587073204.png%22%20alt%3D%2241072-20171227152503488-587073204.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E2.%20Create%20Azure%20Stream%20Analytics%20Job%3C%2FP%3E%3CP%3EFirst%2C%20in%20the%20Azure%20portal%2C%20go%20to%20Create%20%26gt%3B%20Internet%20of%20Things%2C%20and%20then%20select%20Stream%20Analytics%20Job.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2241072-20171227152504050-362479187.png%22%20style%3D%22width%3A%20484px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277218iF553C494CBD4E77D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2241072-20171227152504050-362479187.png%22%20alt%3D%2241072-20171227152504050-362479187.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThen%2C%20in%20New%20Stream%20Analytics%20Job%2C%20type%20the%20job%20name%20in%20the%20Job%20name%20box%3B%20Under%20Hosting%20Environment%2C%20select%20Edge%3B%3C%2FP%3E%3CP%3ENext%2C%20under%20Job%20Topology%20in%20the%20job%20you%20create%2C%20select%20Input-Add.%20In%20the%20Input%20alias%20box%2C%20enter%20%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%20%3CSTRONG%3Ethe%20.%3C%2FSTRONG%3E%20In%20the%20Source%20Type%20box%2C%20select%20Data%20Stream.%20Use%20the%20default%20value%20in%20the%20remaining%20fields.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENext%2C%20under%20Job%20Topology%20in%20the%20job%20you%20create%2C%20select%20Output-Add%2C%20type%20alert%20in%20the%20Output%20Alias%20%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%20%3CSTRONG%3Ebox%2C%20and%3C%2FSTRONG%3E%20use%20the%20default%20value%20in%20the%20remaining%20fields.%20Then%20select%20Create.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2241072-20171227152504753-1384925148.png%22%20style%3D%22width%3A%20484px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277220i8B06CA4EB4547D25%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2241072-20171227152504753-1384925148.png%22%20alt%3D%2241072-20171227152504753-1384925148.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EFinally%2C%20under%20Job%20Topology%20in%20the%20job%20you%20create%2C%20select%20Query-Add%2C%20add%20the%20following%20SQL%20statement%2C%20and%20save%20it%3C%2FP%3E%3CP%3E%3CEM%3ESELECT%20%3CBR%20%2F%3E%20'reset'%20AS%20command%20%3CBR%20%2F%3E%20INTO%20%3CBR%20%2F%3E%20alert%20%3CBR%20%2F%3E%20FROM%20%3CBR%20%2F%3E%20temperature%20TIMESTAMP%20BY%20timeCreated%20%3CBR%20%2F%3E%20GROUP%20BY%20TumblingWindow(second%2C30)%20%3CBR%20%2F%3E%20HAVING%20Avg(machine.temperature)%20%26gt%3B%2070%3C%2FEM%3E%3C%2FP%3E%3CP%3E3.%20Deploy%20Stream%20Analytics%20Job%3C%2FP%3E%3CP%3EFirst%2C%20in%20the%20IoTHub%20page%20of%20Azure%20Portal%2C%20go%20to%20IoT%20Edge%20and%20open%20the%20details%20page%20for%20your%20IoT%20Edge%20device.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESelect%20Set%20Modules%20and%20make%20sure%20that%20the%20tempSensor%20module%20has%20been%20added%20in%20accordance%20with%20the%20steps%20in%20the%20previous%20article%2C%20as%20the%20Azure%20Stream%20Analytics%20module%20here%20is%20analyzed%20in%20real%20time%20for%20data%20generated%20by%20the%20tempSensor%20module.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2241072-20171227152505503-1021979573.png%22%20style%3D%22width%3A%20484px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277222iF0038BA8F68C4475%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2241072-20171227152505503-1021979573.png%22%20alt%3D%2241072-20171227152505503-1021979573.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EOn%20the%20Add%20Modules%20page%2C%20select%20Import%20Azure%20Stream%20Analytics%20IoT%20Edge%20Module.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2241072-20171227152505847-1021568978.png%22%20style%3D%22width%3A%20484px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277223iEA38A13226651E34%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2241072-20171227152505847-1021568978.png%22%20alt%3D%2241072-20171227152505847-1021568978.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EOn%20the%20next%20Edge%20Deployment%20page%2C%20select%20the%20previously%20created%20Stream%20Analytics%20-Edge%20Job%2C%20note%20that%20here%20you%20want%20to%20select%20the%20previously%20created%20storage%20account%20and%20Continer%20in%20the%20first%20part%2C%20click%20Save%2C%20as%20shown%20in%20the%20following%20image.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAfter%20that%2C%20copy%20the%20code%20to%20Rutes%20and%20replace%20the%3CEM%3EmoduleName%3C%2FEM%3Ewith%20the%20copied%20module%20name%3A%3C%2FP%3E%3CP%3E%3CEM%3E%7B%20%3CBR%20%2F%3E%20%22routes%22%3A%20%7B%20%3CBR%20%2F%3E%20%22telemetryToCloud%22%3A%20%22FROM%20%2Fmessages%2Fmodules%2FtempSensor%2F*%20INTO%20%24upstream%22%2C%20%3CBR%20%2F%3E%20%22alertsToCloud%22%3A%20%22FROM%20%2Fmessages%2Fmodules%2F%7BmoduleName%7D%2F*%20INTO%20%24upstream%22%2C%20%3CBR%20%2F%3E%20%22alertsToReset%22%3A%20%22FROM%20%2Fmessages%2Fmodules%2F%7BmoduleName%7D%2F*%20INTO%20BrokeredEndpoint(%22%2Fmodules%2FtempSensor%2Finputs%2Fcontrol%22)%22%2C%20%3CBR%20%2F%3E%20%22telemetryToAsa%22%3A%20%22FROM%20%2Fmessages%2Fmodules%2FtempSensor%2F*%20INTO%20BrokeredEndpoint(%22%2Fmodules%2F%7BmoduleName%7D%2Finputs%2Ftemperature%22)%22%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20%7D%3C%2FEM%3E%3C%2FP%3E%3CP%3ESelect%20next%2C%20and%20then%20Submit.%20Go%20back%20to%20the%20Device%20Details%20page%20and%20select%20Refresh.%20You%20should%20see%20that%20the%20new%20flow%20analysis%20module%20is%20already%20in%20the%20list%2C%20but%20the%20state%20is%20still%20in%20Pending%20Deployment.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2241072-20171227152506503-759893304.png%22%20style%3D%22width%3A%20484px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277225i20481060E4B3A73B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2241072-20171227152506503-759893304.png%22%20alt%3D%2241072-20171227152506503-759893304.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EAfter%20a%20while%2C%20when%20the%20Modele%20is%20deployed%20to%20the%20device%2C%20refresh%20the%20list%20and%20discover%20that%20EdgeASA%20is%20already%20in%20a%20run-in%20state.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBack%20to%20the%20Putty%20tool%2C%20you%20can%20view%20the%20log%20information%20for%20stream%20analysis%20using%20the%20%22docker%20logs%20-f%22moduleName%22%20directive%2C%20where%20the%20name%20of%20the%20stream%20analysis%20module%20you%20just%20deployed%20is%20replaced%20by%20the%20%22moduleName%22.%3C%2FP%3E%3CDIV%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20align%3D%22left%22%3EAt%20this%20point%2C%20we%20have%20completed%20the%20creation%20of%20a%20storage%20account%2C%20the%20creation%20of%20Azure%20Stream%20Analytics%20Job%2C%20and%20the%20deployment%20and%20operation%20of%20Azure%20Stream%20Analytics%20Job.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Regular Visitor

实际的生产环境中,IoT 设备可以生成大量的数据。 为了减少上传的数据量或降低控制策略的延时,有时必须在设备端对数据进行实时分析或处理。Azure Stream Analytics 服务就是很好的解决方案之一,用户可以从Azure Portal中创建Azure Stream Analytics 服务,然后在 Azure IoTHub 中将其设置为 IoT Edge Module 并部署到Azure IoT Edge设备上。本文将演示如何创建Azure Stream Analytics Job, 并将其部署到 IoT Edge 设备上。

1. 创建存储账户

      首先,在 Azure 门户中,转到“New”,在搜索框输入“Storage”,选择“Storage account - Blob,file, table, queue”。

 

 

      然后,在“Create Storage Account ”中,输入存储帐户的名称,选择存储IoTHub的同一位置(这里为East Asia),然后选择“Create”。 请记下该名称供稍后使用。

 

 

      接着,转到刚刚创建的存储帐户,选择“Blob Service”。为Azure Stream Analytics 模块创建一个新容器用于存储数据,将访问级别设置为“Container”,选择“确定”。

 

41072-20171227152503488-587073204.png

2. 创建Azure Stream Analytics Job

      首先,在 Azure 门户中,转到“Create” > “Internet of Things”,然后选择“Stream Analytics Job”。

 

41072-20171227152504050-362479187.png

      然后,在“New Stream Analytics Job”中执行以下操作:在“Job name”框中键入作业名称;在”Hosting Environment”下,选择“Edge”;在剩余字段中使用默认值。

      接着,在所创建作业中的“Job Topology”下,依次选择“Input”-“Add”。在“Input alias”框中,输入 temperature。在“Source Type”框中,选择“Data stream”。在剩余字段中使用默认值。

 

 

       接下来,在所创建作业中的“Job Topology”下,依次选择“Output”-“Add”, 在“输出别名”框中,键入 alert,在剩余字段中使用默认值。之后选择“创建” 。

 

41072-20171227152504753-1384925148.png

      最后,在在所创建作业中的“Job Topology”下,依次选择“Query”-“Add”, 加入以下SQL语句并保存

SELECT 
     'reset' AS command
INTO
    alert
FROM
    temperature TIMESTAMP BY timeCreated
GROUP BY TumblingWindow(second,30)
HAVING Avg(machine.temperature) > 70

3. 部署Stream Analytics Job

      首先,在 Azure Portal 的 IoTHub页面内,转到“IoT Edge”并打开 IoT Edge 设备的详细信息页。

 

 

      选择“Set Modules”,并确保已经按照之前文章中的步骤添加了tempSensor模块,因为这里的Azure Stream Analytics模块是针对tempSensor模块产生的数据来进行实时分析的。

 

41072-20171227152505503-1021979573.png

      在“Add Modules”页面,选择“Import Azure Stream Analytics IoT Edge Module”,

 

41072-20171227152505847-1021568978.png

      在接下来的Edge Deployment页面,选择之前创建好的Stream Analytics - Edge Job,注意,这里要选择之前第一部分已经创建好的存储账户和Container,点击保存,如下图所示。

 

 

      之后,将一下代码复制到Routes,将{moduleName}替换为复制的模块名称:

{
     "routes": {                                                              
       "telemetryToCloud": "FROM /messages/modules/tempSensor/* INTO $upstream",
       "alertsToCloud": "FROM /messages/modules/{moduleName}/* INTO $upstream",
       "alertsToReset": "FROM /messages/modules/{moduleName}/* INTO BrokeredEndpoint("/modules/tempSensor/inputs/control")",
       "telemetryToAsa": "FROM /messages/modules/tempSensor/* INTO BrokeredEndpoint("/modules/{moduleName}/inputs/temperature")"
     }
}

      选择下一步,然后Submit。返回到“设备详细信息”页,并选择“刷新”。应会看到新的流分析模块已经在列表中,但是状态还是处于Pending Deployment。

 

41072-20171227152506503-759893304.png

      一段时间以后,等该Module部署到设备以后,刷新列表,可以发现,EdgeASA已经处于running状态。

 

 

      回到Putty工具,利用“docker logs -f {moduleName} ”指令(其中,{moduleName} 用刚刚部署的流分析模块的名称代替),就可以查看流分析的日志信息。

 

 

      至此,我们完成了存储账户的创建、Azure Stream Analytics Job的创建和Azure Stream Analytics Job的部署与运行。

0 Replies