[Yandex Cloud documentation](../../index.md) > [Yandex MPP Analytics for PostgreSQL](../index.md) > [Step-by-step guides](index.md) > Clusters > Updating cluster settings

# Updating Yandex MPP Analytics for PostgreSQL cluster settings


After creating a cluster, you can:

* [Change the cluster name and description](#change-name-and-description).
* [Change the public access setting](#change-public-access).
* [Change additional cluster settings](#change-additional-settings).
* [Change the scheduled maintenance operation settings](#change-background-settings).
* [Update the DBMS settings](#change-gp-settings).
* [Change the PXF protocol settings to optimize external data operations](pxf/settings.md).
* [Change the authentication settings in the pg_hba.conf file](user-auth-rules.md).
* [Change the service account settings](#change-service-account).
* [Change the logging settings](#change-logging).

## Changing the cluster name and description {#change-name-and-description}

{% list tabs group=instructions %}

- Management console {#console}

    1. Open the [folder dashboard](https://console.yandex.cloud).
    1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
    1. Select your cluster and click **Edit** at the top of the page.
    1. Under **Basic parameters**, enter a new name and description for the cluster.
    1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To change the name and description of a Yandex MPP Analytics for PostgreSQL cluster:

  1. View the current `name` and `description` of the cluster:

     ```bash
     yc managed-greenplum cluster get <cluster_name_or_ID>
     ```

  1. View the description of the CLI command for updating a cluster configuration:

      ```bash
      yc managed-greenplum cluster update --help
      ```

  1. Enter a new name and description for the cluster:

      ```bash
      yc managed-greenplum cluster update <cluster_name_or_ID> \
         --new-name <new_cluster_name> \
         --description <new_cluster_description>
      ```

- Terraform {#tf}

    {% note alert %}

    Do not change the cluster name using Terraform. This will delete the existing cluster and create a new one.

    {% endnote %}

    To update the cluster description:

    1. Open the current Terraform configuration file with the infrastructure plan.

        For more information about creating this file, see [Creating clusters](cluster-create.md).

        For a complete list of configurable Yandex MPP Analytics for PostgreSQL cluster fields, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

    1. In the Yandex MPP Analytics for PostgreSQL cluster description, edit the `description` attribute value:

        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
          name        = "<cluster_name>"
          description = "<new_cluster_description>"
          ...
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

        {% note warning %}
        
        The Terraform provider limits the amount of time for all Yandex MPP Analytics for PostgreSQL cluster operations to complete to 120 minutes.
        
        Operations exceeding the set timeout are interrupted.
        
        {% cut "How do I change these limits?" %}
        
        Add the `timeouts` block to the cluster description, for example:
        
        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster name>" {
          ...
          timeouts {
            create = "1h30m" # 1 hour 30 minutes
            update = "2h"    # 2 hours
            delete = "30m"   # 30 minutes
          }
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "name,description",
                      "name": "<new_cluster_name>",
                      "description": "<new_cluster_description>"
                    }'
        ```

        Where `updateMask` is the list of parameters to update as a single string, separated by commas.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ "name", "description" ]
                  },
                  "name": "<new_cluster_name>",
                  "description": "<new_cluster_description>" 
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where `update_mask` is the list of parameters to update as an array of strings (`paths[]`).

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. View the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}


## Change the public access setting {#change-public-access}

{% list tabs group=instructions %}

- Management console {#console}

    1. Open the [folder dashboard](https://console.yandex.cloud).
    1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
    1. Select your cluster and click **Edit** at the top of the page.
    1. Under **Network settings**, enable or disable **Public access**.
    1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To change the public access setting in a Yandex MPP Analytics for PostgreSQL cluster:

  1. View the description of the CLI command for updating a cluster configuration:

      ```bash
      yc managed-greenplum cluster update --help
      ```

  1. Configure public access in the `--assign-public-ip` parameter:

      ```bash
      yc managed-greenplum cluster update <cluster_name_or_ID> \
         --assign-public-ip=<enable_public_access_to_cluster>
      ```

      Where `assign-public-ip` is public access to the cluster, `true` or `false`.

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "config.assignPublicIp",
                      "config": {
                        "assignPublicIp": <allow_public_access_to_cluster_hosts>
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

            Here, we provide only one setting.

        * `assignPublicIp`: Public access to cluster hosts, `true` or `false`.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ "config.assign_public_ip" ]
                  },
                  "config": {
                    "assign_public_ip": <allow_public_access_to_cluster_hosts> 
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Here, we provide only one setting.

        * `assign_public_ip`: Public access to cluster hosts, `true` or `false`.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. View the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

{% note tip %}

If you enabled public access to the cluster but cannot access it from the internet:

* Check the [security group settings](connect/index.md#configuring-security-groups).
* Wait a while. It may take a while to enable public access.

{% endnote %}


## Changing additional cluster settings {#change-additional-settings}

{% list tabs group=instructions %}

- Management console {#console}

    1. Open the [folder dashboard](https://console.yandex.cloud).
    1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
    1. Select your cluster and click **Edit** in the top panel.
    1. Change additional cluster settings:

        * **Backup start time (UTC)**: Time interval during which the cluster backup starts. Time is specified in 24-hour UTC format. The default time is `22:00 - 23:00` UTC.
        * **Maintenance**: [Maintenance](../concepts/maintenance.md) window settings:

            * To enable maintenance at any time, select **At any time** (default).
            * To specify the preferred maintenance start time, select **By schedule** and specify the day of the week and the UTC time interval. For example, you can choose a time when the cluster is least loaded.
            
            Both active and stopped clusters are subject to maintenance. Maintenance operations include DBMS updates, patches, etc.

        
        * **DataLens access**: Allows you to analyze cluster data in [Yandex DataLens](../../datalens/concepts/index.md).
        * The **Yandex Query access** option enables you to run YQL queries from [Yandex Query](../../query/concepts/index.md) to a managed database in Yandex MPP Analytics for PostgreSQL.
        * **WebSQL access**: This option allows sending queries to cluster databases using [Yandex WebSQL](../../websql/index.md).



        * **Deletion protection**: Manages cluster protection against accidental deletion.

            Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

        * **Hybrid storage**: Enables [hybrid storage](../concepts/hybrid-storage.md).

            You cannot disable hybrid storage after you save your cluster settings.

            When hybrid storage is enabled, you can use the [Yezzey extension](extensions/yezzey.md) to move part of your [AO and AOCO tables](../concepts/tables.md) from the cluster storage to a cold storage, and vice versa.
            
            Cold storage is a convenient option if you need to store your table data for a long time without using it much. This will make data storage [less costly](../pricing/index.md#rules-storage).

            
            {% note info %}
            
            This feature is at the [Preview](../../overview/concepts/launch-stages.md) stage and is free of charge.
            
            {% endnote %}


        * **Connection pooler**: Operation mode and [connection pooler](../concepts/pooling.md) settings:

            * **Mode**: `SESSION` (session mode) or `TRANSACTION` (transaction mode, default).
            * **Size**: Maximum number of client connections. The default value is `0` (not limited).
            * **Client Idle Timeout**: Idle timeout for a client connection (in seconds). The default value is `28800`.
            * **Transaction idle timeout**: Idle timeout for a client connection with an open transaction (in seconds). The default value is `0` (not limited).

    1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To change advanced cluster settings:

    1. View the description of the CLI command for updating a cluster:

        ```bash
        yc managed-greenplum cluster update --help
        ```

    1. Run the following command with the list of settings you want to update:

        
        ```bash
        yc managed-greenplum cluster update <cluster_name_or_ID> \
            --backup-window-start <backup_start_time> \
            --datalens-access=<allow_access_from_DataLens> \
            --yandexquery-access=<allow_access_from_Yandex_Query> \
            --maintenance-window type=<maintenance_type>,`
                                `day=<day_of_week>,`
                                `hour=<hour> \
            --websql-access=<allow_access_from_WebSQL> \
            --deletion-protection
        ```




    You can update the following settings:

    * `--backup-window-start`: The cluster backup start time, set in UTC format `HH:MM:SS`. If the time is not set, the backup will start at 22:00 UTC.

    
    * `--datalens-access`: Access to the cluster from [Yandex DataLens](../../datalens/concepts/index.md), `true` or `false`.

    * `--yandexquery-access`: Access to the cluster from [Yandex Query](../../query/concepts/index.md), `true` or `false`.

    * `--websql-access`: Enables [SQL queries](web-sql-query.md) against cluster databases from the Yandex Cloud management console using Yandex WebSQL. The default value is `false`.



    * `--maintenance-window`: [Maintenance window](../concepts/maintenance.md) settings that apply to both running and stopped clusters. The `type` setting defines the maintenance type:

        * `anytime`: Any time (default).
        * `weekly`: On a schedule. For this value, also specify the following:
            * `day`: Day of week, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
            * `hour`: Sequence number of UTC hour interval, from `1` to `24`.
        
              > For example, `1` stands for the interval from `00:00` to `01:00`, and `5`, from `04:00` to `05:00`.

    * `--deletion-protection`: Cluster protection from accidental deletion, `true` or `false`.

        Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

    You can get the cluster name with the [list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For more information about creating this file, see [Creating clusters](cluster-create.md).

        For a complete list of configurable Yandex MPP Analytics for PostgreSQL cluster fields, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

    1. In the Yandex MPP Analytics for PostgreSQL cluster description, change the values of additional settings as required:

        
        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
          ...
          backup_window_start {
            hours = <backup_period_start>
          }

          maintenance_window {
            type = "<maintenance_type>"
            day  = "<day_of_week>"
            hour = <hour>
          }

          access {
            data_lens    = <allow_access_from_DataLens>
            yandex_query = <allow_access_from_Yandex_Query>
          }

          deletion_protection = <protect_cluster_from_deletion>

          cloud_storage {
            enable = <use_hybrid_storage>
          }

          pooler_config {
            pooling_mode                     = <operation_mode>
            pool_size                        = <size>
            pool_client_idle_timeout         = <client_timeout>
            pool_idle_in_transaction_timeout = <client_timeout_during_transaction>
          }
        }
        ```




        You can update the following settings:

        * `backup_window_start.hours`: Start of the period for initiating cluster [backup](../concepts/backup.md). It is set in UTC in `HH` format: from `0` to `23`.

        * `maintenance_window`: [Maintenance window](../concepts/maintenance.md) settings (including for disabled clusters):

            * `type`: Maintenance type. The possible values include:
                * `ANYTIME`: Any time.
                * `WEEKLY`: On a schedule.
            * `day`: Day of week in `DDD` format for the `WEEKLY` type, e.g., `MON`.
            * `hour`: Time of day (UTC) in `HH` format for the `WEEKLY` type, e.g., `21`.

        
        * `access.data_lens`: Access to the cluster from [Yandex DataLens](../../datalens/concepts/index.md), `true` or `false`.

        * `access.yandex_query`: Access to the cluster from [Yandex Query](../../query/concepts/index.md), `true` or `false`.



        * `deletion_protection`: Cluster deletion protection, `true` or `false`.

            Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

        * `cloud_storage.enable`: Use of [hybrid storage](../concepts/hybrid-storage.md).

            Set to `true` to enable hybrid storage. You cannot disable hybrid storage after you save your cluster settings.

            When hybrid storage is enabled, you can use the [Yezzey extension](extensions/yezzey.md) to move part of your [AO and AOCO tables](../concepts/tables.md) from the cluster storage to a cold storage, and vice versa.
            
            Cold storage is a convenient option if you need to store your table data for a long time without using it much. This will make data storage [less costly](../pricing/index.md#rules-storage).

            
            {% note info %}
            
            This feature is at the [Preview](../../overview/concepts/launch-stages.md) stage and is free of charge.
            
            {% endnote %}


        * `pooler_config`: [Connection pooler](../concepts/pooling.md) settings:

            * `pooling_mode`: Operation mode, `SESSION` or `TRANSACTION`.
            * `pool_size`: Maximum number of client connections.
            * `pool_client_idle_timeout`: Idle timeout for a client connection, in seconds.
            * `pool_idle_in_transaction_timeout`: Idle timeout for a client connection with an open transaction (in seconds).

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

        {% note warning %}
        
        The Terraform provider limits the amount of time for all Yandex MPP Analytics for PostgreSQL cluster operations to complete to 120 minutes.
        
        Operations exceeding the set timeout are interrupted.
        
        {% cut "How do I change these limits?" %}
        
        Add the `timeouts` block to the cluster description, for example:
        
        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster name>" {
          ...
          timeouts {
            create = "1h30m" # 1 hour 30 minutes
            update = "2h"    # 2 hours
            delete = "30m"   # 30 minutes
          }
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Create a file named `body.json` and paste the following code into it:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        
        ```json
        {
          "updateMask": "config.backupWindowStart,config.access.dataLens,config.access.yandexQuery,maintenanceWindow,deletionProtection,configSpec.pool.mode,configSpec.pool.size,configSpec.pool.clientIdleTimeout,configSpec.pool.idleInTransactionTimeout,cloudStorage",
          "config": {
            "backupWindowStart": {
              "hours": "<hours>",
              "minutes": "<minutes>",
              "seconds": "<seconds>",
              "nanos": "<nanoseconds>"
            },
            "access": {
              "dataLens": <allow_access_from_DataLens>,
              "yandexQuery": <allow_access_from_Yandex_Query>
            }
          },
          "maintenanceWindow": {
            "weeklyMaintenanceWindow": {
              "day": "<day_of_week>",
              "hour": "<hour>"
            }
          },
          "deletionProtection": <protect_cluster_from_deletion>,
          "configSpec": {
            "pool": {
              "mode": "<operation_mode>",
              "size": "<number_of_client_connections>",
              "clientIdleTimeout": "<client_timeout>",
              "idleInTransactionTimeout": "<client_timeout_during_transaction>"
            }
          },
          "cloudStorage": {
            "enable": <use_hybrid_storage>
          }
        }
        ```




        Where:

        * `updateMask`: Comma-separated list of settings you want to update.

        * `config`: Cluster settings:

            * `backupWindowStart`: [Backup](../concepts/backup.md) window settings.

                In this parameter, specify the backup start time:

                * `hours`: Between `0` and `23` hours.
                * `minutes`: Between `0` and `59` minutes.
                * `seconds`: Between `0` and `59` seconds.
                * `nanos`: Between `0` and `999999999` nanoseconds.

            
            * `access`: Cluster settings for access to the following Yandex Cloud services:

                * `dataLens`: [Yandex DataLens](../../datalens/index.md), `true` or `false`.
                * `yandexQuery`: [Yandex Query](../../query/concepts/index.md), `true` or `false`.



        * `maintenanceWindow`: [Maintenance window](../concepts/maintenance.md) settings, applying to both running and stopped clusters. Provide one of these two parameters:

            * `anytime`: Maintenance takes place at any time.
            * `weeklyMaintenanceWindow`: Maintenance takes place once a week at the specified time:

                * `day`: Day of week in `DDD` format, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
                * `hour`: Time of day (UTC), from `1` to `24`.

        * `deletionProtection`: Cluster deletion protection, `true` or `false`.

            Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

        * `configSpec.pool`: [Connection pooler](../concepts/pooling.md) settings:

            * `mode`: Operation mode, `SESSION` or `TRANSACTION`.
            * `size`: Maximum number of client connections.
            * `clientIdleTimeout`: Idle timeout for a client connection, in seconds.
            * `idleInTransactionTimeout`: Idle timeout for a client connection with an open transaction (in seconds).

        * `cloudStorage.enable`: Use of hybrid storage. Set it to `true` to enable the Yandex Cloud [Yezzey](https://github.com/yezzey-gp/yezzey/) extension in a cluster. This extension is used to export [AO and AOCO tables](../tutorials/yezzey.md) from disks within the Yandex MPP Analytics for PostgreSQL cluster to cold storage in Yandex Object Storage. This way, the data will be stored in a service bucket compressed and encrypted. This is a [more cost-efficient storage method](../../storage/pricing.md).

            You cannot disable hybrid storage after you save your cluster settings.

            
            {% note info %}
            
            This feature is at the [Preview](../../overview/concepts/launch-stages.md) stage and is free of charge.
            
            {% endnote %}


    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data "@body.json"
        ```

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and place it in an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Create a file named `body.json` and paste the following code into it:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        
        ```json
        {
          "cluster_id": "<cluster_ID>"
          "update_mask": {
            "paths": [
              "config.backup_window_start",
              "config.access.data_lens",
              "config.access.yandex_query",
              "maintenance_window",
              "deletion_protection",
              "config_spec.pool.mode",
              "config_spec.pool.size",
              "config_spec.pool.client_idle_timeout",
              "config_spec.pool.idle_in_transaction_timeout",
              "cloud_storage"
            ]
          },
          "config": {
            "backup_window_start": {
              "hours": "<hours>",
              "minutes": "<minutes>",
              "seconds": "<seconds>",
              "nanos": "<nanoseconds>"
            },
            "access": {
              "data_lens": <allow_access_from_DataLens>,
              "yandex_query": <allow_access_from_Yandex_Query>
            }
          },
          "maintenance_window": {
            "weekly_maintenance_window": {
              "day": "<day_of_week>",
              "hour": "<hour>"
            }
          },
          "deletion_protection": <protect_cluster_from_deletion>,
          "config_spec": {
            "pool": {
              "mode": "<operation_mode>",
              "size": "<number_of_client_connections>",
              "client_idle_timeout": "<client_timeout>",
              "idle_in_transaction_timeout": "<client_timeout_during_transaction>"
            }
          },
          "cloud_storage": {
            "enable": <use_hybrid_storage>
          }
        }
        ```




        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

        * `config`: Cluster settings:

            * `backup_window_start`: [Backup](../concepts/backup.md) window settings.

                Here, specify the backup start time:

                * `hours`: Between `0` and `23` hours.
                * `minutes`: Between `0` and `59` minutes.
                * `seconds`: Between `0` and `59` seconds.
                * `nanos`: Between `0` and `999999999` nanoseconds.

            
            * `access`: Cluster settings for access to the following Yandex Cloud services:

                * `data_lens`: [Yandex DataLens](../../datalens/index.md), `true` or `false`.
                * `yandex_query`: [Yandex Query](../../query/concepts/index.md), `true` or `false`.



        * `maintenance_window`: [Maintenance](../concepts/maintenance.md) window settings, including for stopped clusters. Provide one of these two parameters:

            * `anytime`: Maintenance takes place at any time.
            * `weekly_maintenance_window`: Maintenance takes place once a week at the specified time:

                * `day`: Day of week in `DDD` format, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
                * `hour`: Time of day (UTC), from `1` to `24`.

        * `deletion_protection`: Cluster deletion protection, `true` or `false`.

            Even with deletion protection enabled, one can still connect to the cluster manually and delete the data.

        * `config_spec.pool`: [Connection pooler](../concepts/pooling.md) settings:

            * `mode`: Operation mode, `SESSION` or `TRANSACTION`.
            * `size`: Maximum number of client connections.
            * `client_idle_timeout`: Idle timeout for a client connection, in seconds.
            * `pool_idle_in_transaction_timeout`: Idle timeout for a client connection with an open transaction (in seconds).

        * `cloud_storage.enable`: Use of hybrid storage. Set it to `true` to enable the Yandex Cloud [Yezzey](https://github.com/yezzey-gp/yezzey/) extension in a cluster. This extension is used to export [AO and AOCO tables](../tutorials/yezzey.md) from disks within the Yandex MPP Analytics for PostgreSQL cluster to cold storage in Yandex Object Storage. This way, the data will be stored in a service bucket compressed and encrypted. This is a [more cost-efficient storage method](../../storage/pricing.md).

            You cannot disable hybrid storage after you save your cluster settings.

            
            {% note info %}
            
            This feature is at the [Preview](../../overview/concepts/launch-stages.md) stage and is free of charge.
            
            {% endnote %}


        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d @ \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update \
            < body.json
        ```

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing the scheduled maintenance operations settings {#change-background-settings}

You can change your cluster's [scheduled maintenance operations](../concepts/maintenance.md#regular-ops) settings.

{% list tabs group=instructions %}

- Management console {#console}

    1. Open the [folder dashboard](https://console.yandex.cloud).
    1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
    1. Select your cluster and click **Edit** in the top panel.
    1. Under **Managing background processes**, change these parameters:

        * **Start time (UTC)**: `VACUUM` start time. The default value is `19:00 UTC`. Once the `VACUUM` operation is completed, the `ANALYZE` operation starts.
        * **VACUUM timeout**: Maximum `VACUUM` execution time, in seconds. Valid values: from `7,200` to `86,399`, with `36,000` by default. As soon as this period expires, `VACUUM` will be forced to terminate.
        * **ANALYZE timeout**: Maximum `ANALYZE` execution time, in seconds. Valid values: from `7,200` to `86,399`, with `36,000` by default. As soon as this period expires, the `ANALYZE` operation will be forced to terminate.
        
        The combined `VACUUM` and `ANALYZE` execution time may not exceed 24 hours.

    1. Click **Save**.

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "configSpec.backgroundActivities.analyzeAndVacuum.start,configSpec.backgroundActivities.analyzeAndVacuum.analyzeTimeout,configSpec.backgroundActivities.analyzeAndVacuum.vacuumTimeout",
                      "configSpec": {
                        "backgroundActivities": {
                          "analyzeAndVacuum": {
                            "start": {
                              "hours": "<operation_start_hour>",
                              "minutes": "<operation_start_minute>"
                            },
                            "analyzeTimeout": "<ANALYZE_operation_duration>",
                            "vacuumTimeout": "<VACUUM_operation_duration>"
                          }
                        }
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

        * `configSpec.backgroundActivities.analyzeAndVacuum`: Background process management settings:

            * `start.hours`: Start hour of the `VACUUM` operation in UTC. The values range from `0` to `23`, the default one is `19`.
            * `start.minutes`: Start minute of the `VACUUM` operation in UTC. The values range from `0` to `59`, the default one is `0`.
            * `analyzeTimeout`: Maximum duration of the `ANALYZE` operation, in seconds. The values range from `7200` to `86399`, the default one is `36000`. As soon as this period expires, the `ANALYZE` operation will be forced to terminate.
            * `vacuumTimeout`: Maximum duration of the `VACUUM` operation, in seconds. The values range from `7200` to `86399`, the default one is `36000`. As soon as this period expires, the `VACUUM` operation will be forced to terminate.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.
    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ 
                      "config_spec.background_activities.analyze_and_vacuum.start",
                      "config_spec.background_activities.analyze_and_vacuum.analyze_timeout",
                      "config_spec.background_activities.analyze_and_vacuum.vacuumTimeout"
                    ]
                  },
                  "config_spec": {
                    "background_activities": {
                      "analyze_and_vacuum": {
                        "start": {
                          "hours": "<operation_start_hour>",
                          "minutes": "<operation_start_minute>"
                        },
                        "analyze_timeout": "<ANALYZE_operation_duration>",
                        "vacuum_timeout": "<VACUUM_operation_duration>"
                      }
                    }
                  } 
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

        * `config_spec.background_activities.analyze_and_vacuum`: Background process management settings:

            * `start.hours`: Start hour of the `VACUUM` operation in UTC. The values range from `0` to `23`, the default one is `19`.
            * `start.minutes`: Start minute of the `VACUUM` operation in UTC. The values range from `0` to `59`, the default one is `0`.
            * `analyze_timeout`: Maximum duration of the `ANALYZE` operation, in seconds. The values range from `7200` to `86399`, the default one is `36000`. As soon as this period expires, the `ANALYZE` operation will be forced to terminate.
            * `vacuum_timeout`: Maximum duration of the `VACUUM` operation, in seconds. The values range from `7200` to `86399`, the default one is `36000`. As soon as this period expires, the `VACUUM` operation will be forced to terminate.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Updating the DBMS settings {#change-gp-settings}

You can change your cluster's [global DBMS settings](../concepts/settings-list.md). For a list of configurable settings, see [DBMS settings](../concepts/settings-list.md).

{% note info %}

To update user-level settings, including those not managed by Yandex MPP Analytics for PostgreSQL at the cluster level, use the following command:

```sql
ALTER ROLE <role_name> SET <setting> = <value>;
```

To update settings at the individual database level, use the following command:

```sql
ALTER DATABASE <DB_name> SET <setting> = <value>;
```

For a full list of settings, see the [Greenplum® guide](https://techdocs.broadcom.com/us/en/vmware-tanzu/data-solutions/tanzu-greenplum/6/greenplum-database/ref_guide-config_params-guc-list.html).

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [folder dashboard](https://console.yandex.cloud).
  1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
  1. Select your cluster and click **Edit** in the top panel.
  1. Update the [DBMS settings](../concepts/settings-list.md) by clicking **Settings** under **DBMS settings**.
  1. Click **Save**.
  1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To update the [DBMS settings](../concepts/settings-list.md):

  1. View the full list of settings for the cluster:

     ```bash
     yc managed-greenplum cluster get <cluster_name_or_ID>
     ```

  1. View the description of the CLI command for updating a cluster configuration:

      ```bash
      yc managed-greenplum cluster update-config --help
      ```

  1. Set the parameter values as needed:

      All supported parameters are listed in the [request format for the update method](../api-ref/Cluster/update.md), in the `greenplumConfig_<DBMS_version>` field. To specify a parameter name in the CLI call, convert its name from <q>lowerCamelCase</q> to <q>snake_case</q>. For example, convert the `maxConnections` parameter from an API request to `max_connections` for the CLI command:

      ```bash
      yc managed-greenplum cluster update-config <cluster_name_or_ID> \
         --set <parameter1_name>=<value1>,<parameter2_name>=<value2>,...
      ```

      Yandex MPP Analytics for PostgreSQL will run the update cluster settings operation.

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For more information about creating this file, see [Creating clusters](cluster-create.md).

        For a complete list of configurable Yandex MPP Analytics for PostgreSQL cluster fields, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

    1. In the cluster description, edit the [DBMS settings](../concepts/settings-list.md) under `greenplum_config`:

        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
          ...
          greenplum_config = {
            max_connections         = <maximum_number_of_connections>
            gp_workfile_compression = <true_or_false>
            ...
          }
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

        {% note warning %}
        
        The Terraform provider limits the amount of time for all Yandex MPP Analytics for PostgreSQL cluster operations to complete to 120 minutes.
        
        Operations exceeding the set timeout are interrupted.
        
        {% cut "How do I change these limits?" %}
        
        Add the `timeouts` block to the cluster description, for example:
        
        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster name>" {
          ...
          timeouts {
            create = "1h30m" # 1 hour 30 minutes
            update = "2h"    # 2 hours
            delete = "30m"   # 30 minutes
          }
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "configSpec.greenplumConfig_<DBMS_version>.<setting_1>,...,configSpec.greenplumConfig_<DBMS_version>.<setting_N>",
                      "configSpec": {
                        "greenplumConfig_<DBMS_version>": {
                          "<setting_1>": "<value_1>",
                          "<setting_2>": "<value_2>",
                          ...
                          "<setting_N>": "<value_N>"
                        }
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

            In this case, specify all DBMS settings you want to update.

        * `configSpec.greenplumConfig_<DBMS_version>`: DBMS settings. Enter each setting on a new line, separated by commas. See [Cluster-level DBMS settings](../concepts/settings-list.md#dbms-cluster-settings) for a description and possible values for each setting.

            Available DBMS versions: Greenplum® `6.28` and `6.29` and Apache Cloudberry™ `2.0-cb`.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ 
                      "config_spec.greenplum_config_<DBMS_version>.<setting_1>",
                      "config_spec.greenplum_config_<DBMS_version>.<setting_2>",
                      ...
                      "config_spec.greenplum_config_<DBMS_version>.<setting_N>"
                    ]
                  },
                  "config_spec": {
                    "greenplum_config_<DBMS_version>": {
                      "<setting_1>": "<value_1>",
                      "<setting_2>": "<value_2>",
                      ...
                      "<setting_N>": "<value_N>"
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

            In this case, specify all DBMS settings you want to update.

        * `config_spec.greenplum_config_<DBMS_version>`: DBMS settings. Enter each setting on a new line, separated by commas. See [DBMS settings](../concepts/settings-list.md) for a description and possible values for each setting.

            Available DBMS versions: Greenplum® `6.28` and `6.29` and Apache Cloudberry™ `2.0-cb`.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing the host class {#change-resource-preset}

You can change the host class for both master hosts and segment hosts. When changing the host class:

* The cluster's primary master host will change.
* A cluster with local SSD storage may be unavailable for an extended period if data migration to another physical server is required.
* Using a [special FQDN](connect/fqdn.md#fqdn-master) does not guarantee a stable database connection: user sessions may be terminated.

Changing the segment host class [affects](../concepts/instance-types.md#select-class-segment-hosts) the maximum amount of memory allocated to each Yandex MPP Analytics for PostgreSQL server process.

We recommend changing the host class only when the cluster is idle.

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [folder dashboard](https://console.yandex.cloud).
  1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
  1. Select the cluster and click ![image](../../_assets/console-icons/pencil.svg) **Edit** in the top panel.
  1. Under **Host class**, select a class for Yandex MPP Analytics for PostgreSQL master hosts or segment hosts.
  1. Click **Save changes**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To change the cluster’s [host class](../concepts/instance-types.md):

  1. View the description of the CLI command for updating a cluster:

      ```bash
      yc managed-greenplum cluster update --help
      ```

  1. Request a list of available classes (the `ZONE IDS` column lists the availability zones where you can select the appropriate class):
     * For master hosts:

        ```bash
        yc managed-greenplum resource-preset list master
        ```

     * For segment hosts:

        ```bash
        yc managed-greenplum resource-preset list segment
        ```

     
     ```text
     +-------------+--------------------------------+--------------------------------+-------+----------+--------------------+---------------------+
     |     ID      |            ZONE IDS            |           DISK TYPES           | CORES |  MEMORY  | HOST COUNT DIVIDER | MAX SEGMENT IN HOST |
     +-------------+--------------------------------+--------------------------------+-------+----------+--------------------+---------------------+
     | i2.2xlarge  | ru-central1-a, ru-central1-b   | local-ssd,                     |    16 | 128.0 GB |                  1 |                   0 |
     |             |                                | network-ssd-nonreplicated      |       |          |                    |                     |
     | ...                                                                                                                                         |
     +-------------+--------------------------------+--------------------------------+-------+----------+--------------------+---------------------+
     ```


  1. Specify the relevant classes in the cluster update command:

      ```bash
      yc managed-greenplum cluster update <cluster_name_or_ID> \
          --master-config resource-id=<master_host_class_ID> \
          --segment-config resource-id=<segment_host_class_ID>
      ```

      Yandex MPP Analytics for PostgreSQL will run the update host class command for the cluster.

- Terraform {#tf}

  1. Open the current Terraform configuration file with the infrastructure plan.

      For more information about creating this file, see [Creating clusters](cluster-create.md).

      For a complete list of configurable Yandex MPP Analytics for PostgreSQL cluster fields, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

  1. In the Yandex MPP Analytics for PostgreSQL cluster description, edit the `resource_preset_id` attribute value under `master_subcluster.resources` or `segment_subcluster.resources`:

      ```hcl
      resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
        ...
        master_subcluster {
          resources {
            resource_preset_id = "<host_class>"
            ...
          }
        }
        segment_subcluster {
          resources {
            resource_preset_id = "<host_class>"
            ...
          }
        }
      }
      ```

  1. Make sure the settings are correct.

      1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
      1. Run this command:
      
         ```bash
         terraform validate
         ```
      
         Terraform will show any errors found in your configuration files.

  1. Confirm updating the resources.

      1. Run this command to view the planned changes:
      
         ```bash
         terraform plan
         ```
      
         If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
      
      1. If everything looks correct, apply the changes:
         1. Run this command:
      
            ```bash
            terraform apply
            ```
      
         1. Confirm updating the resources.
         1. Wait for the operation to complete.

      {% note warning %}
      
      The Terraform provider limits the amount of time for all Yandex MPP Analytics for PostgreSQL cluster operations to complete to 120 minutes.
      
      Operations exceeding the set timeout are interrupted.
      
      {% cut "How do I change these limits?" %}
      
      Add the `timeouts` block to the cluster description, for example:
      
      ```hcl
      resource "yandex_mdb_greenplum_cluster" "<cluster name>" {
        ...
        timeouts {
          create = "1h30m" # 1 hour 30 minutes
          update = "2h"    # 2 hours
          delete = "30m"   # 30 minutes
        }
      }
      ```
      
      {% endcut %}
      
      {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "masterConfig.resources.resourcePresetId,segmentConfig.resources.resourcePresetId",
                      "masterConfig": {
                        "resources": {
                          "resourcePresetId": "<host_class>"
                        }
                      },
                      "segmentConfig": {
                        "resources": {
                          "resourcePresetId": "<host_class>"
                        }
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings you want to update.

        * `masterConfig.resources.resourcePresetId` and `segmentConfig.resources.resourcePresetId`: New [host class](../concepts/instance-types.md) for master and segment hosts.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ 
                      "master_config.resources.resource_preset_id",
                      "segment_config.resources.resource_preset_id"
                    ]
                  },
                  "master_config": {
                    "resources": {
                      "resource_preset_id": "<host_class>"
                    }
                  },
                  "segment_config": {
                    "resources": {
                      "resource_preset_id": "<host_class>"
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

        * `master_config.resources.resource_preset_id` and `segment_config.resources.resource_preset_id`: New [host class](../concepts/instance-types.md) for master and segment hosts.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing the disk type and expanding the storage size {#change-disk-size}

Make sure the cloud has enough quota to increase the storage size. Open the cloud's [Quotas](https://console.yandex.cloud/cloud?section=quotas) page and check the **HDD storage capacity** and **SSD storage capacity** lines under **Managed Databases** to make sure there is available quota for storage space.

{% list tabs group=instructions %}

- Management console {#console}

  To change the disk type and increase the storage size for a cluster:

  1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
  1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
  1. Select the cluster.
  1. At the top of the page, click **Edit**.
  1. Under **Storage**:

      * Select the [disk type](../concepts/storage.md).
      * Specify the disk size.

  1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  To increase your cluster storage size:

  1. View the description of the CLI command for updating a cluster:

      ```bash
      yc managed-greenplum cluster update --help
      ```

  1. Specify the storage size for master or segment hosts in the cluster update command (at least as large as `disk_size` in the cluster properties):

      ```bash
      yc managed-mysql cluster update <cluster_name_or_ID> \
         --master-config disk-size <storage_size_in_GB> \
         --segment-config disk-size <storage_size_in_GB>
      ```

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For more information about creating this file, see [Creating clusters](cluster-create.md).

        For a complete list of configurable Yandex MPP Analytics for PostgreSQL cluster fields, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

    1. In the Yandex MPP Analytics for PostgreSQL cluster description, edit the values of the `disk_type_id` and `disk_size` attributes under `master_subcluster.resources` or `segment_subcluster.resources`:

        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
          ...
          master_subcluster {
            resources {
              disk_type_id = "<disk_type>"
              disk_size    = <storage_size_in_GB>
              ...
            }
          }
          segment_subcluster {
            resources {
              disk_type_id = "<disk_type>"
              disk_size    = <storage_size_in_GB>
              ...
            }
          }
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

        {% note warning %}
        
        The Terraform provider limits the amount of time for all Yandex MPP Analytics for PostgreSQL cluster operations to complete to 120 minutes.
        
        Operations exceeding the set timeout are interrupted.
        
        {% cut "How do I change these limits?" %}
        
        Add the `timeouts` block to the cluster description, for example:
        
        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster name>" {
          ...
          timeouts {
            create = "1h30m" # 1 hour 30 minutes
            update = "2h"    # 2 hours
            delete = "30m"   # 30 minutes
          }
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "masterConfig.resources.diskTypeId,masterConfig.resources.diskSize,segmentConfig.resources.diskTypeId,segmentConfig.resources.diskSize",
                      "masterConfig": {
                        "resources": {
                          "diskTypeId": "<disk_type>",
                          "diskSize": "<storage_size_in_bytes>"
                        }
                      },
                      "segmentConfig": {
                        "resources": {
                          "diskTypeId": "<disk_type>",
                          "diskSize": "<storage_size_in_bytes>"
                        }
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings you want to update.

        * `masterConfig.resources`, `segmentConfig.resources`: Storage properties for master hosts and segment hosts:

            * `diskTypeId`: [Disk type](../concepts/storage.md).
            * `diskSize`: New storage size in bytes.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ 
                      "master_config.resources.disk_type_id",
                      "master_config.resources.disk_size",
                      "segment_config.resources.disk_type_id",
                      "segment_config.resources.disk_size"
                    ]
                  },
                  "master_config": {
                    "resources": {
                      "disk_type_id": "<disk_type>",
                      "disk_size": "<storage_size_in_bytes>"
                    }
                  },
                  "segment_config": {
                    "resources": {
                      "disk_type_id": "<disk_type>",
                      "disk_size": "<storage_size_in_bytes>"
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

        * `master_config.resources`, `segment_config.resources`: Storage properties for master hosts and segment hosts:

            * `disk_type_id`: [Disk type](../concepts/storage.md).
            * `disk_size`: New storage size in bytes.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}


## Changing service account settings {#change-service-account}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
    1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
    1. Select the cluster.
    1. At the top of the page, click **Edit**.
    1. In the **Service account** field, select a service account from the list or [create a new one](../../iam/operations/sa/create.md).
    1. Click **Save**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To change the ID of the cluster service account:

    1. View the description of the CLI command for updating a cluster configuration:

        ```bash
        yc managed-greenplum cluster update --help
        ```

    1. Specify the service account ID:

        ```bash
        yc managed-greenplum cluster update <cluster_name_or_ID> \
           --service-account <service_account_ID>
        ```

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For more information about creating this file, see [Creating clusters](cluster-create.md).

        For a complete list of configurable Yandex MPP Analytics for PostgreSQL cluster fields, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

    1. In the Yandex MPP Analytics for PostgreSQL cluster description, edit the `service_account_id` attribute value:

        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
          service_account_id = "<service_account_ID>"
          ...
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

        {% note warning %}
        
        The Terraform provider limits the amount of time for all Yandex MPP Analytics for PostgreSQL cluster operations to complete to 120 minutes.
        
        Operations exceeding the set timeout are interrupted.
        
        {% cut "How do I change these limits?" %}
        
        Add the `timeouts` block to the cluster description, for example:
        
        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster name>" {
          ...
          timeouts {
            create = "1h30m" # 1 hour 30 minutes
            update = "2h"    # 2 hours
            delete = "30m"   # 30 minutes
          }
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "serviceAccountId",
                      "serviceAccountId": "<service_account_ID>"
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

            Here, we provide only one setting.

        * `serviceAccountId`: Service account ID.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ "service_account_id" ]
                  },
                  "service_account_id": "<service_account_ID>"
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Here, we provide only one setting.

        * `service_account_id`: Service account ID.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing logging settings {#change-logging}

You can change the settings for [transferring cluster logs to Yandex Cloud Logging](mgp-to-cloud-logging.md).

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder containing your cluster.
    1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
    1. Select the cluster.
    1. At the top of the page, click **Edit**.
    1. Under **Advanced settings**, enable or disable logging using the **Write logs** option. If you turn logging on, configure it:

        * Specify logging destination:

          * **Folder**: Log to the default log group for the selected folder.
          * **Group**: Log either to a new [log group](../../logging/concepts/log-group.md) or one selected from the list.

        * Select the logs you need:

          * **Command Center logs**: Enables [Command Center](../concepts/command-center.md) logs.
          * **Greenplum logs**: Enables DBMS logging.
    1. Click **Save**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To change logging settings:

    1. View the description of the CLI command for updating a cluster configuration:

        ```bash
        yc managed-greenplum cluster update --help
        ```

    1. Specify the logging settings to update in the update cluster command:

        ```bash
        yc managed-greenplum cluster update <cluster_name_or_ID> \
           --log-enabled \
           --log-command-center-enabled \
           --log-greenplum-enabled \
           --log-pooler-enabled \
           --log-folder-id <folder_ID>
        ```

        Where:

        * `--log-enabled`: Enables log transfer. Required for other flags responsible for transferring specific logs, e.g., `--log-greenplum-enabled`.
        * `--log-command-center-enabled`: Transferring [Command Center](../concepts/command-center.md) logs.
        * `--log-greenplum-enabled`: Transferring DBMS logs.
        * `--log-pooler-enabled`: Transferring [connection pooler](../concepts/pooling.md) logs.
        * `--log-folder-id`: Specify the ID of the folder whose log group you want to use.
        * `--log-group-id`: ID of the log group to write logs to.

            Specify either `--log-folder-id` or `--log-group-id`.

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.

        For more information about creating this file, see [Creating clusters](cluster-create.md).

        For a complete list of configurable Yandex MPP Analytics for PostgreSQL cluster fields, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

    1. In the Yandex MPP Analytics for PostgreSQL cluster description, edit the attribute values in the `logging` section:

        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
          ...
          logging {
            enabled                = <enable_transferring_logs>
            command_center_enabled = <transfer_Yandex_Command_Center_logs>
            greenplum_enabled      = <transfer_DBMS_logs>
            pooler_enabled         = <transfer_connection_pooler_logs>
            folder_id              = "<folder_ID>"
          }
        }
        ```

        Where:

        * `enabled`: Manages log transfer, `true` or `false`. To enable parameters responsible for transferring specific logs, provide the `true` value.
        * `command_center_enabled`: Transferring [Command Center](../concepts/command-center.md) logs, `true` or `false`.
        * `greenplum_enabled`: Transferring DBMS logs, `true` or `false`.
        * `pooler_enabled`: Transferring [connection pooler](../concepts/pooling.md) logs, `true` or `false`.
        * `folder_id`: Specify the ID of the folder whose log group you want to use.
        * `log_group_id`: ID of the log group to write logs to.

            Specify either `folder_id` or `log_group_id`.

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm updating the resources.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

        {% note warning %}
        
        The Terraform provider limits the amount of time for all Yandex MPP Analytics for PostgreSQL cluster operations to complete to 120 minutes.
        
        Operations exceeding the set timeout are interrupted.
        
        {% cut "How do I change these limits?" %}
        
        Add the `timeouts` block to the cluster description, for example:
        
        ```hcl
        resource "yandex_mdb_greenplum_cluster" "<cluster name>" {
          ...
          timeouts {
            create = "1h30m" # 1 hour 30 minutes
            update = "2h"    # 2 hours
            delete = "30m"   # 30 minutes
          }
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.Update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "logging.enabled,logging.commandCenterEnabled,logging.greenplumEnabled,logging.poolerEnabled,logging.folderId",
                      "logging": {
                        "enabled": "<enable_transferring_logs>",
                        "commandCenterEnabled": "<transfer_Yandex_Command_Center_logs>",
                        "greenplumEnabled": "<transfer_DBMS_logs>",
                        "poolerEnabled": "<transfer_connection_pooler_logs>",
                        "folderId": "<folder_ID>"
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings to update.

        * `logging`: Logging settings:

            * `enabled`: Manages log transfer, `true` or `false`. To enable parameters responsible for transferring specific logs, provide the `true` value.
            * `commandCenterEnabled`: Transferring [Command Center](../concepts/command-center.md) logs, `true` or `false`.
            * `greenplumEnabled`: Transferring DBMS logs, `true` or `false`.
            * `poolerEnabled`: Transferring [connection pooler](../concepts/pooling.md) logs, `true` or `false`.
            * `folderId`: Specify the ID of the folder whose log group you want to use.
            * `logGroupId`: ID of the log group to write logs to.

                Specify either `folderId` or `logGroupId`.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.
    1. Call the [ClusterService.Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [ 
                      "logging.enabled",
                      "logging.command_center_enabled",
                      "logging.greenplum_enabled",
                      "logging.pooler_enabled",
                      "logging.folder_id"
                    ]
                  },
                  "logging": {
                    "enabled": "<enable_transferring_logs>",
                    "command_center_enabled": "<transfer_Yandex_Command_Center_logs>",
                    "greenplum_enabled": "<transfer_DBMS_logs>",
                    "pooler_enabled": "<transfer_connection_pooler_logs>",
                    "folder_id": "<folder_ID>"
                  } 
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.greenplum.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings to update as an array of strings (`paths[]`).

        * `logging`: Logging settings:

            * `enabled`: Manages log transfer, `true` or `false`. To enable parameters responsible for transferring specific logs, provide the `true` value.
            * `command_center_enabled`: Transferring [Command Center](../concepts/command-center.md) logs, `true` or `false`.
            * `greenplum_enabled`: Transferring DBMS logs, `true` or `false`.
            * `pooler_enabled`: Transferring [connection pooler](../concepts/pooling.md) logs, `true` or `false`.
            * `folder_id`: Specify the ID of the folder whose log group you want to use.
            * `log_group_id`: ID of the log group to write logs to.

                Specify either `folder_id` or `log_group_id`.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}


_Greenplum® and Greenplum Database® are registered trademarks or trademarks of Broadcom Inc. in the United States and/or other countries._

_Apache® and Apache Cloudberry™ are registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries._