修改 Amazon DocumentDB 叢集參數 - Amazon DocumentDB

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

修改 Amazon DocumentDB 叢集參數

在 Amazon DocumentDB 中,叢集數群組包含適用於您在叢集中建立的所有執行個體的參數。如為自訂叢集參數群組,您隨時可以為您建立的參數群組修改其參數值,或將所有參數值重設為預設值。本節說明如何檢視組成 Amazon DocumentDB 叢集參數群組的參數及其值,以及如何變更或更新這些值。

參數可以是 dynamic (動態)static (靜態)。當您變更動態參數並儲存叢集參數群組時,無論 Apply Immediately 設定為何,變更都會立即套用。當您變更靜態參數並儲存叢集參數群組時,參數變更只會在您手動重新啟動叢集執行個體之後生效。

檢視亞 Amazon DocumentDB 叢集參數群組的參數

您可以使用或查看 Amazon DocumentDB 叢集的參數及其值。AWS Management Console AWS CLI

Using the AWS Management Console
若要檢視叢集參數群組的詳細資訊
  1. 登入AWS Management Console,然後在 https://console.aws.amazon.com/docdb 開啟 Amazon DocumentDB 主控台。

  2. 在導覽窗格中,選擇 Parameter groups (參數群組)。

    提示

    如果畫面左側沒有出現導覽窗格,請選擇頁面左上角的功能表圖示 ()。

  3. Parameter groups (參數群組) 窗格中,選擇您想要查看詳細資訊的叢集參數群組名稱。

  4. 結果頁面會顯示各個參數的下列值:參數名稱、目前值、允許值、參數是否可修改、來源、資料類型和說明。

    螢幕擷取畫面:參數名稱與值。
Using the AWS CLI

若要查看叢集參數群組的參數和其值,請使用 describe-db-cluster-parameters 操作搭配下列參數。

  • --db-cluster-parameter-group-name – 必要。您想要詳細參數清單的叢集參數群組名稱。

  • --source-可選。如果提供,只會傳回特定來源的參數。參數來源可以是 engine-defaultsystemuser

以下程式碼列出 custom3-6-param-grp 參數群組的參數及其值。如需參數群組的詳細資訊,請省略 --query 行。如需所有參數群組的詳細資訊,請省略 --db-cluster-parameter-group-name 行。

若為 Linux、macOS 或 Unix:

aws docdb describe-db-cluster-parameters \ --db-cluster-parameter-group-name custom3-6-param-grp \ --query 'Parameters[*].[ParameterName,ParameterValue]'

針對 Windows:

aws docdb describe-db-cluster-parameters ^ --db-cluster-parameter-group-name custom3-6-param-grp ^ --query 'Parameters[*].[ParameterName,ParameterValue]'

此操作的輸出將會如下所示 (JSON 格式)。

[ [ "audit_logs", "disabled" ], [ "tls", "enabled" ], [ "ttl_monitor", "enabled" ] ]

修改 Amazon DocumentDB 群組參數組的參數

您可以使用 AWS Management Console或 AWS CLI 修改參數群組的參數。

Using the AWS Management Console
更新叢集參數群組的參數
  1. 登入AWS Management Console,然後在 https://console.aws.amazon.com/docdb 開啟 Amazon DocumentDB 主控台。

  2. 在導覽窗格中,選擇 Parameter groups (參數群組)。

    提示

    如果畫面左側沒有出現導覽窗格,請選擇頁面左上角的功能表圖示 ()。

  3. Parameter groups (參數群組) 窗格中,選擇您想要更新其中參數的叢集參數群組。

  4. 結果頁面會顯示這個叢集參數群組的參數,及其對應詳細資訊。選取要更新的參數。

  5. 在頁面右上角,選擇 Edit (編輯) 以變更此參數值。如需叢集參數類型的詳細資訊,請參閱Amazon DocumentDB 群集參數參考

  6. 進行變更,然後選擇 Modify cluster parameter (修改叢集參數) 以儲存變更。若要捨棄變更,請選擇 Cancel (取消)

Using the AWS CLI

若要修改叢集參數群組的參數,請使用 modify-db-cluster-parameter-group 操作搭配下列參數。

  • --db-cluster-parameter-group-name – 必要。您想要修改的叢集參數群組名稱。

  • --parameters – 必要。您正在修改的一或多個參數。每個參數項目必須包括下列:

    • ParameterName— 您要修改的參數名稱。

    • ParameterValue— 此參數的新值。

    • ApplyMethod— 套用此參數變更的方式。允許值為 immediatepending-reboot

      注意

      static 必須擁有使用 ApplyType 的參數 ApplyMethod pending-reboot

變更叢集參數群組的參數值 (AWS CLI)

下列範例會變更 tls 參數。

  1. 列出參數和其 sample-parameter-group 的值

    若為 Linux、macOS 或 Unix:

    aws docdb describe-db-cluster-parameters \ --db-cluster-parameter-group-name sample-parameter-group

    針對 Windows:

    aws docdb describe-db-cluster-parameters ^ --db-cluster-parameter-group-name sample-parameter-group

    此操作的輸出將會如下所示 (JSON 格式)。

    { "Parameters": [ { "Source": "system", "ApplyType": "static", "AllowedValues": "disabled,enabled", "ParameterValue": "enabled", "ApplyMethod": "pending-reboot", "DataType": "string", "ParameterName": "tls", "IsModifiable": true, "Description": "Config to enable/disable TLS" }, { "Source": "user", "ApplyType": "dynamic", "AllowedValues": "disabled,enabled", "ParameterValue": "enabled", "ApplyMethod": "pending-reboot", "DataType": "string", "ParameterName": "ttl_monitor", "IsModifiable": true, "Description": "Enables TTL Monitoring" } ] }
  2. 修改 tls 參數,讓其值為 disabled。您無法修改 ApplyMethod,因為 ApplyTypestatic

    若為 Linux、macOS 或 Unix:

    aws docdb modify-db-cluster-parameter-group \ --db-cluster-parameter-group-name sample-parameter-group \ --parameters "ParameterName"=tls,ParameterValue=disabled,ApplyMethod=pending-reboot"

    針對 Windows:

    aws docdb modify-db-cluster-parameter-group ^ --db-cluster-parameter-group-name sample-parameter-group ^ --parameters "ParameterName=tls,ParameterValue=disabled,ApplyMethod=pending-reboot"

    此操作的輸出將會如下所示 (JSON 格式)。

    { "DBClusterParameterGroupName": "sample-parameter-group" }
  3. 等待至少 5 分鐘。

  4. 列出 sample-parameter-group 的參數值。

    若為 Linux、macOS 或 Unix:

    aws docdb describe-db-cluster-parameters \ --db-cluster-parameter-group-name sample-parameter-group

    針對 Windows:

    aws docdb describe-db-cluster-parameters ^ --db-cluster-parameter-group-name sample-parameter-group

    此操作的輸出將會如下所示 (JSON 格式)。

    { "Parameters": [ { "ParameterName": "audit_logs", "ParameterValue": "disabled", "Description": "Enables auditing on cluster.", "Source": "system", "ApplyType": "dynamic", "DataType": "string", "AllowedValues": "enabled,disabled", "IsModifiable": true, "ApplyMethod": "pending-reboot" }, { "ParameterName": "tls", "ParameterValue": "disabled", "Description": "Config to enable/disable TLS", "Source": "user", "ApplyType": "static", "DataType": "string", "AllowedValues": "disabled,enabled", "IsModifiable": true, "ApplyMethod": "pending-reboot" } ] }