使用 在 Aurora DSQL 中管理叢集 AWS CLI - Amazon Aurora DSQL

Amazon Aurora DSQL 以預覽服務的形式提供。若要進一步了解,請參閱 AWS 服務條款中的 Beta 版和預覽版。

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

使用 在 Aurora DSQL 中管理叢集 AWS CLI

請參閱下列各節,了解如何使用 管理您的叢集 AWS CLI。

CreateCluster

若要建立叢集,請使用 create-cluster命令。

注意

叢集建立會以非同步方式進行。呼叫 GetCluster API,直到狀態為 為止ACTIVE。一旦叢集變成 ,您就可以連線到叢集ACTIVE

範例命令

aws dsql create-cluster --region us-east-1
注意

如果您想要在建立時停用刪除保護,請包含 --no-deletion-protection-enabled旗標。

回應範例

{ "identifier": "foo0bar1baz2quux3quuux4", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4", "status": "CREATING", "creationTime": "2024-05-25T16:56:49.784000-07:00", "deletionProtectionEnabled": true }

GetCluster

若要描述 叢集,請使用 get-cluster命令。

範例命令

aws dsql get-cluster \ --region us-east-1 \ --identifier <your_cluster_id>

回應範例

{ "identifier": "foo0bar1baz2quux3quuux4", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4", "status": "ACTIVE", "creationTime": "2024-05-24T09:15:32.708000-07:00", "deletionProtectionEnabled": false }

UpdateCluster

若要更新現有的叢集,請使用 update-cluster命令。

注意

更新會以非同步方式進行。呼叫 GetCluster API,直到狀態為 ACTIVE為止,您將會看到變更。

範例命令

aws dsql update-cluster \ --region us-east-1 \ --no-deletion-protection-enabled \ --identifier your_cluster_id

回應範例

{ "identifier": "foo0bar1baz2quux3quuux4", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4", "status": "UPDATING", "creationTime": "2024-05-24T09:15:32.708000-07:00", "deletionProtectionEnabled": true }

DeleteCluster

若要刪除現有的叢集,請使用 delete-cluster命令。

注意

您只能刪除已停用刪除保護的叢集。建立新叢集時,預設會啟用刪除保護。

範例命令

aws dsql delete-cluster \ --region us-east-1 \ --identifier your_cluster_id

回應範例

{ "identifier": "foo0bar1baz2quux3quuux4", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4", "status": "DELETING", "creationTime": "2024-05-24T09:16:43.778000-07:00", "deletionProtectionEnabled": false }

ListClusters

若要取得叢集的 ,請使用 list-clusters命令。

範例命令

aws dsql list-clusters --region us-east-1

回應範例

{ "clusters": [ { "identifier": "foo0bar1baz2quux3quux4quuux", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quux4quuux" }, { "identifier": "foo0bar1baz2quux3quux4quuuux", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quux4quuuux" }, { "identifier": "foo0bar1baz2quux3quux4quuuuux", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quux4quuuuux" } ] }

CreateMultiRegionClusters

若要建立多區域連結叢集,請使用 create-multi-region-clusters命令。您可以從連結叢集對中的讀寫區域發出命令。

範例命令

aws dsql create-multi-region-clusters \ --region us-east-1 \ --linked-region-list us-east-1 us-east-2 \ --witness-region us-west-2 \ --client-token test-1

如果 API 操作成功,兩個連結的叢集都會進入 CREATING 狀態,而叢集建立將以非同步方式繼續。若要監控進度,您可以呼叫每個區域中的 GetCluster API,直到傳回狀態顯示 ACTIVE。一旦兩個連結的叢集變成 ACTIVE,您就可以連線到叢集。

注意

在預覽期間,如果您遇到一個叢集是 ACTIVE和其他 的情況FAILED,我們建議您刪除連結的叢集並再次建立它們。

{ "linkedClusterArns": [ "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4", "arn:aws:dsql:us-east-2:111122223333:cluster/bar0foo1baz2quux3quuux4" ] }

多區域叢集上的 GetCluster

若要取得多區域叢集的相關資訊,請使用 get-cluster命令。對於多區域叢集,回應將包含連結ARNs。

範例命令

aws dsql get-cluster \ --region us-east-1 \ --identifier your_cluster_id

回應範例

{ "identifier": "aaabtjp7shql6wz7w5xqzpxtem", "arn": "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4", "status": "ACTIVE", "creationTime": "2024-07-17T10:24:23.325000-07:00", "deletionProtectionEnabled": true, "witnessRegion": "us-west-2", "linkedClusterArns": [ "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4", "arn:aws:dsql:us-east-2:111122223333:cluster/bar0foo1baz2quux3quuux4" ] }

DeleteMultiRegionClusters

若要刪除多區域叢集,請從任何連結的叢集區域使用 delete-multi-region-clusters操作。

請注意,您無法僅刪除連結叢集對的一個區域。

範例 AWS CLI 命令

aws dsql delete-multi-region-clusters \ --region us-east-1 --linked-cluster-arns "arn:aws:dsql:us-east-2:111122223333:cluster/bar0foo1baz2quux3quuux4" "arn:aws:dsql:us-east-1:111122223333:cluster/foo0bar1baz2quux3quuux4"

如果此 API 操作成功,兩個叢集都會進入 DELETING 狀態。若要判斷叢集的確切狀態,請在其對應區域中的每個連結叢集上使用 get-cluster API 操作。

回應範例

{ }