简体   繁体   中英

http 045: method not allowed error while loading data to hadoop cluster using knox gateway-0.3.0

I am trying to list data present in hadoop cluster and also copy the data using curl command but i am getting http 405 error. Below is the command i am using.

curl -iku guest:guest-password  -L -T samples/hadoop-examples.jar \
-X PUT  "https://{172.17.198.172}:8443\
/gateway/sandbox/webhdfs/v1/user/guest/knox-sample/lib/hadoop-examples.jar?op=CREATE

I have tried this using the following curl command and had success:

curl -i -v -k -u guest:guest-password -L -T /Users/larry/hadoop-examples.jar -X PUT "https://{localhost}:8443/gateway/sandbox/webhdfs/v1/user/guest/knox-sample/lib/hadoop-examples.jar?op=CREATE"

It resulted in the expected HTTP 100 continue, 307 for the redirect and PUT and 201 created.

A subsequent curl command listed the contents of the target directory successfully listing the file as present:

curl -i -v -k -u guest:guest-password https://localhost:8443/gateway/sandbox/webhdfs/v1/user/guest/knox-sample/lib?op=LISTSTATUS

There are a couple things in curl command that you posed that are a bit odd:

  • The backslash continuation characters seem to be left over maybe from copying examples from somewhere they are not needed
  • You didn't complete the quotes around the URL
  • the {} brackets around the host ip in the URL is probably also left over from a variable in an example that you copied - I don't think that they are hurting anything as I tried it with that and it worked.

I suspect that some combination of the above issues caused the URL to be truncated or something in which a PUT was inappropriate for the received URL and/or operation parameter.

I hope this is helpful for you.

If the user guide isn't clear about this then we would love for you to file a jira and we'll get that resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM