📅  最后修改于: 2020-11-26 05:28:58             🧑  作者: Mango
集群是OrientDB中的一个重要概念,用于存储记录,文档或顶点。简而言之,集群是存储一组记录的地方。默认情况下,OrientDB将为每个类创建一个集群。一个类的所有记录都存储在同一群集中,该群集与该类具有相同的名称。一个数据库中最多可以创建32,767(2 ^ 15-1)个集群。
CREATE类是用于创建具有特定名称的集群的命令。创建集群后,可以在创建任何数据模型的过程中通过指定名称来使用集群保存记录。如果要将新群集添加到类,请使用“更改类”命令和“ ADDCLUSTER”命令。
以下语句是“创建群集”命令的基本语法。
CREATE CLUSTER [ID ]
其中
下表提供了群集选择策略的列表。
Sr.No. | Strategy & Description |
---|---|
1 |
Default Selects the cluster using the class property default ClusterId. |
2 |
Round-robin Selects the next cluster in a circular order. It is restarting once complete. |
3 |
Balanced Selects the smallest cluster. Allows the class to have all underlying clusters balanced on size. When adding a new cluster to an existing class, it fills the new cluster first. |
让我们以创建一个名为sales的集群为例。
orientdb> CREATE CLUSTER sales
如果上面的查询成功执行,您将获得以下输出。
Cluster created correctly with id #12