| // Licensed to the Apache Software Foundation (ASF) under one or more |
| // contributor license agreements. See the NOTICE file distributed with |
| // this work for additional information regarding copyright ownership. |
| // The ASF licenses this file to You under the Apache License, Version 2.0 |
| // (the "License"); you may not use this file except in compliance with |
| // the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| = Distribution Zones |
| |
| This section describes Ignite 3 distribution zones. In Ignite 3, you can fine-tune distribution of your partitions on nodes for better performance and stability. |
| |
| == CREATE ZONE |
| |
| Creates a new distribution zone. |
| |
| NOTE: This can also be done via the link:developers-guide/java-to-tables[Java API]. |
| |
| [.diagram-container] |
| Diagram( |
| Terminal('CREATE ZONE'), |
| Optional(Terminal('IF NOT EXISTS')), |
| NonTerminal('qualified_zone_name'), |
| End({type:'complex'}) |
| ) |
| |
| [.diagram-container] |
| Diagram( |
| Start({type:'complex'}), |
| Optional(Sequence( |
| Terminal('WITH'), |
| OneOrMore( |
| NonTerminal('parameter', {href:'./grammar-reference/#parameter'}), |
| ',')))) |
| |
| |
| 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: |
| |
| [source,sql] |
| ---- |
| 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: |
| |
| [source,sql] |
| ---- |
| 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-container] |
| 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`: |
| |
| [source,sql] |
| ---- |
| ALTER ZONE IF EXISTS exampleZone RENAME TO renamedZone; |
| ---- |
| |
| === ALTER ZONE SET |
| |
| [.diagram-container] |
| 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: |
| ** `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. |
| |
| NOTE: This can also be done via the link:developers-guide/java-to-tables[Java API]. |
| |
| [.diagram-container] |
| 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: |
| |
| [source,sql] |
| ---- |
| DROP ZONE IF EXISTS exampleZone |
| ---- |