数据如何存储在分布式数据库中。在 apache cassandra 中,它同样存储。其他分布式 dbms 的情况如何?

how data is stored in distributed databases. In apache cassandra it is equally stored. How will it be the case in other distributed dbms's?

我在 DataStax 中阅读了有关 Apache Cassandra 的文章,我注意到无论我们要写入的数据如何,都会在所有节点之间平均分配。所有其他分布式数据库管理系统都会如此吗?其他系统会在它们的数据库中平均分配数据吗?如果它们分布不均,那么数据如何在这些分布式数据库之间分布?

I had noticed that whatever the data we are going to write is going to distributed among all the nodes equally.

不一定。您拥有的数据重复级别取决于您的复制因子,该因子是基于每个键 space 设置的。假设我有一个由 3 个节点组成的集群,我这样定义密钥 space:

CREATE KEYSPACE Whosebug
WITH replication = {'class': 'NetworkTopologyStrategy', 'MyDC': '3'};

在这种情况下"yes",我的数据将平均复制到每个节点。但是假设我 运行 磁盘用完 space,并且(作为一家初创公司)我无力购买更大的硬盘驱动器。在这种情况下,我可能会更改我的密钥 space 以将复制因子设为 2:

CREATE KEYSPACE Whosebug
WITH replication = {'class': 'NetworkTopologyStrategy', 'MyDC': '2'};

这样一来,每个节点只负责我三分之二的数据。当然,这里的缺点是我现在只能承受集群中单个节点的丢失。

Is it will be the case in all other distributed database management systems? Will other systems distribute the data among their databases equally?

简单地说,"no"和"no."

If they don't distribute equally then how the data is distributed among those distributed databases?

因为那里有数百个分布式 DBMS(包括 NoSQL 和 RDBMS,它们在某种程度上声称是 "distributed"),我无法开始总结(甚至一般地)它们是如何分布数据的.但我要说的是,其中有几个利用 "shard key" and/or "secondary nodes" 的概念来实现分布和规模。

在 Cassandra 中,所有节点都是平等的...没有 "master node." 的概念,但有些系统有 "primary" 或 "master" 节点的概念,以及"secondary" 个节点。在这些场景中,master 处理所有写操作,并将数据复制到一个或多个 secondary。使用分片键,将一定范围的分片值分配给每个节点。然后数据仅存储在负责数据分片键所属范围的节点上。