Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 02-17-2016 04:09 PM
Since Apache Drill not supported as of now, i need to find out the way to call web-service
Created 02-17-2016 04:13 PM
So you want to read/write files in HDFS?
This is what webhdfs is for:
https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html
Created 02-17-2016 04:10 PM
WebHCat
# this will execute a hive query and save result to hdfs file in your home directory called output
curl -s -d execute="select+*+from+sample_08;" \
-d statusdir="output" \
'http://localhost:50111/templeton/v1/hive?user.name=root'
# if you ls on the directory, it will have two files, stderr and stdout
hdfs dfs -ls output
# if the job succeeded, you can cat the stdout file and view the results
hdfs dfs -cat output/stdout
WebHDFS
# list the output directory, notice the webhdfs port
curl -i "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/?op=LISTSTATUS"
# read the output file
curl -i -L "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/stdout?op=OPEN"
# rename a file, if you get dr. who error, add &user.name=root or any other user in the context
curl -i -X PUT "sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/stdout?op=RENAME&user.name=root&destination=/user/root/newname"
# read the output of the new file
curl -i -L "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/newname?op=OPEN"
Created 02-17-2016 04:15 PM
Thanks Artem, but I may have to use SOAP/REST from another client to read or write the data into HDFS... so any idea about that?
Created 02-17-2016 04:20 PM
you can use the hdfs java api and wrap your rest code? http://tutorials.techmytalk.com/2014/08/16/hadoop-hdfs-java-api/ @Balaji Bobba
Created 02-17-2016 04:26 PM
Thanks, this may work I will look into this.
Created 02-17-2016 04:27 PM
@Balaji Bobba you're welcome, try it out and post your solution.
Created 02-17-2016 04:13 PM
So you want to read/write files in HDFS?
This is what webhdfs is for:
https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html
Created 02-17-2016 04:25 PM
Thanks Benjamin, I will look into this.