Skip to content

Instantly share code, notes, and snippets.

create table gift(
id int auto_increment,
name varchar(255),
description text,
created_at datetime not null,
primary key(id)
)engine=InnoDB;
#!/bin/sh
i=0
while ((1))
do
name=$(uuidgen | tr -d '-')
desc=$(mkpasswd -l 1000)
mysql -u xxxxxxx cloudpack -pxxxxxxxxxxxxx -e "INSERT INTO gift(name, description,created_at) VALUES('${name}', '${desc}', NOW());"
echo "."
sleep 1
@memorycraft
memorycraft / gist:1231845
Created September 21, 2011 11:35
データノードの設定
GRANT ALL PRIVILEGES ON *.* TO 'xxxxxxxxxxxxxx'@localhost IDENTIFIED BY 'xxxxxxxxxxxxxx';
GRANT ALL PRIVILEGES ON *.* TO 'xxxxxxxxxxxxxx'@'%' IDENTIFIED BY 'xxxxxxxxxxxxxx';
use cloudpack;
create table gift(
id int auto_increment,
name varchar(255),
description text,
created_at datetime not null,
@memorycraft
memorycraft / gist:1231855
Created September 21, 2011 11:43
Spiderテーブルとダミー、VPテーブルの設定
create table gift_new(
id int auto_increment,
name varchar(255),
description text,
created_at datetime not null,
primary key(id)
) engine = Spider DEFAULT CHARSET=utf8
CONNECTION ' table "gift", user "xxxxxxxxxxxxx", password "xxxxxxxxxxxxx" '
PARTITION BY LIST(MOD(id, 2)) (
PARTITION hostb VALUES IN (0) comment 'host "111.111.111.111", port "3306"',
@memorycraft
memorycraft / gist:1231864
Created September 21, 2011 11:55
リネーム1
mysql> rename table
gift_dummy to gift_delete,
gift to gift_dummy,
gift_vp to gift;
Query OK, 0 rows affected (0.03 sec)
@memorycraft
memorycraft / gist:1231872
Created September 21, 2011 12:02
vp_copy_tables
select vp_copy_tables('gift', 'gift_dummy', 'gift_new');
@memorycraft
memorycraft / gist:1231888
Created September 21, 2011 12:11
リネーム2
mysql> rename table
gift to gift_vp,
gift_new to gift;
Query OK, 0 rows affected (0.01 sec)
@memorycraft
memorycraft / gist:1231906
Created September 21, 2011 12:28
テーブルの削除
drop table
gift_dummy,
gift_vp,
gift_delete;
@memorycraft
memorycraft / gist:1231931
Created September 21, 2011 12:40
リネーム1
mysql> rename table
gift_dummy to gift_delete,
gift to gift_dummy,
gift_vp to gift;
Query OK, 0 rows affected (0.03 sec)
@memorycraft
memorycraft / gist:1232534
Created September 21, 2011 16:25
移行チェックA
mysql> select * from gift order by id;
+------+----------------------------------+----------------------------------+---------------------+
| id | name | description | created_at |
+------+----------------------------------+----------------------------------+---------------------+
| 1 | d84c7d13d56e48999f6e42396bb0d6b8 | 57b6f87681df4141953b63cd6ee74... | 2011-09-21 22:35:23 |
| 2 | fc52fbdee1904e40a92711bc3ff5b53b | 4fe1116428e142369ab419d603a8b... | 2011-09-21 22:35:23 |
| 3 | 936917c0e7b246b380573654c80863e1 | 08cf01342f1149b5a7fa15f2df5b6... | 2011-09-21 22:35:24 |
| 4 | 5d630544409e4ef98ece5b489cd5aff5 | c3c1848832d04b69bc9f9c1bd7249... | 2011-09-21 22:35:23 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 5429 | 0462eaf7646b4855a993a49128ba3f4d | 0d07cdbac3c14723b25bc1a1bc74a... | 2011-09-22 01:07:42 |