例のメモ
AWS
サンプルAMI
amzn-ami-hvm-2015.09.1.x86_64-gp2
EC2のuser
ec2-user@
epel有効化例
yum search sysbench --enablerepo=epel
ポートあいてなかったら開ける
http://ameblo.jp/aic0o/entry-10909796568.html
dstat
yum install dstat
yum install htop
オプションいろいろ
http://qiita.com/harukasan/items/b18e484662943d834901
http://d.hatena.ne.jp/january/20120116/1326666189
sysbench
yum install sysbench --enablerepo=epel// データロード
sysbench --test=oltp --mysql-user=test_user --mysql-host=xxxx --mysql-password=xxx --db-driver=mysql prepare// 実行
sysbench --test=oltp --mysql-user=test_user --mysql-host=xxxx --mysql-password=xxx --db-driver=mysql run
参考
http://blog.amedama.jp/entry/2015/08/25/222444
http://d.hatena.ne.jp/hiroi10/20130531/1370030836
mysql 環境構築
yum install mysql56-server
/etc/init.d/mysql start
// mysql内で実行
GRANT ALL ON *.* TO 'test_user'@'%' IDENTIFIED BY 'abc';
FLUSH PRIVILEGES;
create database sbtest
mysqlチューニング
とりあえずみてみよう
show variables like 'innodb_buffer_pool_size';
- innodb_flush_log_at_trx_commit
参考
my.cnfの基本となるもの
https://github.com/kamipo/etcfiles/blob/master/etc/my.cnf
tsv読み込み
ファイルをutf8でLFにしておく.file ~/Downloads/hoge.txt
// utf-8かつ、lfに変更
nkf -wLu --overwrite ~/Downloads/hoge.txt
file ~/Downloads/hoge.txt// テーブルつくっておく。例
CREATE TABLE `xxx` (
`j_cd` bigint(20) unsigned NOT NULL DEFAULT '0',
`t_cd` bigint(20) unsigned NOT NULL DEFAULT '0',
`s_cd` bigint(20) unsigned NOT NULL DEFAULT '0',
`c_cd` bigint(20) unsigned NOT NULL DEFAULT '0',
`yubin` varchar(128) NOT NULL,
`jigyosho` tinyint(3) unsigned NOT NULL,
`haishi` tinyint(3) unsigned NOT NULL,
`to` text,
`to_kana` text,
`shi` text,
`shi_kana` text,
`cho` text,
`cho_kana` text,
`o_1` text,
`o_2` text,
`o_3` text,
`o_4` text,
`o_5` text,
`o_6` text,
`o_7` text,
`o_8` text,
`o_9` text,
PRIMARY KEY (`j_cd`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
;
// import文
mysql -uroot -e "SET character_set_database=utf8;LOAD DATA LOCAL INFILE '/tmp/hoge.txt' INTO TABLE shase.aomori FIELDS TERMINATED BY '\t';"
参考
http://phpjavascriptroom.com/?t=mysql&p=mysqlimport
http://jusyo.jp/tsv/new.php