You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a `failkeeper` command to `stolonctl`. This command wil force a keeper as
"temporarily" failed.
It's just a one shot operation, the sentinel compute a new clusterdata
considering the keeper as failed and then restore its state to the real one.
This can be useful to force a new master keeper election. For example, if the
force failed keeper is a master, the sentinel will try to elect a new master, if
no new master can be elected the force failed keeper, if really healthy, will be
re-elected as master`,
// Licensed under the Apache License, Version 2.0 (the "License");
4
+
// you may not use this file except in compliance with the License.
5
+
// You may obtain a copy of the License at
6
+
//
7
+
// http://www.apache.org/licenses/LICENSE-2.0
8
+
//
9
+
// Unless required by applicable law or agreed to in writing, software
10
+
// distributed under the License is distributed on an "AS IS" BASIS,
11
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
12
+
// See the License for the specific language governing permissions and
13
+
// limitations under the License.
14
+
15
+
package cmd
16
+
17
+
import (
18
+
"context"
19
+
20
+
cmdcommon "github.com/sorintlab/stolon/cmd"
21
+
"github.com/spf13/cobra"
22
+
)
23
+
24
+
varfailKeeperCmd=&cobra.Command{
25
+
Use: "failkeeper [keeper uid]",
26
+
Short: `Force keeper as "temporarily" failed. The sentinel will compute a new clusterdata considering it as failed and then restore its state to the real one.`,
27
+
Long: `Force keeper as "temporarily" failed. It's just a one shot operation, the sentinel will compute a new clusterdata considering the keeper as failed and then restore its state to the real one. For example, if the force failed keeper is a master, the sentinel will try to elect a new master. If no new master can be elected, the force failed keeper, if really healthy, will be re-elected as master`,
Copy file name to clipboardExpand all lines: doc/commands/stolon-keeper.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -41,4 +41,4 @@ stolon-keeper [flags]
41
41
--uid string keeper uid (must be unique in the cluster and can contain only lower-case letters, numbers and the underscore character). If not provided a random uid will be generated.
42
42
```
43
43
44
-
###### Auto generated by spf13/cobra on 19-Jul-2018
44
+
###### Auto generated by spf13/cobra on 21-Aug-2018
Copy file name to clipboardExpand all lines: doc/commands/stolonctl.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ stolonctl [flags]
33
33
### SEE ALSO
34
34
35
35
*[stolonctl clusterdata](stolonctl_clusterdata.md) - Retrieve the current cluster data
36
+
*[stolonctl failkeeper](stolonctl_failkeeper.md) - Force keeper as "temporarily" failed. The sentinel will compute a new clusterdata considering it as failed and then restore its state to the real one.
36
37
*[stolonctl init](stolonctl_init.md) - Initialize a new cluster
37
38
*[stolonctl promote](stolonctl_promote.md) - Promotes a standby cluster to a primary cluster
38
39
*[stolonctl removekeeper](stolonctl_removekeeper.md) - Removes keeper from cluster data
@@ -41,4 +42,4 @@ stolonctl [flags]
41
42
*[stolonctl update](stolonctl_update.md) - Update a cluster specification
42
43
*[stolonctl version](stolonctl_version.md) - Display the version
43
44
44
-
###### Auto generated by spf13/cobra on 19-Jul-2018
45
+
###### Auto generated by spf13/cobra on 21-Aug-2018
Force keeper as "temporarily" failed. The sentinel will compute a new clusterdata considering it as failed and then restore its state to the real one.
4
+
5
+
### Synopsis
6
+
7
+
Force keeper as "temporarily" failed. It's just a one shot operation, the sentinel will compute a new clusterdata considering the keeper as failed and then restore its state to the real one. For example, if the force failed keeper is a master, the sentinel will try to elect a new master. If no new master can be elected, the force failed keeper, if really healthy, will be re-elected as master
8
+
9
+
```
10
+
stolonctl failkeeper [keeper uid] [flags]
11
+
```
12
+
13
+
### Options
14
+
15
+
```
16
+
-h, --help help for failkeeper
17
+
```
18
+
19
+
### Options inherited from parent commands
20
+
21
+
```
22
+
--cluster-name string cluster name
23
+
--kube-context string name of the kubeconfig context to use
24
+
--kube-namespace string name of the kubernetes namespace to use
25
+
--kube-resource-kind string the k8s resource kind to be used to store stolon clusterdata and do sentinel leader election (only "configmap" is currently supported)
26
+
--kubeconfig string path to kubeconfig file. Overrides $KUBECONFIG
27
+
--log-level string debug, info (default), warn or error (default "info")
28
+
--metrics-listen-address string metrics listen address i.e "0.0.0.0:8080" (disabled by default)
29
+
--store-backend string store backend type (etcdv2/etcd, etcdv3, consul or kubernetes)
30
+
--store-ca-file string verify certificates of HTTPS-enabled store servers using this CA bundle
31
+
--store-cert-file string certificate file for client identification to the store
32
+
--store-endpoints string a comma-delimited list of store endpoints (use https scheme for tls communication) (defaults: http://127.0.0.1:2379 for etcd, http://127.0.0.1:8500 for consul)
33
+
--store-key string private key file for client identification to the store
34
+
--store-prefix string the store base prefix (default "stolon/cluster")
35
+
--store-skip-tls-verify skip store certificate verification (insecure!!!)
36
+
```
37
+
38
+
### SEE ALSO
39
+
40
+
*[stolonctl](stolonctl.md) - stolon command line client
41
+
42
+
###### Auto generated by spf13/cobra on 21-Aug-2018
You can force a "master" keeper failover using the [stolonctl failkeeper](commands/stolonctl_failkeeper.md)
4
+
5
+
This commands forces a keeper as "temporarily" failed. It's just a one shot operation, the sentinel will compute a new clusterdata considering the keeper as failed and then restore its state to the real one.
6
+
7
+
For example, if the force failed keeper is a master, the sentinel will try to elect a new master. If no new master can be elected, the force failed keeper, if really healthy, will be re-elected as master
8
+
9
+
To avoid losing any transaction when using asynchronous replication take a look at this recipe:
10
+
11
+
*[Manual switchover without transactions loss](manual_switchover.md)
Copy file name to clipboardExpand all lines: doc/manual_switchover.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
If for any reason (eg. maintenance) you want to switch the current master to another one without losing any transaction you can do this in these ways:
4
4
5
-
* If you've synchronous replication enabled you can just stop the current master keeper, one of the synchronous standbys will be elected as the new master.
5
+
* If you've synchronous replication enabled you can just stop/[forcefailover](forcefailover.md) the current master keeper, one of the synchronous standbys will be elected as the new master.
6
+
7
+
* If you aren't using synchronous replication you can just temporarily enable it (see [here](syncrepl.md)), wait that the cluster reconfigures some synchronous standbys (you can monitor `pg_stat_replication` for a standby with `sync_state` = `sync`) and then stop/[forcefailover](forcefailover.md) the master keeper, wait for a new synchronous standby to be elected and disable synchronous replication.
6
8
7
-
* If you aren't using synchronous replication you can just temporarily enable it (see [here](syncrepl.md)), wait that the cluster reconfigures some synchronous standbys (you can monitor `pg_stat_replication` for a standby with `sync_state` = `sync`) and then stop the master keeper, wait for a new synchronous standby to be elected and disable synchronous replication.
0 commit comments