首页 \ 问答 \ 如何根据hadoop中的特定条件在一个datanode上存储数据?(How to store data on one datanode based on specific criteria in hadoop?)

如何根据hadoop中的特定条件在一个datanode上存储数据?(How to store data on one datanode based on specific criteria in hadoop?)

是否有可能将数据保存在hadoop中的一个数据节点上,这意味着它不是(或非常有限,就像它用完空间时)分布在整个系统中(复制很好)。 就像我保留每分钟的记录日志并将它们存储在hadoop上的文件夹结构中,如下所示:

/年月日

现在我想强制hadoop将例如每个月的文件夹存储在一个(或者更多,如果超出空间)datanode,所以当我执行读取请求时,namenode应该在最好的情况下只返回一个datanode作为数据块的位置。

这可能吗? 如何在Java中实现(比如在datanode上将所有文件基于父文件夹的哈希分组)? 或者这是一个hadoop配置?


Is it possible to keep data on one datanode in hadoop, meaning it is not (or very limited like when it runs out of space) distributed across the system (replication is fine). Like I keep record logs for every minute and store them in a folder structure on hadoop that looks like this:

/year/month/day

Now I want to force hadoop to store e.g. every month folder on one (or more if space is exceeded) datanode only, so when I perform a read request the namenode should in the best case only return one datanode as the location of the data blocks.

Is this possible? How would an implementation in Java look like (like grouping all files based on the hash of the parent folders together on a datanode)? Or this this a hadoop configuration?


原文:https://stackoverflow.com/questions/37603415
更新时间:2021-09-24 14:09

最满意答案

-jar开关旨在将jar作为独立程序启动。 如java手册页中所述:

使用-jar选项时,指定的JAR文件是所有用户类的源,并忽略其他类路径设置。

要提供类路径,请使用清单文件中的Class-Path条目。

深入阅读: Java™教程:将类添加到JAR文件的类路径


The -jar switch is intended to launch the jar as a self contained program. As stated in the java man page:

When you use the -jar option, the specified JAR file is the source of all user classes, and other class path settings are ignored.

To provide a classpath, use the Class-Path entry in the manifest file.

Further reading: The Java™ Tutorials: Adding Classes to the JAR File's Classpath

相关问答

更多
  • 不是每个jar文件都是可执行的。 现在,您需要在java文件中导入jar下的类。 例如, import org.xml.sax.SAXException; 如果您正在使用IDE,那么您应该参考其文档。 或者至少在这个线程中指定你在这里使用哪一个。 这肯定会使我们能够进一步帮助你。 如果您没有使用任何IDE,那么请查看javac -cp选项。 但是,将程序打包到一个jar文件中,并且包括所有必需的jar在这里是更好的主意。 那么,为了执行你的jar ,就像, java -jar my_program.jar ...
  • 我已经对此进行了一些实验,并且任何从JRuby调用代码的尝试都会返回jruby jar本身,这种情况有意义,因为逻辑确实是从那个jar中评估/执行的。 例如: require 'java' puts self.to_java.get_class().protection_domain().code_source().location().path() 要么 require 'java' class Path def get_jar_path self.to_java.get_class(). ...
  • 快速浏览一下jWebSocket后,问题可能只是包名称中的区分大小写。 尝试import org.jwebsocket.*; 这应该让你的代码编译。 另一方面,让它做一些有用的事情...... :)尝试网站上的JavaDocs( jWebSocket网站上的Java / JS Docs链接) 更新:包org.jwebsocket中实际上没有任何内容。 org.jwebsocket.console中有一个类,所以请尝试import org.jwebsocket.console.*; After a quick ...
  • 如果使用-jar,则忽略-cp: -罐 执行封装在JAR文件中的程序。 第一个参数是JAR文件的名称,而不是启动类名称。 为了使此选项有效,JAR文件的清单必须包含Main-Class:classname形式的一行。 这里,classname标识具有public static void main(String[] args)方法的类,该方法充当应用程序的起点。 有关使用Jar文件和Jar文件清单的信息,请参阅Jar工具参考页面和Java Tutorial的Jar跟踪。 使用此选项时,JAR文件是所有用户类的 ...
  • 吉姆,是的,你是对的。 实际上,我并没有完全遵循需要做的事情。 虽然指出哪个部分我错了,而不是标准的RTFM响应,你可能会更有帮助。 对于其他未来的人来说,这里是完整的/正确的/清理过的“make”批处理文件...... @echo off setlocal cls set HOME_DIR=D:\current\battle set CLASS_DIR=classes set SRC_DIR=src set CLASS_NAME=RemoveFiles set STUB=stub.bat cd /d ...
  • -jar开关旨在将jar作为独立程序启动。 如java手册页中所述: 使用-jar选项时,指定的JAR文件是所有用户类的源,并忽略其他类路径设置。 要提供类路径,请使用清单文件中的Class-Path条目。 深入阅读: Java™教程:将类添加到JAR文件的类路径 The -jar switch is intended to launch the jar as a self contained program. As stated in the java man page: When you use the ...
  • 这是因为你的类路径不正确。 试试这样: java -cp "/Notepad.jar" notepad.Notepad 如果这不起作用,则解压缩jar文件并确认包和类名是否正确,打印CLASSPATH env变量或检查java和javac版本。 This is because your classpath is not correct. Try it like this: java -cp "/Notepad.jar" notepad.Notepad If this does n ...
  • 我使用了命令: c:\installers> java -cp App1.jar com.RTC 它说: Exception in thread "main" java.lang.NoClassDefFoundError: org.openqa.selenium.WebDriver 该异常通常意味着找到.class文件,但它不包含正确的类。 检查你如何将它放入JAR。 它的目录和文件名必须与其包和类名相匹配。 它有时似乎也意味着没有找到二级课程。 通常,主JAR文件的清单的class-path条目中提到 ...
  • 可能你需要编写一个自定义类加载器(扩展ClassLoader),它允许你加载/卸载jar。 如果你可以卸载jar,你应该能够删除jar。 有用的链接http://docs.oracle.com/javase/tutorial/deployment/jar/jarclassloader.html 我可以动态卸载和重新加载(相同的其他版本)JAR吗? May be you would need to write a custom class loader(extending ClassLoader) which ...
  • 问题是标准类加载器找不到位于另一个JAR中的JAR中的类。 Class-Path清单变量实际上是告诉JVM将当前目录中的mylib.jar文件添加到类路径中。 有三种解决方案: 将mylib.jar文件放在可以找到的位置(并相应地设置清单属性)。 创建一个Uber-jar,它将主JAR中的类和所有相关的库JAR组合成一个JAR文件。 编写一个时髦的类加载器,它知道如何从JAR-in-a-JAR加载,并修改应用程序以实例化并使用类加载器。 (不推荐这种方法......) 请注意,前两个替代方案通过以不同方式摆 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)