apache-ignite
97 строк · 2.5 Кб
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= Cluster States
16
17:javaFile: {javaCodeDir}/ClusterAPI.java
18
19== Overview
20
21An Ignite cluster can be in one of the three states: `ACTIVE`, `ACTIVE_READ_ONLY`, and `INACTIVE`.
22
23When you start a pure in-memory cluster (no persistent data regions) for the first time, the cluster is in the `ACTIVE` state.
24When you start a cluster with persistent data regions for the first time, the cluster is `INACTIVE`.
25
26
27* `INACTIVE`: All operations are prohibited.
28+
29--
30When you change the cluster state from active to `INACTIVE` (deactivation), the cluster deallocates all memory resources.
31
32include::includes/note-on-deactivation.adoc[]
33
34--
35* `ACTIVE`: This is the normal mode of the cluster. You can execute any operation.
36
37* `ACTIVE_READ_ONLY`: The read-only mode. Only read operations are allowed.
38+
39--
40Any attempt to create a cache or modify the data in an existing cache results in an `IgniteClusterReadOnlyException` exception.
41DDL or DML statements that modify the data are prohibited as well.
42--
43
44
45== Changing Cluster State
46
47You can change the cluster state in multiple ways:
48
49* link:control-script#getting-cluster-state[Control script]:
50+
51[source, shell]
52----
53control.sh --set-state ACTIVE_READ_ONLY
54----
55
56* link:restapi#change-cluster-state[REST command]:
57+
58--
59
60[source, url]
61----
62http://localhost:8080/ignite?cmd=setstate&state=ACTIVE_READ_ONLY
63----
64
65--
66* Programmatically:
67+
68[tabs]
69--
70tab:Java[]
71
72[source, java]
73----
74include::{javaFile}[tags=change-state, indent=0]
75----
76
77
78tab:C#/.NET[]
79tab:C++[]
80--
81
82* JMX Bean:
83+
84--
85
86Mbean's Object Name: ::
87----
88group="Kernal",name=IgniteKernal
89----
90[cols="1,4",opts="header"]
91|===
92|Operation | Description
93
94| `clusterState()` | Get the current cluster state.
95| `clusterState(String, boolean)` | Set the cluster state.
96|===
97--
98