您的位置:首页 > 数据库 > Redis

转载:Postgres-XC: Waiting for online data redistribution

2013-07-28 14:29 330 查看

转载:http://francs3.blog.163.com/blog/static/405767272012654433589/

Postgres-XC: Waiting for online data redistribution 

 Postgresql-XC 开发组正在计划开发 "online data redistribution" 功能,即可以实现

PostgreSQL-XC 数据节点的数据重分布,也可以更改表的 DISTRIBUTE 类型,例如,replicated

模式改成 hash 模式。这是个非常有效的功能,例如,在增加了数据节点后,为了提高性能,可

能需要将表的数据重新分布到所有数据节点,也可能由于某种原因,需要更改表的 DISTRIBUTE

类型,这个模块还在设计阶段。

--1 PostgreSQL-XC 数据重分布初步设想
1.fetch all the data of the table to be redistributed on Coordinator

2.Truncate the table

3.Update the catalogs to the new distribution type

4.Redistribute the data cached on Coordinator

 

--2 PostgreSQL-XC 数据重分布预计的优化项
1 Save materialization if it is not necessary (new distribution set to round robin, replication)

2 Truncate the table on a portion of nodes if a replicated table has its subset of nodes reduced

3 COPY only necessary data for a replicated table to new nodes if its subset of nodes is increased

4 And a couple of other things

  备注:在步骤 1 的初步设想成功实现后, PostgreSQL-XC 项目组计划优化上面列举出来的事项。

 

--3  数据重分布命令

 ALTER TABLE

DISTRIBUTE BY { REPLICATION | ROUND ROBIN | { [HASH | MODULO ] ( column_name ) } }

TO { GROUP groupname | NODE ( nodename [, ... ] ) }

ADD NODE ( nodename [, ... ] )

DELETE NODE ( nodename [, ... ] )
   
  备注:只要执行一条 “ALTER TABLE 。。。” SQL ,数据节点的数据就会自动的实现重分布,可以实现将某张表

            现有数据重新布到新的数据节点;也可以删除某个数据节点的数据,还可以更改表的 DISTRIBUTE 类型,并

            根据新的 DISTRIBUTE  类型重新分布表数据,功能比较强大。

 

--4 参考
 http://michael.otacoo.com/postgresql-2/postgres-xc-online-data-redistribution/

 

  备注:对 PostgreSQL -XC 有兴趣的朋友,可以参考 Michael Paquier 上面的 BLOG。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: