{Alibaba PolarDB} Getting Started

 

https://www.alibabacloud.com/help/ja/polardb/getting-started

https://qiita.com/dennis_wang/items/b353b74def6d458389c0

https://www.alibabacloud.com/ja/product/polardb?_p_lc=1


polar.mysql.g2.medium
ノード数=2
0.250ドル/h

 


-- 1. クラスタ作成

aliyun polardb CreateDBCluster \
--DBNodeClass polar.mysql.g2.medium \
--DBType MySQL \
--DBVersion 8.0 \
--PayType Postpaid \
--BackupRetentionPolicyOnClusterDeletion NONE \
--ClusterNetworkType VPC \
--CreationCategory Normal \
--CreationOption Normal \
--DBClusterDescription cluster01 \
--DBMinorVersion 8.0.1 \
--DBNodeNum 2 \
--DefaultTimeZone +9:00 \
--LowerCaseTableNames 1 \
--SecurityIPList "10.1.0.0/16,127.0.0.1/32,192.0.2.1/32" \
--StorageType PSL4 \
--VPCId vpc-111111111111111111111 \
--VSwitchId vsw-111111111111111111111 \
--ZoneId ap-northeast-1a 


aliyun polardb DescribeDBClusters 

aliyun polardb DescribeDBClusterAccessWhitelist \
--DBClusterId pc-11111111111111111 

 


-- 2. 公開用エンドポイント追加

 

aliyun polardb DescribeDBClusterEndpoints \
--DBClusterId pc-11111111111111111 


aliyun polardb CreateDBEndpointAddress \
--DBClusterId pc-11111111111111111 \
--DBEndpointId pe-11111111111111111 \
--NetType Public \
--ConnectionStringPrefix ep123 

 


-- 3. データベースアカウント作成

aliyun polardb CreateAccount \
--DBClusterId pc-11111111111111111 \
--AccountName user01 \
--AccountPassword 'password' \
--AccountDescription user01 \
--AccountType Super 

 


aliyun polardb DescribeAccounts \
--DBClusterId pc-11111111111111111 

 


-- 4. 接続確認

mysql -h ep123.mysql.polardb.japan.rds.aliyuncs.com -u user01 -p

 


-- 5. クリーンアップ


aliyun polardb DescribeAccounts \
--DBClusterId pc-11111111111111111 

aliyun polardb DeleteAccount \
--DBClusterId pc-11111111111111111 \
--AccountName user01 

 


aliyun polardb DescribeDBClusterEndpoints \
--DBClusterId pc-11111111111111111 


aliyun polardb DeleteDBEndpointAddress \
--DBClusterId pc-11111111111111111 \
--DBEndpointId pe-11111111111111111 \
--NetType Public 

 


aliyun polardb DescribeDBClusters 

aliyun polardb DeleteDBCluster \
--DBClusterId pc-11111111111111111 \
--BackupRetentionPolicyOnClusterDeletion NONE