Orientdb 简明教程

OrientDB - Alter Cluster

Alter Cluster 命令用于更新现有集群上的属性。在本部分中,您可以了解如何添加或修改集群的属性。

Alter Cluster command is to update attributes on an existing cluster. In this chapter you can learn how to add or modify the attributes of a cluster.

以下语句是 Alter Cluster 命令的基本语法。

The following statement is the basic syntax of Alter Cluster command.

ALTER CLUSTER <cluster> <attribute-name> <attribute-value>

以下是上文中选项的详细信息。

Following are the details about the options in the above syntax.

<cluster> − 定义集群名称。

<cluster> − Defines the cluster name.

<attribute-name> − 定义您想要更改的属性。

<attribute-name> − Defines the attribute you want to change.

<attribute-value> − 定义所要为该属性设置的值。

<attribute-value> − Defines the value you want to set for this attribute.

以下表格格式提供了您可与 Alter cluster 命令一起使用的受支持属性列表。

The following tabular format provides the list of supported attributes you can use along with Alter cluster command.

Name

Type

Description

NAME

String

Changes the cluster name.

STATUS

String

Changes the cluster status. Allowed values are ONLINE and OFFLINE. By default, clusters are online.

COMPRESSION

String

Defines the compression type to use. Allowed values are NOTHING, SNAPPY, GZIP, and any other compression types registered in the OCompressionFactory class.

USE_WAL

Boolean

Defines whether it uses the Journal when OrientDB operates against the cluster

RECORD_GROW_FACTO R

Integer

Defines the grow factor to save more space on record creation. You may find this useful when you update the record with additional information.

RECORD_OVERFLOW_GR OW_FACTOR

Integer

Defines grow factor on updates. When it reaches the size limit, is uses this setting to get more space, (factor > 1).

CONFLICTSTRATEGY

String

Defines the strategy it uses to handle conflicts in the event that OrientDB MVCC finds an update or a delete operation it executes against an old record.

下表提供了冲突策略列表。

The following table provides the list of Conflict strategies.

Sr.No.

Strategy & Description

1

Version Throws an exception when versions are different. This is the default setting.

2

Content In the event that the versions are different, it checks for changes in the content, otherwise it uses the highest version to avoid throwing an exception.

3

Automerge Merges the changes.

Example

尝试以下示例查询以学习 Alter cluster 命令。

Try the following example queries to learn Alter cluster command.

执行以下命令以将群集名称从 Employee 更改为 Employee2。

Execute the following command to change the name of a cluster from Employee to Employee2.

orientdb {db = demo}> ALTER CLUSTER Employee NAME Employee2

如果上述命令执行成功,您将获得以下输出内容。

If the above command is executed successfully, you will get the following output.

Cluster updated successfully

执行以下命令以使用群集 ID 将群集名称从 Employee2 更改为 Employee。

Execute the following command to change the name of a cluster from Employee2 to Employee using cluster ID.

orientdb {db = demo}> ALTER CLUSTER 12 NAME Employee

如果上述命令执行成功,您将获得以下输出内容。

If the above command is executed successfully, you will get the following output.

Cluster updated successfully

执行以下命令以将群集冲突策略更改为自动合并。

Execute the following command to change the cluster conflict strategy to automerge.

orientdb {db = demo}> ALTER CLUSTER V CONFICTSTRATEGY automerge

如果上述命令执行成功,您将获得以下输出内容。

If the above command is executed successfully, you will get the following output.

Cluster updated successfully