This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> GRANT ALL PRIVILEGES ON *.* TO 'xxxxxxxxxxxxxx'@localhost IDENTIFIED BY 'xxxxxxxxxxxxxx';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'xxxxxxxxxxxxxx'@'%' IDENTIFIED BY 'xxxxxxxxxxxxxx';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'xxxxxxxxxxxxxx'@'123.123.123.123' IDENTIFIED BY 'xxxxxxxxxxxxxx';
Query OK, 0 rows affected (0.00 sec)
mysql> use cloudpack;
Database changed
mysql> create table gift(
id int auto_increment,
name varchar(255),
description text,
created_at datetime not null,
primary key(id)
)engine=InnoDB;
Query OK, 0 rows affected (0.00 sec)
SpiderノードのSpider、ダミー、VPテーブルの設定
mysql> 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"',
PARTITION hostc VALUES IN (1) comment 'host "222.222.222.222", port "3306"'
);
Query OK, 0 rows affected (0.02 sec)
mysql> create table gift_dummy like gift;
Query OK, 0 rows affected (0.01 sec)
mysql> create table gift_vp(
id int auto_increment,
name varchar(255),
description text,
created_at datetime not null,
primary key(id)
)engine=vp
comment 'table_name_list "gift_dummy gift_new", cit "2", cil "2", ctm "1", ist "1", zru "1"';
Query OK, 0 rows affected (0.03 sec)
この時点では、以下のイメージのような構成になっています。
テーブルのリネーム
ここも前回同様テーブルのリネームを行い、接続先をVPテーブルに向けます。
mysql> rename table
gift_dummy to gift_delete,
gift to gift_dummy,
gift_vp to gift;
Query OK, 0 rows affected (0.03 sec)