且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

cassandra nosql 数据库中的节点、集群和数据中心有什么区别?

更新时间:2023-02-08 16:52:17

Cassandra 中元素的层次结构是:

The hierarchy of elements in Cassandra is:

  • 集群
    • 数据中心
      • 机架
        • 服务器
          • 节点(更准确地说,是一个 vnode)

          集群是数据中心的集合.

          A Cluster is a collection of Data Centers.

          数据中心是机架的集合.

          A Data Center is a collection of Racks.

          机架是服务器的集合.

          一个服务器默认包含 256 个虚拟节点(或 vnodes).

          A Server contains 256 virtual nodes (or vnodes) by default.

          vnode 是服务器内的数据存储层.

          A vnode is the data storage layer within a server.

          注意:服务器是 Cassandra 软件.服务器安装在机器上,其中机器可以是物理服务器、EC2 实例或类似的.

          Note: A server is the Cassandra software. A server is installed on a machine, where a machine is either a physical server, an EC2 instance, or similar.

          现在专门解决您的问题.

          Now to specifically address your questions.

          单个数据单元称为分区.是的,分区是跨多个节点复制的.分区的每个副本称为一个副本.

          An individual unit of data is called a partition. And yes, partitions are replicated across multiple nodes. Each copy of the partition is called a replica.

          在多数据中心集群中,复制是按数据中心进行的.例如,如果您在旧金山有一个名为 dc-sf 的数据中心,在纽约有另一个名为 dc-ny 的数据中心,那么您可以控制每个数据中心的副本数量.

          In a multi-data center cluster, the replication is per data center. For example, if you have a data center in San Francisco named dc-sf and another in New York named dc-ny then you can control the number of replicas per data center.

          例如,您可以将 dc-sf 设置为 3 个副本,将 dc-ny 设置为 2 个副本.

          As an example, you could set dc-sf to have 3 replicas and dc-ny to have 2 replicas.

          这些数字称为复制因子.您可以特别说 dc-sf 的复制因子为 3,而 dc-ny 的复制因子为 2.简单来说,dc-sf 将具有分布在三个 vnode 上的 3 个数据副本,而 dc-sf 将具有2 个数据副本分布在两个 vnode 上.

          Those numbers are called the replication factor. You would specifically say dc-sf has a replication factor of 3, and dc-ny has a replication factor of 2. In simple terms, dc-sf would have 3 copies of the data spread across three vnodes, while dc-sf would have 2 copies of the data spread across two vnodes.

          虽然默认情况下每个服务器有 256 个 vnode,但 Cassandra 足够聪明,可以选择存在于不同物理服务器上的 vnode.

          While each server has 256 vnodes by default, Cassandra is smart enough to pick vnodes that exist on different physical servers.

          总结:

          • 跨多个虚拟节点复制数据(每个服务器默认包含 256 个虚拟节点)
          • 数据的每个副本称为一个副本
          • 数据的单位称为分区
          • 复制由每个数据中心控制