準備
$ sysbench /usr/local/share/sysbench/oltp_read_write.lua \
--db-driver=mysql \
--table-size=10000000 \
--mysql-host=aurora-mysql-57.cluster-********.ap-northeast-1.rds.amazonaws.com \
--mysql-user=awsuser \
--mysql-password=******** \
--mysql-db=db1 \
--db-ps-mode=disable \
prepare
$ mysql -h aurora-mysql-57.cluster-********.ap-northeast-1.rds.amazonaws.com -u awsuser -p
mysql> select count(1) from sbtest1;
+
| count(1) |
+
| 10000000 |
+
1 row in set (2.30 sec)
mysql> use db1;
mysql> create table sbtest100m (select a.* from sbtest1 a, sbtest1 b limit 100000000);
mysql> SELECT * FROM sbtest100m INTO OUTFILE S3 's3-ap-northeast-1://aws-foo-files/sbtest100m'
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
MANIFEST ON
OVERWRITE OFF;
Query OK, 100000000 rows affected (8 min 48.38 sec)
mysql> LOAD DATA FROM S3 MANIFEST 's3-ap-northeast-1://aws-foo-files/sbtest100m.manifest'
INTO TABLE sbtest100m_s3_load
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n' (id, k, c, pad);
Query OK, 100000000 rows affected (19 min 8.03 sec)
Records: 100000000 Deleted: 0 Skipped: 0 Warnings: 0
環境
- 5.7.mysql_aurora.2.07.2
- r5.8xlarge
補足
Cannot instantiate S3 Client エラー
ERROR 63994 (HY000): S3 API returned error: Missing Credentials: Cannot instantiate S3 Client
- Aurora クラスターに IAM ロールをアタッチしているか確認する。IAMロールにはIAMポリシー"AmazonS3FullAccess"をアタッチし、rds.amazonaws.com に信頼関係設定を行う。
- S3 バケットへのアクセス権がない。バケットポリシーやACLを確認してもよくわからない場合は、S3 バケットを作成してみて出力先を変えると切り分けしやすい。
ERROR 63994 (HY000): S3 API returned error: Access Denied:Access Denied