Greenplum管理表空间Tablespace
Greenplum管理表空间Tablespacecreate tablespace gtlions_ts1 [owner gtlions] filespace gtlionsfilespace;alter tablespace gtlions_ts1 rename to gtlions_ts2;alter tablespace gtlions_ts1 owner to gtlions;表空间是基于文件空间filespace的,实际上指定的是一个文件目录,gp并不关心底层数据是如何分布的,因此你只要指定一个文件目录即可,然后gp使用这个目录来创建表空间,一个filespace可以创建多个表空间,因此并没有必要在一个逻辑磁盘位置上创建多个filespace,你也无法控制数据文件在逻辑文件系统上的具体分布。。出于性能的考虑,可能会创建多个表空间,让表空间落到不同类型的磁盘上(如果有的话)以获得性能的差异化;否则就没有必要创建和使用多个表空间。创建filespace使用gpfilespace工具创建,必须是superuser权限才能执行该操作。[gpadmin@o564gtser1 ~]$ ll /data1/;ll /data1 -d总计 0drwxr-xr-x 2 gpadmin gpadmin 4096 04-18 16:29 /data1[gpadmin@o564gtser1 ~]$ gpfilespace -o .20130418:16:30:51:007324 gpfilespace:o564gtser1:gpadmin-[INFO]:-A tablespace requires a file system location to store its databasefiles. A filespace is a collection of file system locations for all componentsin a Greenplum system (primary segment, mirror segment and master instances).Once a filespace is created, it can be used by one or more tablespaces.20130418:16:30:51:007324 gpfilespace:o564gtser1:gpadmin-[INFO]:-getting configEnter a name for this filespace> gtlionsfilespaceChecking your configuration:Your system has 1 hosts with 2 primary and 0 mirror segments per host.Configuring hosts: [o564gtser1]Please specify 2 locations for the primary segments, one per line:primary location 1> /data1primary location 2> /data1Enter a file system location for the mastermaster location> /data120130418:16:31:17:007324 gpfilespace:o564gtser1:gpadmin-[INFO]:-Creating configuration file...20130418:16:31:17:007324 gpfilespace:o564gtser1:gpadmin-[INFO]:-[created]20130418:16:31:17:007324 gpfilespace:o564gtser1:gpadmin-[INFO]:-To add this filespace to the database please run the command:gpfilespace --config ./gpfilespace_config_20130418_163051[gpadmin@o564gtser1 ~]$ cat ./gpfilespace_config_20130418_163051filespace:gtlionsfilespaceo564gtser1:1:/data1/gtgpseg-1o564gtser1:2:/data1/gtgpseg0o564gtser1:3:/data1/gtgpseg1[gpadmin@o564gtser1 ~]$ gpfilespace --config ./gpfilespace_config_20130418_16305120130418:16:31:49:007492 gpfilespace:o564gtser1:gpadmin-[INFO]:-A tablespace requires a file system location to store its databasefiles. A filespace is a collection of file system locations for all componentsin a Greenplum system (primary segment, mirror segment and master instances).Once a filespace is created, it can be used by one or more tablespaces.20130418:16:31:49:007492 gpfilespace:o564gtser1:gpadmin-[INFO]:-getting configReading Configuration file: './gpfilespace_config_20130418_163051'20130418:16:31:49:007492 gpfilespace:o564gtser1:gpadmin-[INFO]:-Performing validation on paths..............................................................................20130418:16:31:49:007492 gpfilespace:o564gtser1:gpadmin-[INFO]:-Connecting to database20130418:16:31:50:007492 gpfilespace:o564gtser1:gpadmin-[INFO]:-Filespace "gtlionsfilespace" successfully created在新的文件空间创建表空间gtlions=# create tablespace gtlions_ts filespace gtlionsfilespace;CREATE TABLESPACE迁移系统默认的表空间至新创建的文件空间,必须将gp用维护模式启动,迁移完成后重启数据库,默认的文件空间目录建议不要删除:[gpadmin@o564gtser1 ~]$ gpstop -a20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Starting gpstop with args: -a20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Gathering information and validating the environment...20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Obtaining Segment details from master...20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.2.4.0 build 1'20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-There are 0 connections to the database20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='smart'20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Master host=o564gtser120130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=smart20130418:16:34:28:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Master segment instance directory=/data/master/gtgpseg-120130418:16:34:29:007658 gpstop:o564gtser1:gpadmin-[INFO]:-No standby master host configured20130418:16:34:29:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Commencing parallel segment instance shutdown, please wait......20130418:16:34:32:007658 gpstop:o564gtser1:gpadmin-[INFO]:-----------------------------------------------------20130418:16:34:32:007658 gpstop:o564gtser1:gpadmin-[INFO]:- Segments stopped successfully = 220130418:16:34:32:007658 gpstop:o564gtser1:gpadmin-[INFO]:- Segments with errors during stop = 020130418:16:34:32:007658 gpstop:o564gtser1:gpadmin-[INFO]:-----------------------------------------------------20130418:16:34:32:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Successfully shutdown 2 of 2 segment instances20130418:16:34:32:007658 gpstop:o564gtser1:gpadmin-[INFO]:-Database successfully shutdown with no errors reportedgpadmin@o564gtser1 ~]$ gpstart -R20130418:16:35:52:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Starting gpstart with args: -R20130418:16:35:52:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Gathering information and validating the environment...20130418:16:35:52:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.2.4.0 build 1'20130418:16:35:52:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Greenplum Catalog Version: '201109210'20130418:16:35:52:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Starting Master instance in admin mode20130418:16:35:53:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20130418:16:35:53:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Obtaining Segment details from master...20130418:16:35:53:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Setting new master era20130418:16:35:53:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Master Started...20130418:16:35:53:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Shutting down master20130418:16:35:55:007724 gpstart:o564gtser1:gpadmin-[INFO]:---------------------------20130418:16:35:55:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Master instance parameters20130418:16:35:55:007724 gpstart:o564gtser1:gpadmin-[INFO]:---------------------------20130418:16:35:55:007724 gpstart:o564gtser1:gpadmin-[INFO]:-Database &nbs上一个:管理数据库Database
下一个:Greenplum管理模式