Created
October 14, 2013 16:47
-
-
Save dallasmarlow/6978574 to your computer and use it in GitHub Desktop.
jruby hdfs client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env jruby | |
include Java | |
options = { | |
hdfs_uri: 'hdfs://0.0.0.0:8020/', | |
hadoop_config_path: '/etc/hadoop/conf', | |
hadoop_config_files: ['core-site.xml', 'hdfs-site.xml'], | |
} | |
hdfs_conf = org.apache.hadoop.conf.Configuration.new | |
hdfs_uri = java.net.URI.create options[:hdfs_uri] | |
# add hdfs config from local machine | |
options[:hadoop_config_files].each do |config_file| | |
hdfs_conf.add_resource org.apache.hadoop.fs.Path.new File.join options[:hadoop_config_path], config_file | |
end | |
hdfs = org.apache.hadoop.fs.FileSystem.get hdfs_uri, hdfs_conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment