How to write and read files to / from Hadoop HDFS using Ruby?

Is there any way to work with Api HDFS using Ruby? As I understand it, there is no multilingual Api file, and the only way is to use the native Java Api. I tried to use JRuby, but this solution is unstable and not very native. I also looked at the HDFS Thrift Api, but it is not complete, and also lacks many functions (for example, for writing to indexed files).

Is there a way to work with HDFS using Ruby besides using JRuby or Thrift Api?

+3
source share
1 answer

github , , . ruby-hdfs C HDFS Ruby. ganapati Thrift.

. :

cmd = "hadoop fs -mkdir #{hdfs_path}"
cmd += " 2> /dev/null"
system(cmd)
if $? == 0
  puts 'ok'
  exit(0)
else
  puts "Error: failed to create hdfs://#{hdfs_path}"
  exit(2)
end
+8

Source: https://habr.com/ru/post/1751927/


All Articles