遗憾的是,可用的Cygnus版本不支持OAuth2.到目前为止.您将必须升级到最新的 0.8.2 ,该版本允许通过以下OrionHDFSSink参数配置令牌:<your_agent_nam>.sinks.<your_hdfs_sink_name>.oauth2_token = <token>升级到Cygnus 0.8.2就像从FIWARE存储库中安装它一样容易:$ (sudo) yum clean all # just to clean the yum cache$ (sudo) yum list cygnus # this will show you 0.82 is available$ (sudo) sudo rpm -e -vv --allmatches --nodeps --noscripts --notriggers cygnus # this is needed if you have installed a version < 0.8.0$ (sudo) yum install cygnus # this installs 0.8.2请记住,通过编辑/etc/yum.repos.d/fiware.repo(很可能您已经拥有)来设置FIWARE存储库:[Fiware]name=FIWARE repositorybaseurl=http://repositories.testbed.fi-ware.eu/repo/rpm/x86_64/gpgcheck=0enabled=1在下面的示例中,我们正在从0.7.0版本升级到最新的0.8.2:$ sudo yum clean allLoaded plugins: fastestmirror, securityCleaning repos: ...Cleaning up EverythingCleaning up list of fastest mirrors$ sudo yum list cygnusLoaded plugins: fastestmirror, securityDetermining fastest mirrors * base: sunsite.rediris.es * epel: ftp.cica.es * extras: sunsite.rediris.es * updates: sunsite.rediris.es... Installed Packagescygnus.x86_64 0.7.0-g4cddd26 @FiwareAvailable Packagescygnus.x86_64 0.8.2-0.g7353160 Fiware $ sudo rpm -e -vv --allmatches --nodeps --noscripts --notriggers cygnusD: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.keyD: couldn't find any keys in /var/lib/rpm/pubkeys/*.keyD: loading keyring from rpmdb...D: closed db index /var/lib/rpm/NameD: closed db index /var/lib/rpm/PackagesD: closed db environment /var/lib/rpm$ sudo yum install cygnusLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile * base: sunsite.rediris.es * epel: ftp.cica.es * extras: sunsite.rediris.es * updates: sunsite.rediris.esSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package cygnus.x86_64 0:0.7.0-g4cddd26 will be updated---> Package cygnus.x86_64 0:0.8.2-0.g7353160 will be an update--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================== Package Arch Version Repository Size==============================================================================================================================================================Updating: cygnus x86_64 0.8.2-0.g7353160 Fiware 94 MTransaction Summary==============================================================================================================================================================Upgrade 1 Package(s)Total download size: 94 MIs this ok [y/N]:Downloading Packages:cygnus-0.8.2-0.g7353160.x86_64.rpm | 94 MB 00:03 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Updating : cygnus-0.8.2-0.g7353160.x86_64 1/2 [INFO] Creating cygnus user[INFO] Creating log directoryDone Cleanup : cygnus-0.7.0-g4cddd26.x86_64 2/2 [INFO] Uninstall the cygnusStopping Cygnus chatrooms... [ OK ][INFO] Deleting linksrm: no se puede borrar «/etc/cygnus/flume.conf»: No existe el fichero o el directorio[INFO] Removing application log files[INFO] Deleting the cygnus folder[INFO] Deleting the cygnus userDoneUpdated: cygnus.x86_64 0:0.8.2-0.g7353160 Complete!为了检查您的版本是否正确,您可以做一些事情.例如,使用rpm命令:$ rpm -qa | grep cygnuscygnus-0.8.2-0.g7353160.x86_64或使用yum list:$ (sudo) yum list cygnusLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile * base: sunsite.rediris.es * epel: ftp.cica.es * extras: sunsite.rediris.es * updates: sunsite.rediris.esInstalled Packagescygnus.x86_64 0.8.2-0.g7353160 @Fiware或者只是检查oauth2_token参数是否存在;)$ cat /usr/cygnus/conf/agent.conf.template |grep oauth2_tokencygnusagent.sinks.hdfs-sink.oauth2_token = xxxxxxxx 重要:备份您的Cygnus配置,因为这些配置在进行少量更改后仍然有效:请注意您是否使用了Cygnus版本< Java软件包0.8.0已更改.现在,它们不再是es.tid.fiware.fiwareconnectors.cygnus.etc而是com.telefonica.iot.cygus.etc.从Cygnus 0.8.1开始,配置文件matching_table.conf(类似于CSV的内容)现在被命名为grouping_rules.conf(类似于CSV的语义类似的JSON内容).Since it was announced the access to Cosmos' WebHDFS in FIWARE Lab is protected with OAuth2, Cygnus (version 0.8.1) is not able to persist Orion's context data in Cosmos HDFS: 15/07/09 08:45:21 INFO handlers.OrionRestHandler: Starting transaction (1436424291-649-0000000000)15/07/09 08:45:21 INFO handlers.OrionRestHandler: Received data ({ "subscriptionId" : "51c0ac9ed714fb3b37d7d5a8", "originator" : "localhost", "contextResponses" : [ { "contextElement" : { "attributes" : [ { "name" : "temperature", "type" : "centigrade", "value" : "26.5" } ], "type" : "Room", "isPattern" : "false", "id" : "Room1" }, "statusCode" : { "code" : "200", "reasonPhrase" : "OK" } } ]})15/07/09 08:45:21 INFO handlers.OrionRestHandler: Event put in the channel (id=109760451, ttl=10)15/07/09 08:45:21 INFO sinks.OrionSink: Event got from the channel (id=109760451, headers={timestamp=1436424321536, content-type=application/json, transactionId=1436424291-649-0000000000, fiware-service=def_serv, fiware-servicepath=def_serv_path, ttl=10, destination=room1_room}, bodyLength=460)15/07/09 08:45:22 INFO sinks.OrionHDFSSink: [hdfs-sink] Persisting data at OrionHDFSSink. HDFS file (def_serv/def_serv_path/room1_room/room1_room.txt), Data ({"recvTime":"2015-07-09T06:45:21.536Z","temperature":"26.5", "temperature_md":[]})15/07/09 08:45:22 ERROR sinks.OrionSink: Persistence error (The /user/frb/def_serv/def_serv_path/room1_room directory could not be created in HDFS. HttpFS response: 503 Service unavailable)15/07/09 08:45:22 INFO sinks.OrionSink: An event was put again in the channel (id=109760451, ttl=9)15/07/09 08:45:22 INFO sinks.OrionSink: Finishing transaction (1436424291-649-0000000000)I figure out an OAuth2 token has to be configured somewhere, but how? 解决方案 IMPORTANT: Before implementing any of the commands below, backup your Cygnus configurations since they will be still valid with minor changes.Sadly, available Cygnus versions have no support for OAuth2. Until now. You will have to upgrade to the latest 0.8.2, which allows to configure a token through this OrionHDFSSink parameter:<your_agent_nam>.sinks.<your_hdfs_sink_name>.oauth2_token = <token>Upgrading to Cygnus 0.8.2 is as easy as installing it from the FIWARE repo:$ (sudo) yum clean all # just to clean the yum cache$ (sudo) yum list cygnus # this will show you 0.82 is available$ (sudo) sudo rpm -e -vv --allmatches --nodeps --noscripts --notriggers cygnus # this is needed if you have installed a version < 0.8.0$ (sudo) yum install cygnus # this installs 0.8.2Remember the FIWARE repo is setup by editing /etc/yum.repos.d/fiware.repo (most probably you already have it):[Fiware]name=FIWARE repositorybaseurl=http://repositories.testbed.fi-ware.eu/repo/rpm/x86_64/gpgcheck=0enabled=1In the example below, we are moving from a 0.7.0 version to latest 0.8.2:$ sudo yum clean allLoaded plugins: fastestmirror, securityCleaning repos: ...Cleaning up EverythingCleaning up list of fastest mirrors$ sudo yum list cygnusLoaded plugins: fastestmirror, securityDetermining fastest mirrors * base: sunsite.rediris.es * epel: ftp.cica.es * extras: sunsite.rediris.es * updates: sunsite.rediris.es... Installed Packagescygnus.x86_64 0.7.0-g4cddd26 @FiwareAvailable Packagescygnus.x86_64 0.8.2-0.g7353160 Fiware $ sudo rpm -e -vv --allmatches --nodeps --noscripts --notriggers cygnusD: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.keyD: couldn't find any keys in /var/lib/rpm/pubkeys/*.keyD: loading keyring from rpmdb...D: closed db index /var/lib/rpm/NameD: closed db index /var/lib/rpm/PackagesD: closed db environment /var/lib/rpm$ sudo yum install cygnusLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile * base: sunsite.rediris.es * epel: ftp.cica.es * extras: sunsite.rediris.es * updates: sunsite.rediris.esSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package cygnus.x86_64 0:0.7.0-g4cddd26 will be updated---> Package cygnus.x86_64 0:0.8.2-0.g7353160 will be an update--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================== Package Arch Version Repository Size==============================================================================================================================================================Updating: cygnus x86_64 0.8.2-0.g7353160 Fiware 94 MTransaction Summary==============================================================================================================================================================Upgrade 1 Package(s)Total download size: 94 MIs this ok [y/N]:Downloading Packages:cygnus-0.8.2-0.g7353160.x86_64.rpm | 94 MB 00:03 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Updating : cygnus-0.8.2-0.g7353160.x86_64 1/2 [INFO] Creating cygnus user[INFO] Creating log directoryDone Cleanup : cygnus-0.7.0-g4cddd26.x86_64 2/2 [INFO] Uninstall the cygnusStopping Cygnus chatrooms... [ OK ][INFO] Deleting linksrm: no se puede borrar «/etc/cygnus/flume.conf»: No existe el fichero o el directorio[INFO] Removing application log files[INFO] Deleting the cygnus folder[INFO] Deleting the cygnus userDoneUpdated: cygnus.x86_64 0:0.8.2-0.g7353160 Complete!In order to check you have the right version, you can do several things. For instance, using the rpm command:$ rpm -qa | grep cygnuscygnus-0.8.2-0.g7353160.x86_64Or using the yum list:$ (sudo) yum list cygnusLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfile * base: sunsite.rediris.es * epel: ftp.cica.es * extras: sunsite.rediris.es * updates: sunsite.rediris.esInstalled Packagescygnus.x86_64 0.8.2-0.g7353160 @FiwareOr simply check the oauth2_token parameter is there ;)$ cat /usr/cygnus/conf/agent.conf.template |grep oauth2_tokencygnusagent.sinks.hdfs-sink.oauth2_token = xxxxxxxxIMPORTANT: Backup your Cygnus configurations since they will be still valid with minor changes:Please observe if you were using a Cygnus version < 0.8.0 the Java packages have changed. Now, they are no more es.tid.fiware.fiwareconnectors.cygnus.etc but com.telefonica.iot.cygus.etc.From Cygnus 0.8.1 the configuration file matching_table.conf (CSV-like content) now is named as grouping_rules.conf (JSON-like content with the same semantic than the CSV-like version). 这篇关于天鹅座中的OAuth2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-15 22:03