パラメータ(gflag)の確認
- YBAにてUniverseを指定 >
Action
> Edit GFlag
でパラメータの確認
enable_automatic_tablet_splitting
1. --ysql_num_shards_per_tserver
が-1
の場合
- auto splitが有効であれば、デフォルトは1で、その後low, high, final phaseに基づいたtabletを自動的に作成
- 4CPU以下のサーバで構成されたクラスタでは、クラスタのノード数に関係せずに、2core以下であれば1 tablet, 4core以下であれば2tabletが作成される
2. --ysql_num_shards_per_tserver
が-1
ではない場合
- auto splitが有効であれば、
--ysql_num_shards_per_tserver
で指定した数を割り当てた後、low, high, final phaseに基づいてtabletが自動的に(追加)作成される
テーブルの作成
- ハッシュシャーディングとレンジシャーディングでの違いを見てみましょう
ハッシュシャーディング
create table t1 ( id int, name text, primary key(id));
レンジシャーディング
create table t2 ( id int, name text, primary key(id ASC));
データの投入
insert into t1 (id, name) select i, left(md5(random()::text),4) from generate_series(1,20000000) i;
insert into t2 (id, name) select i, left(md5(random()::text),4) from generate_series(1,20000000) i;
データの確認
- Tableの確認(Table IDの確認)
http://<tablet_server_ip>:7000/tables
- Tableの詳細
http://<tablet_server_ip>:7000/table?id=<TABLEID>
- Tablet数の確認 (Table IDで検索)
http://<tablet_server_ip>:9000/tablets
さらに追加
insert into t1 (id, name) select i, left(md5(random()::text),4) from generate_series(20000001,40000000) i;
insert into t2 (id, name) select i, left(md5(random()::text),4) from generate_series(20000001,40000000) i;