github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-redis/cluster-management/restart-a-redis-cluster.md (about)

     1  ---
     2  title: Restart a Redis cluster
     3  description: How to restart a Redis cluster
     4  keywords: [redis, restart]
     5  sidebar_position: 4
     6  sidebar_label: Restart
     7  ---
     8  
     9  # Restart a Redis cluster
    10  
    11  You can restart all pods of the cluster. When an exception occurs in a database, you can try to restart it.
    12  
    13  :::note
    14  
    15  Restarting a Redis cluster triggers a concurrent restart and the leader may change after the cluster restarts.
    16  
    17  :::
    18  
    19  ## Steps
    20  
    21  1. Restart a cluster.
    22  
    23     You can use `kbcli` or create an OpsRequest to restart a cluster.
    24    
    25     **Option 1.** (**Recommended**) Use kbcli
    26  
    27     Configure the values of `components` and `ttlSecondsAfterSucceed` and run the command below to restart a specified cluster.
    28  
    29     ```bash
    30     kbcli cluster restart redis-cluster --components="redis" \
    31     --ttlSecondsAfterSucceed=30
    32     ```
    33  
    34     - `components` describes the component name that needs to be restarted.
    35     - `ttlSecondsAfterSucceed` describes the time to live of an OpsRequest job after the restarting succeeds.
    36  
    37     **Option 2.** Create an OpsRequest
    38  
    39     Run the command below to restart a cluster.
    40  
    41     ```bash
    42     kubectl apply -f - <<EOF
    43     apiVersion: apps.kubeblocks.io/v1alpha1
    44     kind: OpsRequest
    45     metadata:
    46       name: ops-restart
    47     spec:
    48       clusterRef: redis-cluster
    49       type: Restart 
    50       restart:
    51       - componentName: redis
    52     EOF
    53     ```
    54  
    55  2. Validate the restart operation.
    56  
    57     Check the cluster status to identify the restart status.
    58  
    59     ```bash
    60     kbcli cluster list <name>
    61     ```
    62  
    63     - STATUS=Restarting: it means the cluster restart is in progress.
    64     - STATUS=Running: it means the cluster has been restarted.
    65  
    66     ***Example***
    67  
    68     ```bash
    69     kbcli cluster list redis-cluster
    70     >
    71     NAME                 NAMESPACE        CLUSTER-DEFINITION        VERSION            TERMINATION-POLICY        STATUS         CREATED-TIME
    72     redis-cluster        default          redis                     redis-7.0.x        Delete                    Running        Apr 10,2023 19:20 UTC+0800
    73     ```