curl "http://mapr4-3:14000/webhdfs/v1/?op=gethomedirectory&user.name=mapr"2. Get directory or file status
curl "http://mapr4-3:14000/webhdfs/v1/tmp/?op=GETFILESTATUS&user.name=mapr" curl "http://mapr4-3:14000/webhdfs/v1/tmp/mapr/Master3.csv?op=GETFILESTATUS&user.name=mapr"3. Download a file
curl -X GET "http://mapr4-3:14000/webhdfs/v1/tmp/mapr/Master.csv?op=OPEN&user.name=mapr"4. Create a directory
curl -X PUT "http://mapr4-3:14000/webhdfs/v1/tmp/testdir?op=MKDIRS&user.name=mapr"5. Upload a file
curl -X PUT -L "http://mapr4-3:14000/webhdfs/v1/tmp/testbyhao.csv?op=CREATE&data=true&user.name=mapr" --header "Content-Type:application/octet-stream" --header "Transfer-Encoding:chunked" -T "/home/mapr/hao/test.csv"6. Append to a file
curl -i -X POST -L -X POST "http://mapr4-3:14000/webhdfs/v1/tmp/testbyhao.csv?op=APPEND&data=true&user.name=mapr" --header "Content-Type:application/octet-stream" --header "Transfer-Encoding:chunked" -T "/home/mapr/hao/test.csv"7. Change permission of a file or directory
curl -i -X PUT "http://mapr4-3:14000/webhdfs/v1/tmp/testbyhao.csv?op=SETPERMISSION&permission=777&user.name=mapr"8. Change owner of a file or directory
curl -i -X PUT "http://mapr4-3:14000/webhdfs/v1/tmp/testbyhao.csv?op=SETOWNER&owner=root&group=root&user.name=mapr"9. Rename a file or directory
curl -i -X PUT "http://mapr4-3:14000/webhdfs/v1/tmp/testbyhao.csv?op=RENAME&destination=testbyhao2.csv&user.name=mapr"10. Delete a file or directory
curl -i -X DELETE "http://mapr4-3:14000/webhdfs/v1/tmp/testbyhao2.csv?op=DELETE&user.name=mapr"
Note:
The reason of adding "&user.name=mapr" is to avoid below error:
HTTP Status 403 - Anonymous requests are disallowed
No comments:
Post a Comment