In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
FileSystem fs = FiileSystem.get (new URI ("hdfs://hadoop1:9000"), new Configuration ())
You can create a fs object in this way, but when you use a blank Configuration object, only the property fs.default.name is actually granted. When the accessed HDFS uses HA (multiple parameters are required to be specified at the same time), or when you need to specify other settings, there will be a problem.
Configuration conf = new Configuration ()
Conf.addResource (new Path ("conf/core-site.xml"))
Conf.addResource (new Path ("conf/hdfs-site.xml"))
FileSystem fs = FiileSystem.get (conf)
The FS created in this way is more flexible and convenient. Because it reads the settings in xml directly, you can also call the conf.set method to set a single property if necessary.
In addition, there are several forms of addResource, one of which is addResource (String fileName), and the argument passed in is the file name. This form is strongly dependent on CLASS_PATH, and the program will only look for the file name in CLASS_PATH, and it is invalid to write a path in the file name.
Another form of addResource is addResource (Path file), which does not depend on CLASS_PATH and can specify a path during new Path, whether it is debugging in program development or when the parameter files are relatively fixed at deployment time.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.