问题标签 [partitioner]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
25344 浏览

hadoop - 如何在hadoop中按值对字数进行排序?

嗨,我想学习如何在 hadoop 中按值对字数进行排序。我知道 hadoop 采用排序键,但不是按值。

我知道要对值进行排序,我们必须有一个分区器、分组比较器和一个排序比较器

但是我在将这些概念一起应用以按值对字数进行排序时有点困惑。

我们是否需要另一个 map reduce 作业来实现相同的目的,或者需要一个组合器来计算出现次数,然后在这里排序并将相同的结果发送到 reducer?

谁能解释如何按值对字数示例进行排序?

0 投票
1 回答
303 浏览

cassandra - Can I have different partitioners in a multiple datacenter configuration in cassandra?

Can I have RandomPartitioner in the cluster in datacenter1 and Murmur3Partitioner in the cluster in datacenter2?

0 投票
1 回答
80 浏览

hadoop - 在 Hadoop 二级排序中将键值路由到正确的 Reducer

我有三个减速器,我需要它们每个都接收相同的密钥,如下所示:

在分区器中,getPartition() 方法应返回一个 int,指示缩减器的索引(0,1,2)之一。

我拥有的 getPartition() 的实现是:

然而,这在这里不起作用是我得到的:

所以在我得到的输出文件中

问题是我该如何解决这个问题?即我如何编写一个分区函数来保证相同的键进入同一个reducer。

0 投票
4 回答
1537 浏览

hash - Hash value from keys on Cassandra

I'm developing a mechanism for Cassandra using Hector. What I need at this moment is to know which are the hash values of the keys to look at which node is stored (looking at the tokens of each one), and ask directly this node for the value. What I understood is that depending on the partitioner Cassandra uses, the values are stored independently from one partitioner to other. So, are the hash values of all keys stored in any table? In case not, how could I implement a generic class that once I read from System Keyspace the partitioner that is using Cassandra this class could be an instance of it without the necessity of modifying the code depending on the partitioner? I would need it to call the getToken method to calculate the hash value for a given key.

0 投票
0 回答
31 浏览

get - 获取 Cassandra 分区器

我正在使用 Hector 客户端的下一个代码来获取 Cassandra 正在使用的分区器:

但它失败了,返回 NullPointerException。我已经在 cqlsh 中尝试过查询并且它可以工作,但不能使用此代码。有谁知道出了什么问题?

谢谢!

0 投票
2 回答
194 浏览

hadoop - 分区器或多个输出

我想听听您对 Partitioner vs MultipleOutputs 的看法。
假设我有一个包含密钥的文件

我想要 2 个文件:一个文件包含以开头的键0:,另一个包含以1:. 我应该使用哪种方法:
1) 使用自定义分区器,它将解析键并为 getPartition() 返回 0 或 1。
2)在reduce阶段使用MultipleOutputs.write,通过解析key并为MultipleOutputs.write的参数 提供zeroor 。onenamedOutput

哪一个更好?对我来说,1) 更好,因为减速器处理单个文件。

0 投票
1 回答
853 浏览

hadoop - 未调用 hadoop mapreduce 分区程序


我需要有关 mapreduce 工作的帮助,我的自定义分区器从未被调用。我检查了所有内容数百万次,但没有结果。前一阵子还可以用,不知道为什么现在不行了。任何帮助都会非常感激。
我正在添加代码(对于非常简单的情况,它也不适用于自定义键作为输入)。
Mapper 输出正确的值 100%,然后跳过 partitioner。

非常感谢,
亚历克斯

0 投票
2 回答
131 浏览

hadoop - 为什么即使使用单个 reducer 也会调用 Partitioner

如果我们将 MR 作业配置为仅使用单个 reducer 运行,那么不需要调用 Partitioner 似乎是合乎逻辑的。

但是我只是试了一下,看起来分区器被调用了,即使作业配置了一个减速器。

任何想法为什么需要这样做?

0 投票
1 回答
315 浏览

java - 为同一个 reducer 函数收集不同的键 - HADOOP

我想将至少有一个共同整数的键的所有值收集到同一个减速器函数中。例如键“1,2”对应的所有值和键“2,3”对应的所有值都必须始终在同一个reducer函数中,因为这两个键中的整数2常见的。

换句话说,我只是想将“密钥相等条件”更改为另一个条件。

有没有办法做到这一点?它与 Partitioner 类有关还是我必须做一些完全不同的事情?

如果这很重要,我使用 1.2.1 hadoop 版本。

提前致谢!

0 投票
4 回答
169 浏览

java - 为分区器输出单个文件

试图获得与键数一样多的减速器

驱动类

但我将 ootput 放在一个文件中。

我做错什么了吗