blob: b7f4bca33a8ca0ed36105e7c1cdc4c316167c05a [file]
// 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 Apache Ignite 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.
[source,sql]
----
CREATE ZONE [IF NOT EXISTS] qualified_zone_name [ENGINE engine_name]
[WITH
[PARTITIONS = partitionNumber],
[REPLICAS = replicaNumber],
{[DATA_NODES_AUTO_ADJUST_SCALE_UP = scale_up_value |
DATA_NODES_AUTO_ADJUST_SCALE_DOWN = scale_down_value |
(DATA_NODES_AUTO_ADJUST_SCALE_UP = scale_up_value & DATA_NODES_AUTO_ADJUST_SCALE_DOWN = scale_down_value)]},
[DATA_NODES_FILTER = jsonPathFilter]
]
[;]
----
Parameters:
* `qualified_zone_name` - name of the distribution zone. Can be schema-qualified.
* `IF NOT EXISTS` - create a zone only if a different zone with the same name does not exist.
* `ENGINE` - selects the storage engine to use. Currently `aipersist`, `aimem` and `rocksdb` are available.
* `WITH` - accepts the following additional parameters:
- `PARTITIONS` - the number of parts data is divinded into. Partitions are then split between nodes for storage.
- `REPLICAS` - the number of copies of each partition.
- `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_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.
Examples:
Creates an `exampleZone` distribution zone:
[source,sql]
----
CREATE ZONE IF NOT EXISTS exampleZone
----
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="$[?(@.storage == 'SSD')]", DATA_NODES_AUTO_ADJUST=300
----
== ALTER ZONE
Renames a distribution zone.
[source,sql]
----
ALTER ZONE IF EXISTS { 'qualified_zone_name' } [RENAME TO {new_qualified_zone_name}]
[WITH
[PARTITIONS = partitionNumber],
[REPLICAS = replicaNumber],
{[DATA_NODES_AUTO_ADJUST_SCALE_UP = scale_up_value |
DATA_NODES_AUTO_ADJUST_SCALE_DOWN = scale_down_value |
(DATA_NODES_AUTO_ADJUST_SCALE_UP = scale_up_value & DATA_NODES_AUTO_ADJUST_SCALE_DOWN = scale_down_value)]},
[DATA_NODES_FILTER = jsonPathFilter]
]
[;]
----
Parameters:
* `qualified_zone_name` - name of the distribution zone. Can be schema-qualified.
* `IF EXISTS` - do not throw an error if a zone with the specified name does not exist.
* `WITH` - accepts the following additional parameters:
- `PARTITIONS` - the number of parts data is divinded into. Partitions are then split between nodes for storage.
- `REPLICAS` - the number of copies of each partition.
- `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_NODES_FILTER` - specifies the nodes that can be used to store data in the distribution zone based on node attributes.
== DROP ZONE
The `DROP ZONE` command drops an existing distribution zone.
----
DROP ZONE IF EXISTS qualified_zone_name
----
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. Can be schema-qualified.
Examples:
Drop Person table if the one exists:
[source,sql]
----
DROP ZONE IF EXISTS exampleZone
----