apache-ignite
158 строк · 6.6 Кб
1// Licensed to the Apache Software Foundation (ASF) under one or more
2// contributor license agreements. See the NOTICE file distributed with
3// this work for additional information regarding copyright ownership.
4// The ASF licenses this file to You under the Apache License, Version 2.0
5// (the "License"); you may not use this file except in compliance with
6// the License. You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15= Baseline Topology
16
17:javaFile: {javaCodeDir}/ClusterAPI.java
18:csharpFile: {csharpCodeDir}/BaselineTopology.cs
19
20The _baseline topology_ is a set of nodes meant to hold data.
21The concept of baseline topology was introduced to give you the ability to control when you want to
22link:data-modeling/data-partitioning#rebalancing[rebalance the data in the cluster]. For example, if
23you have a cluster of 3 nodes where the data is distributed between the nodes, and you add 2 more nodes, the rebalancing
24process re-distributes the data between all 5 nodes. The rebalancing process happens when the
25baseline topology changes, which can either happen automatically or be triggered manually.
26
27The baseline topology only includes server nodes; client nodes are never included because they do not store data.
28
29The purpose of the baseline topology is to:
30
31* Avoid unnecessary data transfer when a server node leaves the cluster for a short period of time, for example, due to
32occasional network failures or scheduled server maintenance.
33* Give you the ability to control when you want to rebalance the data.
34
35Baseline topology changes automatically when <<Baseline Topology Autoadjustment>> is enabled. This is the default
36behavior for pure in-memory clusters. For persistent clusters, the baseline topology autoadjustment feature must be enabled
37manually. By default, it is disabled and you have to change the baseline topology manually. You can change the baseline
38topology using the link:tools/control-script#activation-deactivation-and-topology-management[control script].
39
40[CAUTION]
41====
42Any attempt to create a cache while the baseline topology is being changed results in an exception.
43For more details, see link:key-value-api/basic-cache-operations#creating-caches-dynamically[Creating Caches Dynamically].
44====
45
46== Baseline Topology in Pure In-Memory Clusters
47In pure in-memory clusters, the default behavior is to adjust the baseline topology to the set of all server nodes
48automatically when you add or remove server nodes from the cluster. The data is rebalanced automatically, too.
49You can disable the baseline autoadjustment feature and manage baseline topology manually.
50
51NOTE: In previous releases, baseline topology was relevant only to clusters with persistence.
52However, since version 2.8.0, it applies to in-memory clusters as well.
53If you have a pure in-memory cluster, the transition should be transparent for you because, by default, the baseline topology changes automatically when a server node leaves or joins the cluster.
54
55== Baseline Topology in Persistent Clusters
56
57If your cluster has at least one data region in which persistence is enabled, the cluster is inactive when you start it for the first time.
58In the inactive state, all operations are prohibited.
59The cluster must be activated before you can create caches and upload data.
60Cluster activation sets the current set of server nodes as the baseline topology.
61When you restart the cluster, it is activated automatically as soon as all nodes that are registered in the baseline topology join in.
62However, if some nodes do not join after a restart, you must to activate the cluster manually.
63
64You can activate the cluster using one of the following tools:
65
66* link:tools/control-script#activating-cluster[Control script]
67* link:restapi#change-cluster-state[REST API command]
68* Programmatically:
69+
70[tabs]
71--
72tab:Java[]
73
74[source, java]
75----
76include::{javaFile}[tags=activate,indent=0]
77----
78
79tab:C#/.NET[]
80[source, csharp]
81----
82include::{csharpFile}[tags=activate,indent=0]
83----
84tab:C++[]
85--
86
87== Baseline Topology Autoadjustment
88
89Instead of changing the baseline topology manually, you can let the cluster do it automatically. This feature is called
90Baseline Topology Autoadjustment. When it is enabled, the cluster monitors the state of its server nodes and sets the
91baseline on the current topology automatically when the cluster topology is stable for a configurable period of time.
92
93Here is what happens when the set of nodes in the cluster changes:
94
95* The cluster waits for a configurable amount of time (5 min by default).
96* If there are no other topology changes during this period, Ignite sets the baseline topology to the current set of nodes.
97* If the set of nodes changes during this period, the timeout is updated.
98
99Each change in the set of nodes resets the timeout for autoadjustment.
100When the timeout expires and the current set of nodes is different from the baseline topology (for example, new nodes
101are present or some old nodes left), Ignite changes the baseline topology to the current set of nodes.
102This also triggers data rebalancing.
103
104The autoadjustment timeout allows you to avoid data rebalancing when a node disconnects for a short period due to a
105temporary network problem or when you want to quickly restart the node.
106You can set the timeout to a higher value if you expect temporary changes in the set of nodes and don't want to change
107the baseline topology.
108
109Baseline topology is autoadjusted only if the cluster is in the active state.
110
111To enable automatic baseline adjustment, you can use the
112link:tools/control-script#enabling-baseline-topology-autoadjustment[control script] or the
113programmatic API methods shown below:
114
115[tabs]
116--
117tab:Java[]
118
119[source, java]
120----
121include::{javaFile}[tags=enable-autoadjustment,indent=0]
122----
123
124tab:C#/.NET[]
125[source, csharp]
126----
127include::{csharpFile}[tags=enable-autoadjustment,indent=0]
128----
129tab:C++[]
130--
131
132
133To disable automatic baseline adjustment, use the same method with `false` passed in:
134
135
136[tabs]
137--
138tab:Java[]
139[source, java]
140----
141include::{javaFile}[tags=disable-autoadjustment,indent=0]
142----
143
144tab:C#/.NET[]
145[source, csharp]
146----
147include::{csharpFile}[tags=disable-autoadjustment,indent=0]
148----
149tab:C++[]
150--
151
152
153== Monitoring Baseline Topology
154
155You can use the following tools to monitor and/or manage the baseline topology:
156
157* link:tools/control-script[Control Script]
158* link:monitoring-metrics/metrics#monitoring-topology[JMX Beans]
159
160