Skip to content

Console Command Create Cluster

Kazunobu Yamaguchi edited this page Aug 12, 2014 · 5 revisions

SQL Create Class コマンドはスキーマへ新しいクラスを作成します。NOTE: 同じ名前のクラスタが存在する場合は、でろるのクラスタが使用されます.

構文

CREATE CLASS <class> [EXTENDS <super-class>] [CLUSTER <clusterId>*]

Where:

  • class は作成されるクラス名称です. 先頭の文字はアルファベットである必要があり、他の文字はアルファベットに加えてアンダースコア _ かダッシュ -である必要あります.
  • super-class, optional, 継承している親クラス
  • clusterId カンマ (,)区切りの一覧が使用できます

By default OrientDB creates 1 cluster per class, but this can be changed by setting the property minimumclusters at [database level](SQL Alter Database). OrientDBはデフォルトでは一つのクラスに対して一つのクラスタを作成しますが[database level](SQL Alter Database)の minimumclusters プロパティ設定で変更が可能です。

Cluster selection strategy

OrientDB, by default, inherits the cluster selection by the [database](SQL Alter Database). By default is round-robin, but you can always change it after creation with [alter class command](SQL Alter Class). The supported strategies are:

  • default, uses always the Class's defaultClusterId property. This was the default before 1.7
  • round-robin, put the Class's configured clusters in a ring and returns a different cluster every time restarting from the first when the ring is completed
  • balanced, checks the records in all the clusters and returns the smaller cluster. This allows the cluster to have all the underlying clusters balanced on size. On adding a new cluster to an existent class, the new empty cluster will be filled before the others because more empty then the others. In distributed configuration when configure clusters on different servers this setting allows to keep the server balanced with the same amount of data. Calculation of cluster size is made every 5 or more seconds to avoid to slow down insertion

参考

'Account' クラスを生成:

CREATE CLASS Account

'Vehicle'クラスを継承した'Car'を生成:

CREATE CLASS Car extends Vehicle

'Car'クラスの clusterId を 10 として生成:

CREATE CLASS Car CLUSTER 10

抽象クラス

'Person'クラスを抽象クラス]として生成 :

CREATE CLASS Person ABSTRACT
Clone this wiki locally