Cassandra + Spark 执行器超融合

Cassandra + Spark executor hyperconvergence

由于 Apache Spark 是建议用于 Cassandra 的分布式处理引擎,我知道有可能 运行 Spark 执行器与 Cassandra 节点一起使用。 我的问题是驱动程序和 Spark 连接器是否足够智能以理解分区和分片分配,以便以超融合方式处理数据。

简单地说,执行者是否从托管在执行者正在 运行 的节点上的分区中读取存储的数据,因此不会像 Spark 在 运行 结束时那样通过网络传输不必要的数据HDFS?

是的,Spark Cassandra 连接器能够做到这一点。来自 source code:

The getPreferredLocations method tells Spark the preferred nodes to fetch a partition from, so that the data for the partition are at the same node the task was sent to. If Cassandra nodes are collocated with Spark nodes, the queries are always sent to the Cassandra process running on the same node as the Spark Executor process, hence data are not transferred between nodes. If a Cassandra node fails or gets overloaded during read, the queries are retried to a different node.

理论上是的。 HDFS 也一样。然而实际上我在云上看到的较少,当使用它们的云服务时,单独的节点用于 spark 和 Cassandra。如果你使用 IAsAS 并设置你自己的 Cassandra 和 Spark 那么你就可以实现它。

我想补充 Alex 的回答:

Yes, Spark Cassandra Connector is able to do this. From the source code:

The getPreferredLocations method tells Spark the preferred nodes to fetch a partition from, so that the data for the partition are at the same node the task was sent to. If Cassandra nodes are collocated with Spark nodes, the queries are always sent to the Cassandra process running on the same node as the Spark Executor process, hence data are not transferred between nodes. If a Cassandra node fails or gets overloaded during read, the queries are retried to a different node.

这是一种不良行为。

在Cassandra中,当您请求获取特定分区的数据时,只会访问一个节点。由于复制,Spark 实际上可以访问 3 个节点。因此,如果不进行洗牌,您将有 3 个节点参与这项工作。

然而在Hadoop中,当你要求获取特定分区的数据时,通常会访问集群中的所有节点,然后Spark使用集群中的所有节点作为执行者。

因此,如果您有 100 个节点:在 Cassandra 中,Spark 将利用 3 个节点。在 Hadoop 中,Spark 将利用 100 个节点。

Cassandra 针对实时操作系统进行了优化,因此并未针对数据湖等分析进行优化。