Closed zhy989 closed 7 years ago
I can not create trigger MyMessageHubTrigger successfully.
@zhy989 For interactive support, please join us on Slack: https://openwhisk.incubator.apache.org/slack.html
In the meantime, you will be able to find more details about why you cannot create a trigger successfully by looking at the logs for activation 69c08183c6c74241ba96c4ff6512f549
. To do this, run wsk activation get 69c08183c6c74241ba96c4ff6512f549
and examine the logs
field.
@bjustin-ibm thanks
wsk -i activation logs b898ea7d32aa438a9e5bd697feaf8fe9 2017-08-05T06:17:35.470076218Z stdout: Error creating trigger: { 2017-08-05T06:17:35.470155869Z stdout: "name": "RequestError", 2017-08-05T06:17:35.470163159Z stdout: "message": "Error: getaddrinfo ENOTFOUND https https:443", 2017-08-05T06:17:35.470168151Z stdout: "cause": { 2017-08-05T06:17:35.470172346Z stdout: "code": "ENOTFOUND", 2017-08-05T06:17:35.470176705Z stdout: "errno": "ENOTFOUND", 2017-08-05T06:17:35.470181028Z stdout: "syscall": "getaddrinfo", 2017-08-05T06:17:35.470185235Z stdout: "hostname": "https", 2017-08-05T06:17:35.470189677Z stdout: "host": "https", 2017-08-05T06:17:35.47019376Z stdout: "port": 443 2017-08-05T06:17:35.470198175Z stdout: }, 2017-08-05T06:17:35.470203938Z stdout: "error": { 2017-08-05T06:17:35.470208061Z stdout: "code": "ENOTFOUND", 2017-08-05T06:17:35.470212246Z stdout: "errno": "ENOTFOUND", 2017-08-05T06:17:35.470216439Z stdout: "syscall": "getaddrinfo", 2017-08-05T06:17:35.470220611Z stdout: "hostname": "https", 2017-08-05T06:17:35.470226979Z stdout: "host": "https", 2017-08-05T06:17:35.470236839Z stdout: "port": 443 2017-08-05T06:17:35.470241158Z stdout: }, 2017-08-05T06:17:35.470273276Z stdout: "options": { 2017-08-05T06:17:35.470277356Z stdout: "method": "PUT", 2017-08-05T06:17:35.470291858Z stdout: "url": "https://https://localhost:32519/api/v1/web/whisk.system/messagingWeb/messageHubFeedWeb.http", 2017-08-05T06:17:35.470297895Z stdout: "rejectUnauthorized": false, 2017-08-05T06:17:35.470302195Z stdout: "json": true, 2017-08-05T06:17:35.470306305Z stdout: "body": { 2017-08-05T06:17:35.470320764Z stdout: "authKey": "789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP", 2017-08-05T06:17:35.47033109Z stdout: "topic": "mytopic", 2017-08-05T06:17:35.470335409Z stdout: "triggerName": "/whisk.system/MyMessageHubTrigger" 2017-08-05T06:17:35.470339821Z stdout: }, 2017-08-05T06:17:35.470343837Z stdout: "headers": { 2017-08-05T06:17:35.47034804Z stdout: "Content-Type": "application/json", 2017-08-05T06:17:35.470352288Z stdout: "Accept": "text/plain", 2017-08-05T06:17:35.470356496Z stdout: "User-Agent": "whisk" 2017-08-05T06:17:35.470360713Z stdout: }, 2017-08-05T06:17:35.470391133Z stdout: "simple": true, 2017-08-05T06:17:35.47039595Z stdout: "resolveWithFullResponse": false, 2017-08-05T06:17:35.470400331Z stdout: "transform2xxOnly": false 2017-08-05T06:17:35.470404667Z stdout: } 2017-08-05T06:17:35.470408642Z stdout: }
wsk -i activation logs faa436652b33430a963096897d5abe5a 2017-08-05T06:17:36.158335344Z stdout: Error deleting trigger: { 2017-08-05T06:17:36.158400819Z stdout: "name": "RequestError", 2017-08-05T06:17:36.158409838Z stdout: "message": "Error: getaddrinfo ENOTFOUND https https:443", 2017-08-05T06:17:36.158414926Z stdout: "cause": { 2017-08-05T06:17:36.158419299Z stdout: "code": "ENOTFOUND", 2017-08-05T06:17:36.158423583Z stdout: "errno": "ENOTFOUND", 2017-08-05T06:17:36.158427929Z stdout: "syscall": "getaddrinfo", 2017-08-05T06:17:36.15843222Z stdout: "hostname": "https", 2017-08-05T06:17:36.158439866Z stdout: "host": "https", 2017-08-05T06:17:36.158446166Z stdout: "port": 443 2017-08-05T06:17:36.158539889Z stdout: }, 2017-08-05T06:17:36.158546657Z stdout: "error": { 2017-08-05T06:17:36.158559109Z stdout: "code": "ENOTFOUND", 2017-08-05T06:17:36.15856813Z stdout: "errno": "ENOTFOUND", 2017-08-05T06:17:36.158582766Z stdout: "syscall": "getaddrinfo", 2017-08-05T06:17:36.15859823Z stdout: "hostname": "https", 2017-08-05T06:17:36.158602383Z stdout: "host": "https", 2017-08-05T06:17:36.15860658Z stdout: "port": 443 2017-08-05T06:17:36.158610748Z stdout: }, 2017-08-05T06:17:36.158614621Z stdout: "options": { 2017-08-05T06:17:36.15861871Z stdout: "method": "DELETE", 2017-08-05T06:17:36.158627156Z stdout: "url": "https://https://localhost:32519/api/v1/web/whisk.system/messagingWeb/messageHubFeedWeb.http", 2017-08-05T06:17:36.158633653Z stdout: "rejectUnauthorized": false, 2017-08-05T06:17:36.158637924Z stdout: "json": true, 2017-08-05T06:17:36.158642076Z stdout: "body": { 2017-08-05T06:17:36.158646974Z stdout: "authKey": "789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP", 2017-08-05T06:17:36.158651574Z stdout: "topic": "mytopic", 2017-08-05T06:17:36.158655786Z stdout: "triggerName": "/whisk.system/MyMessageHubTrigger" 2017-08-05T06:17:36.158660277Z stdout: }, 2017-08-05T06:17:36.158664227Z stdout: "headers": { 2017-08-05T06:17:36.158668377Z stdout: "Content-Type": "application/json", 2017-08-05T06:17:36.158672635Z stdout: "Accept": "text/plain", 2017-08-05T06:17:36.158676655Z stdout: "User-Agent": "whisk" 2017-08-05T06:17:36.158680727Z stdout: }, 2017-08-05T06:17:36.158684372Z stdout: "simple": true, 2017-08-05T06:17:36.15868838Z stdout: "resolveWithFullResponse": false, 2017-08-05T06:17:36.158692405Z stdout: "transform2xxOnly": false 2017-08-05T06:17:36.158696484Z stdout: } 2017-08-05T06:17:36.158700301Z stdout: }
Ah ok... the most likely problem is that localhost
does not resolve to what you think it does. Keep in mind that actions run inside docker containers, and name resolution for things like localhost
and 127.0.0.1
get a little tricky.
I suggest that instead of using localhost
as your edgehost
and apihost
argument values when installing the actions, you use a real IP address that can be used for cross-container communication: https://github.com/bjustin-ibm/openwhisk-package-kafka/blob/5f9c08daa845b7c376f236e6cc8ede9a32243138/devGuide.md#install-actions
@bjustin-ibm thanks ! I update the ip address from localhost to 172.17.0.1, but there is another failure about "Could not authenticate with Message Hub. Please check your credentials" with messageHub and "connection error" with kafkaMessage
The log is as below:
wsk -i activation logs dfa140ac32d94b458bdb52056658fbc7 2017-08-09T08:14:21.619050308Z stdout: Error creating trigger: { 2017-08-09T08:14:21.619087376Z stdout: "name": "StatusCodeError", 2017-08-09T08:14:21.619091409Z stdout: "statusCode": 500, 2017-08-09T08:14:21.61909419Z stdout: "message": "500 - \"Could not authenticate with Message Hub. Please check your credentials.\"", 2017-08-09T08:14:21.619098159Z stdout: "error": "Could not authenticate with Message Hub. Please check your credentials.", 2017-08-09T08:14:21.619100844Z stdout: "options": { 2017-08-09T08:14:21.619103049Z stdout: "method": "PUT", 2017-08-09T08:14:21.619105524Z stdout: "url": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/messageHubFeedWeb.http", 2017-08-09T08:14:21.619107919Z stdout: "rejectUnauthorized": false, 2017-08-09T08:14:21.61911018Z stdout: "json": true, 2017-08-09T08:14:21.619112377Z stdout: "body": { 2017-08-09T08:14:21.619114898Z stdout: "authKey": "789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP", 2017-08-09T08:14:21.619117412Z stdout: "kafka_brokers_sasl": [ 2017-08-09T08:14:21.619119613Z stdout: "kafka01-prod01.messagehub.services.us-south.bluemix.net:9093", 2017-08-09T08:14:21.619121844Z stdout: "kafka02-prod01.messagehub.services.us-south.bluemix.net:9093", 2017-08-09T08:14:21.619133953Z stdout: "kafka03-prod01.messagehub.services.us-south.bluemix.net:9093" 2017-08-09T08:14:21.619137142Z stdout: ], 2017-08-09T08:14:21.619139602Z stdout: "isJSONData": true, 2017-08-09T08:14:21.619141929Z stdout: "kafka_admin_url": "https://kafka-admin-prod01.messagehub.services.us-south.bluemix.net:443", 2017-08-09T08:14:21.619144551Z stdout: "topic": "mytopic", 2017-08-09T08:14:21.619146802Z stdout: "user": "", 2017-08-09T08:14:21.619149821Z stdout: "triggerName": "/whisk.system/MyMessageHubTrigger", 2017-08-09T08:14:21.619152212Z stdout: "password": "" 2017-08-09T08:14:21.619154572Z stdout: }, 2017-08-09T08:14:21.619156595Z stdout: "headers": { 2017-08-09T08:14:21.619158762Z stdout: "Content-Type": "application/json", 2017-08-09T08:14:21.619160909Z stdout: "Accept": "text/plain", 2017-08-09T08:14:21.619163024Z stdout: "User-Agent": "whisk" 2017-08-09T08:14:21.619165407Z stdout: }, 2017-08-09T08:14:21.619168625Z stdout: "simple": true, 2017-08-09T08:14:21.61917201Z stdout: "resolveWithFullResponse": false, 2017-08-09T08:14:21.619175706Z stdout: "transform2xxOnly": false 2017-08-09T08:14:21.619179148Z stdout: }, 2017-08-09T08:14:21.619182378Z stdout: "response": { 2017-08-09T08:14:21.619185724Z stdout: "statusCode": 500, 2017-08-09T08:14:21.619189488Z stdout: "body": "Could not authenticate with Message Hub. Please check your credentials.", 2017-08-09T08:14:21.619193472Z stdout: "headers": { 2017-08-09T08:14:21.619203766Z stdout: "server": "nginx/1.11.13", 2017-08-09T08:14:21.619208512Z stdout: "date": "Wed, 09 Aug 2017 08:14:21 GMT", 2017-08-09T08:14:21.619212396Z stdout: "content-type": "text/plain", 2017-08-09T08:14:21.619231211Z stdout: "content-length": "71", 2017-08-09T08:14:21.619234996Z stdout: "connection": "close", 2017-08-09T08:14:21.619238744Z stdout: "access-control-allow-origin": "*", 2017-08-09T08:14:21.619243008Z stdout: "access-control-allow-methods": "OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH", 2017-08-09T08:14:21.619247074Z stdout: "access-control-allow-headers": "Authorization, Content-Type" 2017-08-09T08:14:21.619250843Z stdout: }, 2017-08-09T08:14:21.619254203Z stdout: "request": { 2017-08-09T08:14:21.619257728Z stdout: "uri": { 2017-08-09T08:14:21.619261254Z stdout: "protocol": "https:", 2017-08-09T08:14:21.619264957Z stdout: "slashes": true, 2017-08-09T08:14:21.61926851Z stdout: "auth": null, 2017-08-09T08:14:21.619272071Z stdout: "host": "172.17.0.1", 2017-08-09T08:14:21.619275757Z stdout: "port": 443, 2017-08-09T08:14:21.619279277Z stdout: "hostname": "172.17.0.1", 2017-08-09T08:14:21.619282954Z stdout: "hash": null, 2017-08-09T08:14:21.619292772Z stdout: "search": null, 2017-08-09T08:14:21.619296406Z stdout: "query": null, 2017-08-09T08:14:21.619299978Z stdout: "pathname": "/api/v1/web/whisk.system/messagingWeb/messageHubFeedWeb.http", 2017-08-09T08:14:21.619303997Z stdout: "path": "/api/v1/web/whisk.system/messagingWeb/messageHubFeedWeb.http", 2017-08-09T08:14:21.619308034Z stdout: "href": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/messageHubFeedWeb.http" 2017-08-09T08:14:21.619311934Z stdout: }, 2017-08-09T08:14:21.619315359Z stdout: "method": "PUT", 2017-08-09T08:14:21.619319085Z stdout: "headers": { 2017-08-09T08:14:21.619322662Z stdout: "Content-Type": "application/json", 2017-08-09T08:14:21.619326472Z stdout: "Accept": "text/plain", 2017-08-09T08:14:21.619330203Z stdout: "User-Agent": "whisk", 2017-08-09T08:14:21.619333952Z stdout: "content-length": 552 2017-08-09T08:14:21.619337568Z stdout: } 2017-08-09T08:14:21.619340911Z stdout: } 2017-08-09T08:14:21.61934429Z stdout: } 2017-08-09T08:14:21.619347611Z stdout: }
wsk trigger create MyKafkaTrigger -f /whisk.system/messaging/kafkaFeed -p brokers "[\"mykafkahost:9092\", \"mykafkahost:9093\"]" -p topic mytopic -p isJSONData true -i
the error log is as below:
@zhy989 I think the first case is pretty clear... it appears that the Message Hub credentials you are trying to use are not correct. Please verify them.
In the second case, it seems most likely that you are not escaping quotes properly in the value of your brokers
parameter. As it turns out, you can also use a comma-separated list of brokers, rather than trying to get your shell to properly interpret a JSON array. For example:
-p brokers "mykafkahost:9092,mykafkahost:9093"
Of course this assumes that mykafkahost
can really be resolved, and that it represents a valid Kafka cluster at those ports, and that you have tested and verified that it is working properly using something other than the feed provider service (for example, using a Kafka client).
@bjustin-ibm thanks in case 1: Should I register a new account on the local host for message hub? in case 2: I tried this CLI "wsk trigger create MyKafkaTrigger -f /whisk.system/messaging/kafkaFeed -p brokers "mykafkahost:9092,mykafkahost:9093" -p topic mytopic -p isJSONData true -i", and got the same error
wsk trigger create MyKafkaTrigger -f /whisk.system/messaging/kafkaFeed -p brokers "mykafkahost:9092,mykafkahost:9093" -p topic mytopic -p isJSONData true -i ok: invoked /whisk.system/messaging/kafkaFeed with id fff3cab0fde142e98ac81ba3a98db38c { "activationId": "fff3cab0fde142e98ac81ba3a98db38c", "annotations": [ { "key": "limits", "value": { "logs": 10, "memory": 256, "timeout": 60000 } }, { "key": "path", "value": "whisk.system/messaging/kafkaFeed" } ], "duration": 991, "end": 1502359181855, "logs": [], "name": "kafkaFeed", "namespace": "whisk.system", "publish": false, "response": { "result": { "error": "Error: error happened in your connection" }, "status": "application error", "success": false }, "start": 1502359180864, "subject": "whisk.system", "version": "0.0.2" } ok: invoked /whisk.system/messaging/kafkaFeed with id c0cb00c7f1964151a2aabd5f35ef8d4f { "activationId": "c0cb00c7f1964151a2aabd5f35ef8d4f", "annotations": [ { "key": "limits", "value": { "logs": 10, "memory": 256, "timeout": 60000 } }, { "key": "path", "value": "whisk.system/messaging/kafkaFeed" } ], "duration": 501, "end": 1502359182811, "logs": [], "name": "kafkaFeed", "namespace": "whisk.system", "publish": false, "response": { "result": {}, "status": "success", "success": true }, "start": 1502359182310, "subject": "whisk.system", "version": "0.0.2" } ok: deleted trigger MyKafkaTrigger
wsk -i activation logs fff3cab0fde142e98ac81ba3a98db38c 2017-08-10T09:59:41.851044685Z stdout: Error creating trigger: { 2017-08-10T09:59:41.851069919Z stdout: "name": "StatusCodeError", 2017-08-10T09:59:41.851073662Z stdout: "statusCode": 500, 2017-08-10T09:59:41.851076502Z stdout: "message": "500 - \"Error: error happened in your connection\"", 2017-08-10T09:59:41.851081688Z stdout: "error": "Error: error happened in your connection", 2017-08-10T09:59:41.851084534Z stdout: "options": { 2017-08-10T09:59:41.851087266Z stdout: "method": "PUT", 2017-08-10T09:59:41.851090286Z stdout: "url": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-10T09:59:41.85109325Z stdout: "rejectUnauthorized": false, 2017-08-10T09:59:41.851095837Z stdout: "json": true, 2017-08-10T09:59:41.851098218Z stdout: "body": { 2017-08-10T09:59:41.851100973Z stdout: "authKey": "789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP", 2017-08-10T09:59:41.851103755Z stdout: "isJSONData": true, 2017-08-10T09:59:41.851107298Z stdout: "brokers": "mykafkahost:9092,mykafkahost:9093", 2017-08-10T09:59:41.851109876Z stdout: "topic": "mytopic", 2017-08-10T09:59:41.851112397Z stdout: "triggerName": "/whisk.system/MyKafkaTrigger" 2017-08-10T09:59:41.851115008Z stdout: }, 2017-08-10T09:59:41.851117353Z stdout: "headers": { 2017-08-10T09:59:41.851119788Z stdout: "Content-Type": "application/json", 2017-08-10T09:59:41.851122322Z stdout: "Accept": "text/plain", 2017-08-10T09:59:41.851150998Z stdout: "User-Agent": "whisk" 2017-08-10T09:59:41.851155301Z stdout: }, 2017-08-10T09:59:41.851157521Z stdout: "simple": true, 2017-08-10T09:59:41.851160009Z stdout: "resolveWithFullResponse": false, 2017-08-10T09:59:41.851162485Z stdout: "transform2xxOnly": false 2017-08-10T09:59:41.851164913Z stdout: }, 2017-08-10T09:59:41.851167255Z stdout: "response": { 2017-08-10T09:59:41.851170448Z stdout: "statusCode": 500, 2017-08-10T09:59:41.851172917Z stdout: "body": "Error: error happened in your connection", 2017-08-10T09:59:41.85117544Z stdout: "headers": { 2017-08-10T09:59:41.851177892Z stdout: "server": "nginx/1.11.13", 2017-08-10T09:59:41.851180284Z stdout: "date": "Thu, 10 Aug 2017 09:59:41 GMT", 2017-08-10T09:59:41.851182731Z stdout: "content-type": "text/plain", 2017-08-10T09:59:41.851185084Z stdout: "content-length": "40", 2017-08-10T09:59:41.851187482Z stdout: "connection": "close", 2017-08-10T09:59:41.851189864Z stdout: "access-control-allow-origin": "*", 2017-08-10T09:59:41.851192389Z stdout: "access-control-allow-methods": "OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH", 2017-08-10T09:59:41.851202513Z stdout: "access-control-allow-headers": "Authorization, Content-Type" 2017-08-10T09:59:41.851204948Z stdout: }, 2017-08-10T09:59:41.851206935Z stdout: "request": { 2017-08-10T09:59:41.851209048Z stdout: "uri": { 2017-08-10T09:59:41.851211189Z stdout: "protocol": "https:", 2017-08-10T09:59:41.851213461Z stdout: "slashes": true, 2017-08-10T09:59:41.851215585Z stdout: "auth": null, 2017-08-10T09:59:41.8512177Z stdout: "host": "172.17.0.1", 2017-08-10T09:59:41.851219983Z stdout: "port": 443, 2017-08-10T09:59:41.851222118Z stdout: "hostname": "172.17.0.1", 2017-08-10T09:59:41.85122426Z stdout: "hash": null, 2017-08-10T09:59:41.85122631Z stdout: "search": null, 2017-08-10T09:59:41.85122837Z stdout: "query": null, 2017-08-10T09:59:41.851230457Z stdout: "pathname": "/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-10T09:59:41.851232714Z stdout: "path": "/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-10T09:59:41.851238986Z stdout: "href": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http" 2017-08-10T09:59:41.851241403Z stdout: }, 2017-08-10T09:59:41.851243452Z stdout: "method": "PUT", 2017-08-10T09:59:41.851245659Z stdout: "headers": { 2017-08-10T09:59:41.851247768Z stdout: "Content-Type": "application/json", 2017-08-10T09:59:41.85125001Z stdout: "Accept": "text/plain", 2017-08-10T09:59:41.851252218Z stdout: "User-Agent": "whisk", 2017-08-10T09:59:41.85125436Z stdout: "content-length": 242 2017-08-10T09:59:41.851256519Z stdout: } 2017-08-10T09:59:41.851258496Z stdout: } 2017-08-10T09:59:41.851260433Z stdout: } 2017-08-10T09:59:41.851262341Z stdout: }
Should I start up the catalog_kafkatrigger container before create the trigger ? if do and how to start up that container?
Please keep in mind that this feed provider (the code in this repo) interacts with an external service - either a Message Hub instance or generic Kafka cluster. This feed provider cannot work without having the external service created and in working order. Following the README and running the example commands (which only have example parameter values) will almost definitely not work without being changed so that the parameter values match your specific instance of Kafka or Message Hub. I suggest you first become familiar with Kafka and/or Message Hub before attempting to run this software.
Should I register a new account on the local host for message hub?
Message Hub is the name of a service hosted in IBM Bluemix. It is essentially Bluemix-hosted Kafka, and is not something you can run locally. Please see the following for details: https://developer.ibm.com/messaging/message-hub/
Should I start up the catalog_kafkatrigger container before create the trigger ? if do and how to start up that container?
Yes, if you are trying to build and run your own instance of the feed provider service, please carefully follow this development guide: https://github.com/bjustin-ibm/openwhisk-package-kafka/blob/1aa6ae1684930d5175fa0ce36886b2e7db123248/devGuide.md However, please be sure you have a working Kafka or Message Hub instance created, configured, tested, and working before attempting this.
@bjustin-ibm thanks in case 1
I can sign in Bluemix with my username and password, why can not authenticate with Message Hub with the same username and password when I run the CLI "wsk -i trigger create MyMessageHubTrigger -f myMessageHub/messageHubFeed -p topic mytopic -p isJSONData true -p"?
in case 2 I try to run the example for "https://github.com/bjustin-ibm/openwhisk-package-kafka/blob/1aa6ae1684930d5175fa0ce36886b2e7db123248/devGuide.md"
I can create docker image kafkafeedprovider successfully but when I run script docker_run.sh, there is an error:
cat docker_run.sh
WSK_HOME=/openwhisk
DB_PROTOCOL=awk -F "=" '/db_protocol/ {print $2}' $WSK_HOME/ansible/db_local.ini
DB_HOST=awk -F "=" '/db_host/ {print $2}' $WSK_HOME/ansible/db_local.ini
DB_PORT=awk -F "=" '/db_port/ {print $2}' $WSK_HOME/ansible/db_local.ini
DB_USER=awk -F "=" '/db_username/ {print $2}' $WSK_HOME/ansible/db_local.ini
DB_PWD=awk -F "=" '/db_password/ {print $2}' $WSK_HOME/ansible/db_local.ini
DB_PREFIX=test
docker run -e DB_URL="https://172.17.0.1:5984" -e DB_USER=$DB_USER -e DB_PASS=$DB_PWD -p 81:5000 kafkafeedprovider
Traceback (most recent call last):
File "app.py", line 24, in
In here it must be CLOUDANT_USER ? couchdb_user can not ?
Setting up a Message Hub package outside Bluemix Is this install Message Hub package on the local host outside Bluemix?
No. This only installs the related actions into your OpenWhisk. It does not create a Message Hub or Kafka instance that you can use.
I can sign in Bluemix with my username and password, why can not authenticate with Message Hub with the same username and password
You have to first provision a Message Hub instance in Bluemix. When you do this, a set of Message Hub credentials (that are different from your Bluemix username and password) will be generated. You will need to use these credentials when creating the trigger. Please refer to the Getting Started with Message Hub documentation.
I can create docker image kafkafeedprovider successfully but when I run script docker_run.sh, there is an error
It appears that you are using an older version of the feed provider that used to require a CLOUDANT_USER
environment variable. Please update your repository to the latest in the master branch, then rebuild the image, and start a new container.
@bjustin-ibm thanks! Can Kafka instance run on the local host outside the Bluemix?
Yes, please refer to the following Apache Kafka guides: https://kafka.apache.org/intro https://kafka.apache.org/quickstart
@bjustin-ibm thanks
I had run Kafka instance successfully follow "https://kafka.apache.org/quickstart".
I re download the code from "https://github.com/bjustin-ibm/openwhisk-package-kafka" and update to the master branch .
run the docker image and got the same error as before:
I download code from "https://github.com/apache/incubator-openwhisk-package-kafka" run the docker image and got the error as below
I re download the code from "https://github.com/bjustin-ibm/openwhisk-package-kafka" and update to the master branch .
Ok, you definitely don't want the code from my fork, especially not from the master branch as I never bother to update it.
I download code from "https://github.com/apache/incubator-openwhisk-package-kafka" run the docker image and got the error as below
While this is the code you want, it seems it is unable to connect to your CouchDB or Cloudant instance. Please verify that your DB is running and that the parameters you have supplied as environment variables regarding your DB details are correct: https://github.com/bjustin-ibm/openwhisk-package-kafka/blob/1aa6ae1684930d5175fa0ce36886b2e7db123248/devGuide.md#mandatory-environment-variables
Keep in mind that the environment variable values shown in the example command are just that, examples. They almost certainly will not work in your environment without editing them to contain the correct information (i.e. your DB URL and credentials).
@bjustin-ibm thanks! I had run the docker image(kafkafeedprovider) successfully.
then I try to create kafka trigger with CLI :
It failed , the logs is as below:
wsk -i activation logs 5c4ec13b87ca48698dbee7dbc7b10e0b 2017-08-15T09:50:34.511516922Z stdout: Error creating trigger: { 2017-08-15T09:50:34.511548026Z stdout: "name": "StatusCodeError", 2017-08-15T09:50:34.511552003Z stdout: "statusCode": 500, 2017-08-15T09:50:34.511554501Z stdout: "message": "500 - \"Error: error happened in your connection\"", 2017-08-15T09:50:34.511557142Z stdout: "error": "Error: error happened in your connection", 2017-08-15T09:50:34.511559611Z stdout: "options": { 2017-08-15T09:50:34.511561707Z stdout: "method": "PUT", 2017-08-15T09:50:34.511564397Z stdout: "url": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-15T09:50:34.511570175Z stdout: "rejectUnauthorized": false, 2017-08-15T09:50:34.511572303Z stdout: "json": true, 2017-08-15T09:50:34.511574498Z stdout: "body": { 2017-08-15T09:50:34.51157697Z stdout: "authKey": "789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP", 2017-08-15T09:50:34.51158097Z stdout: "isJSONData": true, 2017-08-15T09:50:34.511584471Z stdout: "brokers": "mykafkahost:9092, mykafkahost:9093", 2017-08-15T09:50:34.511588192Z stdout: "topic": "mytopic", 2017-08-15T09:50:34.511591885Z stdout: "triggerName": "/whisk.system/MyKafkaTrigger" 2017-08-15T09:50:34.511595503Z stdout: }, 2017-08-15T09:50:34.511598525Z stdout: "headers": { 2017-08-15T09:50:34.511602038Z stdout: "Content-Type": "application/json", 2017-08-15T09:50:34.511605702Z stdout: "Accept": "text/plain", 2017-08-15T09:50:34.511609225Z stdout: "User-Agent": "whisk" 2017-08-15T09:50:34.511612934Z stdout: }, 2017-08-15T09:50:34.511618017Z stdout: "simple": true, 2017-08-15T09:50:34.511621631Z stdout: "resolveWithFullResponse": false, 2017-08-15T09:50:34.511625174Z stdout: "transform2xxOnly": false 2017-08-15T09:50:34.511628593Z stdout: }, 2017-08-15T09:50:34.511631863Z stdout: "response": { 2017-08-15T09:50:34.511635333Z stdout: "statusCode": 500, 2017-08-15T09:50:34.511639172Z stdout: "body": "Error: error happened in your connection", 2017-08-15T09:50:34.511643199Z stdout: "headers": { 2017-08-15T09:50:34.511646877Z stdout: "server": "nginx/1.11.13", 2017-08-15T09:50:34.511650606Z stdout: "date": "Tue, 15 Aug 2017 09:50:34 GMT", 2017-08-15T09:50:34.511654232Z stdout: "content-type": "text/plain", 2017-08-15T09:50:34.511657958Z stdout: "content-length": "40", 2017-08-15T09:50:34.511665314Z stdout: "connection": "close", 2017-08-15T09:50:34.511669132Z stdout: "access-control-allow-origin": "*", 2017-08-15T09:50:34.511672832Z stdout: "access-control-allow-methods": "OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH", 2017-08-15T09:50:34.511676677Z stdout: "access-control-allow-headers": "Authorization, Content-Type" 2017-08-15T09:50:34.511685393Z stdout: }, 2017-08-15T09:50:34.511687738Z stdout: "request": { 2017-08-15T09:50:34.511689919Z stdout: "uri": { 2017-08-15T09:50:34.511692036Z stdout: "protocol": "https:", 2017-08-15T09:50:34.511694244Z stdout: "slashes": true, 2017-08-15T09:50:34.511696371Z stdout: "auth": null, 2017-08-15T09:50:34.511698541Z stdout: "host": "172.17.0.1", 2017-08-15T09:50:34.511700745Z stdout: "port": 443, 2017-08-15T09:50:34.511702822Z stdout: "hostname": "172.17.0.1", 2017-08-15T09:50:34.511705026Z stdout: "hash": null, 2017-08-15T09:50:34.511707119Z stdout: "search": null, 2017-08-15T09:50:34.511709216Z stdout: "query": null, 2017-08-15T09:50:34.511711206Z stdout: "pathname": "/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-15T09:50:34.511713473Z stdout: "path": "/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-15T09:50:34.511715696Z stdout: "href": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http" 2017-08-15T09:50:34.511717947Z stdout: }, 2017-08-15T09:50:34.511719883Z stdout: "method": "PUT", 2017-08-15T09:50:34.511721968Z stdout: "headers": { 2017-08-15T09:50:34.511724161Z stdout: "Content-Type": "application/json", 2017-08-15T09:50:34.511726298Z stdout: "Accept": "text/plain", 2017-08-15T09:50:34.511728373Z stdout: "User-Agent": "whisk", 2017-08-15T09:50:34.511730533Z stdout: "content-length": 243 2017-08-15T09:50:34.511732625Z stdout: } 2017-08-15T09:50:34.511734607Z stdout: } 2017-08-15T09:50:34.511736582Z stdout: } 2017-08-15T09:50:34.511738502Z stdout:
}
Is the variable values about brokers (-p brokers "mykafkahost:9092, mykafkahost:9093" ) right? Should I set the brokers variable to the service port of the docker image(kafkafeedprovider) or set to localhost:9092 ?
I tried both borkers , and got the same error ""Error: error happened in your connection".
Is the variable values about brokers (-p brokers "mykafkahost:9092, mykafkahost:9093" ) right?
Almost certainly not. These are just example values that need to be replaced with the hostname and port of the brokers in your Kafka cluster.
@bjustin-ibm thanks
Is docker image( kafkafeedprovider) a kafka server ?
When I run the docker image (kafkafeedprovider), the service port is set to 8081 on the host and 5000 in the container ( -p 8081:5000) .
so when I create the kafka trigger , the brokers is set to localhost:8081, is right? I have tried brokers (-p localhost:8081), there is also connect error as before.
bin/kafka-topics.sh --list --zookeeper localhost:2181 __consumer_offsets completed completed0 health invoker0 test test1
wsk trigger create MyKafkaTrigger -f /whisk.system/messaging/kafkaFeed -p brokers "localhost:8081" -p topic test -p isJSONData true -i ok: invoked /whisk.system/messaging/kafkaFeed with id 9c21eb1067b346d1997433e95728a1c6 { "activationId": "9c21eb1067b346d1997433e95728a1c6", "annotations": [ { "key": "limits", "value": { "logs": 10, "memory": 256, "timeout": 60000 } }, { "key": "path", "value": "whisk.system/messaging/kafkaFeed" } ], "duration": 871, "end": 1502865968399, "logs": [], "name": "kafkaFeed", "namespace": "whisk.system", "publish": false, "response": { "result": { "error": "Error: error happened in your connection" }, "status": "application error", "success": false }, "start": 1502865967528, "subject": "whisk.system", "version": "0.0.3" } ok: invoked /whisk.system/messaging/kafkaFeed with id e6657b45d465419bbfe94c29ff501ac1 { "activationId": "e6657b45d465419bbfe94c29ff501ac1", "annotations": [ { "key": "limits", "value": { "logs": 10, "memory": 256, "timeout": 60000 } }, { "key": "path", "value": "whisk.system/messaging/kafkaFeed" } ], "duration": 476, "end": 1502865969295, "logs": [], "name": "kafkaFeed", "namespace": "whisk.system", "publish": false, "response": { "result": {}, "status": "success", "success": true }, "start": 1502865968819, "subject": "whisk.system", "version": "0.0.3" } ok: deleted trigger MyKafkaTrigger Run 'wsk --help' for usage.
wsk -i activation logs 9c21eb1067b346d1997433e95728a1c6 2017-08-16T06:46:08.396704825Z stdout: Error creating trigger: { 2017-08-16T06:46:08.396728812Z stdout: "name": "StatusCodeError", 2017-08-16T06:46:08.396732511Z stdout: "statusCode": 500, 2017-08-16T06:46:08.396735284Z stdout: "message": "500 - \"Error: error happened in your connection\"", 2017-08-16T06:46:08.396740819Z stdout: "error": "Error: error happened in your connection", 2017-08-16T06:46:08.396743554Z stdout: "options": { 2017-08-16T06:46:08.396746034Z stdout: "method": "PUT", 2017-08-16T06:46:08.396749189Z stdout: "url": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-16T06:46:08.396751943Z stdout: "rejectUnauthorized": false, 2017-08-16T06:46:08.396754359Z stdout: "json": true, 2017-08-16T06:46:08.396756718Z stdout: "body": { 2017-08-16T06:46:08.396759626Z stdout: "authKey": "789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP", 2017-08-16T06:46:08.396762437Z stdout: "isJSONData": true, 2017-08-16T06:46:08.396764717Z stdout: "brokers": "localhost:8081", 2017-08-16T06:46:08.396767046Z stdout: "topic": "test", 2017-08-16T06:46:08.396769378Z stdout: "triggerName": "/whisk.system/MyKafkaTrigger" 2017-08-16T06:46:08.396771913Z stdout: }, 2017-08-16T06:46:08.396774162Z stdout: "headers": { 2017-08-16T06:46:08.396776529Z stdout: "Content-Type": "application/json", 2017-08-16T06:46:08.396779016Z stdout: "Accept": "text/plain", 2017-08-16T06:46:08.396782523Z stdout: "User-Agent": "whisk" 2017-08-16T06:46:08.39678525Z stdout: }, 2017-08-16T06:46:08.396788051Z stdout: "simple": true, 2017-08-16T06:46:08.396791449Z stdout: "resolveWithFullResponse": false, 2017-08-16T06:46:08.396793877Z stdout: "transform2xxOnly": false 2017-08-16T06:46:08.396796278Z stdout: }, 2017-08-16T06:46:08.396798535Z stdout: "response": { 2017-08-16T06:46:08.39680085Z stdout: "statusCode": 500, 2017-08-16T06:46:08.396803204Z stdout: "body": "Error: error happened in your connection", 2017-08-16T06:46:08.3968056Z stdout: "headers": { 2017-08-16T06:46:08.39680798Z stdout: "server": "nginx/1.11.13", 2017-08-16T06:46:08.39681216Z stdout: "date": "Wed, 16 Aug 2017 06:46:08 GMT", 2017-08-16T06:46:08.396814566Z stdout: "content-type": "text/plain", 2017-08-16T06:46:08.396816927Z stdout: "content-length": "40", 2017-08-16T06:46:08.396819228Z stdout: "connection": "close", 2017-08-16T06:46:08.396821491Z stdout: "access-control-allow-origin": "*", 2017-08-16T06:46:08.396823937Z stdout: "access-control-allow-methods": "OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH", 2017-08-16T06:46:08.396833285Z stdout: "access-control-allow-headers": "Authorization, Content-Type" 2017-08-16T06:46:08.396835978Z stdout: }, 2017-08-16T06:46:08.396838049Z stdout: "request": { 2017-08-16T06:46:08.396840247Z stdout: "uri": { 2017-08-16T06:46:08.396842455Z stdout: "protocol": "https:", 2017-08-16T06:46:08.396844856Z stdout: "slashes": true, 2017-08-16T06:46:08.396847365Z stdout: "auth": null, 2017-08-16T06:46:08.396849529Z stdout: "host": "172.17.0.1", 2017-08-16T06:46:08.396851801Z stdout: "port": 443, 2017-08-16T06:46:08.396853956Z stdout: "hostname": "172.17.0.1", 2017-08-16T06:46:08.396856123Z stdout: "hash": null, 2017-08-16T06:46:08.396858143Z stdout: "search": null, 2017-08-16T06:46:08.396860231Z stdout: "query": null, 2017-08-16T06:46:08.396862275Z stdout: "pathname": "/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-16T06:46:08.396864507Z stdout: "path": "/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http", 2017-08-16T06:46:08.396866766Z stdout: "href": "https://172.17.0.1/api/v1/web/whisk.system/messagingWeb/kafkaFeedWeb.http" 2017-08-16T06:46:08.396868992Z stdout: }, 2017-08-16T06:46:08.396870968Z stdout: "method": "PUT", 2017-08-16T06:46:08.396875857Z stdout: "headers": { 2017-08-16T06:46:08.396878069Z stdout: "Content-Type": "application/json", 2017-08-16T06:46:08.396880417Z stdout: "Accept": "text/plain", 2017-08-16T06:46:08.396882657Z stdout: "User-Agent": "whisk", 2017-08-16T06:46:08.396884838Z stdout: "content-length": 220 2017-08-16T06:46:08.39688712Z stdout: } 2017-08-16T06:46:08.396889328Z stdout: } 2017-08-16T06:46:08.396891398Z stdout: } 2017-08-16T06:46:08.396893462Z stdout: }
@zhy989 No, the kafkaFeedProvider image does not contain a Kafka server. However, the OpenWhisk core system does use one. This is the one from which you managed to list topics (e.g. "health", "completed"). I highly recommend you do not use this kafka for anything, and let it stay dedicated to the needs of the OpenWhisk core system. Instead I suggest you set up your own separate kafka server.
Also, please remember that "localhost" only resolves relative to the environment where the action runs. As such, when the feed action runs in a docker container, "localhost" very likely does not resolve to the IP address you think it does. It is always best to use specific IP addresses (that are not 127.0.0.1).
@bjustin-ibm thanks I have created the kafka trigger successfully, the reason is the couchdb url should be http not https.
I follow below CLI
There is a 's' . I remove the 's', the kafka trigger can be created successfully.
Then I create rule iot1 related MyKafkaTrigger1 and hello action , when I produce a message to kafka, but the helloworld action did not run . When kafka received a message how to trigger the hello action ?
wsk trigger create MyKafkaTrigger1 -f /whisk.system/messaging/kafkaFeed -p brokers "×××:9092" -p topic mytopic -p isJSONData true -i ok: invoked /whisk.system/messaging/kafkaFeed with id 0f42764f28794c439eb07ca643990fbc { "activationId": "0f42764f28794c439eb07ca643990fbc", "annotations": [ { "key": "limits", "value": { "logs": 10, "memory": 256, "timeout": 60000 } }, { "key": "path", "value": "whisk.system/messaging/kafkaFeed" } ], "duration": 1191, "end": 1502949731923, "logs": [], "name": "kafkaFeed", "namespace": "whisk.system", "publish": false, "response": { "result": { "uuid": "f7684a93-c510-43f7-8bea-ab82c4b05877" }, "status": "success", "success": true }, "start": 1502949730732, "subject": "whisk.system", "version": "0.0.10" } ok: created trigger MyKafkaTrigger1
wsk -i rule create iot1 MyKafkaTrigger1 hello ok: created rule iot1
wsk action invoke /whisk.system/messaging/kafkaProduce -p brokers "×××:9092" -p topic mytopic -p value "This is the content of my message" -i ok: invoked /whisk.system/messaging/kafkaProduce with id 5e5ed2151ecd4a79ac2576ee38f0bab3
@zhy989 First verify that the message was indeed produced. Yes, the action should fail if the produce was not successful, but it helps to be sure. You can verify by doing wsk activation get 5e5ed2151ecd4a79ac2576ee38f0bab3
and examining the result. It should say something like "Successfully sent message to {topic}:{partition} at offset {offset}"
Next, verify whether or not the trigger has fired in response to the message. You can do this by looking for trigger activations with wsk activation list MyKafkaTrigger1
. If this returns nothing, then your trigger is not firing, and you should examine the container logs to figure out why.
If the trigger is firing, then similarly verify whether or not the rule is being invoked. This can be done with wsk activation list iot1
. If this list is empty then your rule has likely not been created properly. However, given the set of commands you show above, this seems very unlikely.
If the rule is firing, then check to see if your action is being invoked with wsk activation list hello
. If this list is empty, then your action is not being invoked. If everything up to this point has been working, this seems very unlikely as well.
In all, you need to use the procedure above to see where in the chain of expected events things are not happening. Once you find that point, look at the activation for the last successful part of the chain to examine the result and logs to look for clues about why the next step is failing. If it seems that the trigger is not firing at all, use the docker logs
command to examine the kafkaFeedProvider container to see why the trigger isn't working.
@bjustin-ibm thanks! The action can be invoked successfully when I set verify to False from line "response = requests.post(self.triggerURL, json=payload, timeout=10.0, verify=False)" in file "incubator-openwhisk-package-kafka/provider/consumer.py"
@zhy989 ah very nice! Any easier way to handle this situation is to set the LOCAL_DEV
environment variable to true
when starting the container: https://github.com/apache/incubator-openwhisk-package-kafka/blob/master/devGuide.md#optional-environment-variables
Doing this will allow you to use the code unchanged, while still allowing the service to POST to trigger URLs in your local OpenWhisk.
@bjustin-ibm thanks! I have tried to set the LOCAL_DEV environment variable to true, it works well without modify code, thanks!
I installed the message package successfully
-wsk -i package list packages /whisk.system/messagingWeb private /whisk.system/messaging shared /whisk.system/alarmsWeb private /whisk.system/alarms shared /whisk.system/combinators shared /whisk.system/watson-speechToText shared /whisk.system/samples shared /whisk.system/watson-translator shared /whisk.system/slack shared /whisk.system/websocket shared /whisk.system/github shared /whisk.system/utils shared /whisk.system/weather shared /whisk.system/watson-textToSpeech shared
wsk -i package refresh error: Package refresh for namespace '_' failed: The requested resource could not be found. (code 7175)
wsk -i package refresh /whisk.system error: Package refresh for namespace 'whisk.system' failed: The requested resource could not be found. (code 7187)
why the CLI "wsk -i package refresh" failed ?