GridGain Developers Hub

Distribution Zones

This section describes GridGain 9 distribution zones. In GridGain 9, you can fine-tune distribution of your partitions on nodes for better performance and stability.

CREATE ZONE

Creates a new distribution zone.

Diagram( Terminal('CREATE ZONE'), Optional(Terminal('IF NOT EXISTS')), NonTerminal('qualified_zone_name'), End({type:'complex'}) )

Diagram( Start({type:'complex'}), Optional(Sequence( Terminal('WITH'), Optional('('), OneOrMore( NonTerminal('parameter', {href:'./grammar-reference/#parameter'}), ','), Optional(')'))))

Keywords and parameters:

  • IF NOT EXISTS - create a zone only if a different zone with the same name does not exist.

  • qualified_zone_name - a name of the distribution zone.

  • WITH - accepts the following additional parameters:

    • STORAGE_PROFILES - Required. Comma-separated list of the profiles of the storage engines to use.

    • PARTITIONS - the number of partition the data is divided into. Partitions are then split between nodes for storage.

    • REPLICAS - the number of copies of each partition.

    • DATA_NODES_FILTER - specifies the nodes that can be used to store data in the distribution zone based on node attributes. You can configure node attributes by using cli. Filter uses JSONPath rules. If the attribute is not found, all negative comparisons will be valid. For example, $[?(@.storage != 'SSD']} will also include nodes without the storage attribute specified.

    • DATA_NODES_AUTO_ADJUST_SCALE_UP - the delay in seconds between the new node joining and the start of data zone adjustment.

    • DATA_NODES_AUTO_ADJUST_SCALE_DOWN - the delay in seconds between the node leaving the cluster and the start of data zone adjustment.

    • DATA_STORAGE_ENGINE - the name of the data storage engine.

Examples:

Creates an exampleZone distribution zone:

CREATE ZONE IF NOT EXISTS exampleZone WITH STORAGE_PROFILES='default'

Creates an exampleZone distribution zone that will only use nodes with SSD attribute and adjust 300 seconds after cluster topology changes:

CREATE ZONE IF NOT EXISTS exampleZone WITH DATA_NODES_FILTER='SSD', DATA_NODES_AUTO_ADJUST_SCALE_UP=300, STORAGE_PROFILES='default'

ALTER ZONE

Modifies a distribution zone.

ALTER ZONE RENAME TO new_qualified_zone_name

Diagram( Terminal('ALTER ZONE'), Optional(Terminal('IF EXISTS')), NonTerminal('qualified_zone_name'), Terminal('RENAME TO'), NonTerminal('new_qualified_zone_name'), )

Keywords and parameters:

  • IF EXISTS - do not throw an error if a zone with the specified name does not exist.

  • qualified_zone_name - the current name of the distribution zone.

  • RENAME TO - renames the selected zone to the new name.

  • new_qualified_zone_name - the new name of the distribution zone (assigned by RENAME).

Examples:

Renames the exampleZone to renamedZone:

ALTER ZONE IF EXISTS exampleZone RENAME TO renamedZone;

ALTER ZONE SET

Diagram( Terminal('ALTER ZONE'), Optional(Terminal('IF EXISTS')), NonTerminal('qualified_zone_name'), Sequence(Terminal('SET'), Optional('('), OneOrMore( NonTerminal('parameter', {href:'./grammar-reference/#parameter'}), ','), Optional(')')))

Keywords and parameters:

  • IF EXISTS - do not throw an error if a zone with the specified name does not exist.

  • qualified_zone_name - a name of the distribution zone.

  • SET - assigns values to any or all of the following parameters:

    • STORAGE_PROFILES - comma-separated list of the profiles of the storage engines to use.

    • PARTITIONS - the number of partitions

    • REPLICAS - the number of copies of each partition.

    • DATA_NODES_FILTER - specifies the nodes that can be used to store data in the distribution zone based on node attributes.

    • DATA_NODES_AUTO_ADJUST_SCALE_UP - the delay in seconds between the new node joining and the start of data zone adjustment.

    • DATA_NODES_AUTO_ADJUST_SCALE_DOWN - the delay in seconds between the node leaving the cluster and the start of data zone adjustment.

DROP ZONE

Drops an existing distribution zone.

Diagram( Terminal('DROP ZONE'), Terminal('IF EXISTS'), NonTerminal('qualified_zone_name') )

Keywords and parameters:

  • IF EXISTS - do not throw an error if a zone with the specified name does not exist.

  • qualified_zone_name - the name of the distribution zone.

Examples:

Drop Person table if the one exists:

DROP ZONE IF EXISTS exampleZone