github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-mongodb/configuration/configuration.md (about)

     1  ---
     2  title: Configure cluster parameters
     3  description: Configure cluster parameters
     4  keywords: [parameter, configuration, reconfiguration]
     5  sidebar_position: 1
     6  ---
     7  
     8  # Configure cluster parameters
     9  
    10  The KubeBlocks configuration function provides a set of consistent default configuration generation strategies for all the databases running on KubeBlocks and also provides a unified parameter configuration interface to facilitate managing parameter configuration, searching the parameter user guide, and validating parameter effectiveness.
    11  
    12  From v0.6.0, KubeBlocks supports `kbcli cluster configure` and `kbcli cluster edit-config` to configure parameters. The difference is that KubeBlocks configures parameters automatically with `kbcli cluster configure` but `kbcli cluster edit-config` provides a visualized way for you to edit parameters directly.
    13  
    14  ## View parameter information
    15  
    16  * View the current configuration file of a cluster.
    17  
    18     ```bash
    19     kbcli cluster describe-config mongodb-cluster
    20     >
    21     ConfigSpecs Meta:
    22     CONFIG-SPEC-NAME         FILE                  ENABLED   TEMPLATE                     CONSTRAINT                   RENDERED                                            COMPONENT    CLUSTER           
    23     mongodb-config           keyfile               false     mongodb5.0-config-template   mongodb-config-constraints   mongodb-cluster-replicaset-mongodb-config           replicaset   mongodb-cluster   
    24     mongodb-config           mongodb.conf          true      mongodb5.0-config-template   mongodb-config-constraints   mongodb-cluster-replicaset-mongodb-config           replicaset   mongodb-cluster   
    25     mongodb-metrics-config   metrics-config.yaml   false     mongodb-metrics-config                                    mongodb-cluster-replicaset-mongodb-metrics-config   replicaset   mongodb-cluster   
    26  
    27     History modifications:
    28     OPS-NAME   CLUSTER   COMPONENT   CONFIG-SPEC-NAME   FILE   STATUS   POLICY   PROGRESS   CREATED-TIME   VALID-UPDATED 
    29     ```
    30  
    31     From the meta information, the cluster `mongodb-cluster` has a configuration file named `mongodb.conf`.
    32  
    33  You can also view the details of this configuration file and parameters.
    34  
    35  * View the details of the current configuration file.
    36  
    37     ```bash
    38     kbcli cluster describe-config mongodb-cluster --show-detail
    39     ```
    40  
    41  ## Configure parameters
    42  
    43  ### Configure parameters with configure command
    44  
    45  The example below configures systemLog.verbosity to 1.
    46  
    47  1. Adjust the values of `systemLog.verbosity` to 1.
    48  
    49     ```bash
    50     kbcli cluster configure mongodb-cluster --component mongodb --config-spec mongodb-config --config-file mongodb.conf --set systemLog.verbosity=1
    51     >
    52     Warning: The parameter change you modified needs to be restarted, which may cause the cluster to be unavailable for a period of time. Do you need to continue...
    53     Please type "yes" to confirm: yes
    54     Will updated configure file meta:
    55     ConfigSpec: mongodb-config      ConfigFile: mongodb.conf      ComponentName: mongodb  ClusterName: mongodb-cluster
    56     OpsRequest mongodb-cluster-reconfiguring-q8ndn created successfully, you can view the progress:
    57            kbcli cluster describe-ops mongodb-cluster-reconfiguring-q8ndn -n default
    58     ```
    59  
    60  2. Check configure history.
    61  
    62     ```bash
    63  
    64      kbcli cluster describe-config mongodb-cluster
    65      >
    66      ConfigSpecs Meta:
    67      CONFIG-SPEC-NAME         FILE                  ENABLED   TEMPLATE                     CONSTRAINT                   RENDERED                                         COMPONENT   CLUSTER
    68      mongodb-config           keyfile               false     mongodb5.0-config-template   mongodb-config-constraints   mongodb-cluster-mongodb-mongodb-config           mongodb     mongodb-cluster
    69      mongodb-config           mongodb.conf          true      mongodb5.0-config-template   mongodb-config-constraints   mongodb-cluster-mongodb-mongodb-config           mongodb     mongodb-cluster
    70      mongodb-metrics-config   metrics-config.yaml   false     mongodb-metrics-config                                    mongodb-cluster-mongodb-mongodb-metrics-config   mongodb     mongodb-cluster
    71  
    72      History modifications:
    73      OPS-NAME                              CLUSTER           COMPONENT   CONFIG-SPEC-NAME   FILE           STATUS    POLICY    PROGRESS   CREATED-TIME                 VALID-UPDATED
    74      mongodb-cluster-reconfiguring-q8ndn   mongodb-cluster   mongodb     mongodb-config     mongodb.conf   Succeed   restart   3/3        Apr 21,2023 18:56 UTC+0800   {"mongodb.conf":"{\"systemLog\":{\"verbosity\":\"1\"}}"}```
    75     ```
    76  
    77  3. Verify configuration result.
    78  
    79     ```bash
    80      root@mongodb-cluster-mongodb-0:/# cat etc/mongodb/mongodb.conf |grep verbosity
    81      verbosity: "1"
    82     ```
    83  
    84  ### Configure parameters with edit-config command
    85  
    86  For your convenience, KubeBlocks offers a tool `edit-config` to help you to configure parameter in a visulized way.
    87  
    88  For Linux and macOS, you can edit configuration files by vi. For Windows, you can edit files on notepad.
    89  
    90  1. Edit the configuration file.
    91  
    92     ```bash
    93     kbcli cluster edit-config mongodb-cluster
    94     ```
    95  
    96  :::note
    97  
    98  If there are multiple components in a cluster, use `--component` to specify a component.
    99  
   100  :::
   101  
   102  2. View the status of the parameter configuration.
   103  
   104     ```bash
   105     kbcli cluster describe-ops xxx -n default
   106     ```
   107  
   108  3. Connect to the database to verify whether the parameters are configured as expected.
   109  
   110     ```bash
   111     kbcli cluster connect mongodb-cluster
   112     ```
   113  
   114  :::note
   115  
   116  1. For the `edit-config` function, static parameters and dynamic parameters cannot be edited at the same time.
   117  2. Deleting a parameter will be supported later.
   118  
   119  :::