diff --git a/docs/guide/03-basic-use.md b/docs/guide/03-basic-use.md index 43f5f01..a3a032c 100644 --- a/docs/guide/03-basic-use.md +++ b/docs/guide/03-basic-use.md @@ -69,80 +69,7 @@ postgres=# - partions(xx)初始化时建立分区子表个数。 - 增加分区子表的方法ALTER TABLE public.t1_pt ADD PARTITIONS 2; -### 1.3、创建shard冷热分区表 -![OpenTenBase_shard冷热分区表](images/1.3shard_cold_hot.jpg) -![OpenTenBase_shard冷热分区表续](images/1.3shard_cold_hot_2.jpg) - -``` -[opentenbase@VM_0_37_centos shell]$ psql -h 172.16.0.42 -p 11387 -d postgres -U opentenbase -psql (PostgreSQL 10.0 opentenbase V2) -Type "help" for help. - -postgres=# create table public.t1_cold_hot -( -f1 int not null, -f2 timestamp not null, -f3 varchar(20), -primary key(f1) -) -partition by range (f2) -begin (timestamp without time zone '2017-01-01 0:0:0') -step (interval '12 month') partitions (4) -distribute by shard(f1,f2) -to group default_group cold_group; -CREATE TABLE -postgres=# \d+ public.t1_cold_hot - Table "public.t1_cold_hot" - Column | Type | Collation | Nullable | Default | Storage | Stats target | Description ---------+-----------------------------+-----------+----------+---------+----------+--------------+------------- - f1 | integer | | not null | | plain | | - f2 | timestamp without time zone | | not null | | plain | | - f3 | character varying(20) | | | | extended | | -Indexes: - "t1_cold_hot_pkey" PRIMARY KEY, btree (f1) -Distribute By SHARD(f1,f2) - Hotnodes:dn001 Coldnodes:dn002 -Partition By: RANGE(f2) - # Of Partitions: 4 - Start With: 2017-01-01 - Interval Of Partition: 12 MONTH - -postgres=# - -``` - -说明: - -- Distribute By SHARD(f1,f2),冷热分区表需要指定两个字段来做路由,分别是分布键和分区键。 -- to group default_group cold_group,需要指定两个存储组,第一个是热数据存储组,第二个是冷存储组。 - -创建时间范围冷热分区表需要有两个group,冷数据的cold_group对应的节点需要标识为冷节点,如下所示 - -``` - -[opentenbase@VM_0_37_centos shell]$ psql -h 172.16.0.42 -p 11000 -d postgres -U opentenbase -psql (PostgreSQL 10.0 opentenbase V2) -Type "help" for help. - -postgres=# select pg_set_node_cold_access(); - pg_set_node_cold_access -------------------------- - success -(1 row) - -``` - -冷热分区表需要在postgresql.conf中配置冷热分区时间参数和分区级别,如下所示 - -``` - -cold_hot_sepration_mode = 'year' -enable_cold_seperation = true -manual_hot_date = '2019-01-01' - -``` - -### 1.4、创建复制表 +### 1.3、创建复制表 ![OpenTenBase_shard冷热分区表](images/1.4repilication.jpg) ```