Creates a filespace using a configuration file that defines a file system location. Filespaces describe the physical file system resources to be used by a tablespace.
hawq filespace [-c | --config fs_config_file ] hawq filespace [-o | --output output_directory_name ] hawq filespace [--movefilespace FILESPACE] hawq filespace [--location dfslocation] hawq filespace [-l | --logdir logfile_directory] hawq filespace [-h | --host hostname] hawq filespace [-p | --port PORT] hawq filespace [-U | --username NAME ] hawq filespace [-W | --password] hawq filespace -v | --version hawq filespace -? | --help
A tablespace requires a file system location to store its database files. This file system location for all components in a HAWQ system is referred to as a filespace. Once a filespace is defined, it can be used by one or more tablespaces.
--movefilespace option allows you to relocate a filespace and its components within a dfs file system.
When used with the
-o option, the
hawq filespace utility looks up your system configuration information in the system catalog tables and prompts you for the appropriate file system location needed to create the filespace. It then outputs a configuration file that can be used to create a filespace. If a file name is not specified, a
hawqfilespace_config_# file will be created in the current directory by default.
Once you have a configuration file, you can run
hawq filespace with the
-c option to create the filespace in HAWQ system.
Note: If segments are down due to a power or nic failure, you may see inconsistencies during filespace creation. You may not be able to bring up the cluster.
-c | –config fs_config_file
A configuration file containing:
An initial line denoting the new filespace name. For example:
-o | –output output_directory_name
The directory location and file name to output the generated filespace configuration file. You will be prompted to enter a name for the filespace and file system location. The file system locations must exist on all hosts in your system prior to running the
hawq filespace command. You will specify the number of replicas to create. The default is 3 replicas. After the utility creates the configuration file, you can manually edit the file to make any required changes to the filespace layout before creating the filespace in HAWQ.
Create the filespace in a new location on a distributed file system. Updates the dfs url in the HAWQ database, so that data in the original location can be moved or deleted. Data in the original location is not affected by this command.
Specifies the new URL location to which a dfs file system should be moved.
-l | –logdir logfile_directory
The directory to write the log file. Defaults to
-v | –version (show utility version)
Displays the version of this utility.
-? | –help (help)
Displays the command usage and syntax.
-h | –host hostname
The host name of the machine on which the HAWQ master database server is running. If not specified, reads from the environment variable
PGHOST or defaults to localhost.
-p | –port port
The TCP port on which the HAWQ master database server is listening for connections. If not specified, reads from the environment variable
PGPORT or defaults to 5432.
-U | –username superuser_name
The database superuser role name to connect as. If not specified, reads from the environment variable
PGUSER or defaults to the current system user name. Only database superusers are allowed to create filespaces.
-W | –password
Force a password prompt.
Create a filespace configuration file. Depending on your system setup, you may need to specify the host and port. You will be prompted to enter a name for the filespace and a replica number. You will then be asked for the DFS location. The file system locations must exist on all hosts in your system prior to running the
hawq filespace command:
$ hawq filespace -o . Enter a name for this filespace > fastdisk Enter replica num for filespace. If 0, default replica num is used (default=3) 0 Please specify the DFS location for the filespace (for example: localhost:9000/fs) location> localhost:9000/hawqfs 20160203:11:35:42:272716 hawqfilespace:localhost:gpadmin-[INFO]:-[created] 20160203:11:35:42:272716 hawqfilespace:localhost:gpadmin-[INFO]:- To add this filespace to the database please run the command: hawqfilespace --config ./hawqfilespace_config_20160203_112711 Checking your configuration: Your system has 1 hosts with 2 primary segments per host. Configuring hosts: [sdw1, sdw2] Enter a file system location for the master: master location> /hawq_master_filespc
Example filespace configuration file:
filespace:fastdisk mdw:1:/hawq_master_filespc/gp-1 sdw1:2:/hawq_pri_filespc/gp0 sdw2:3:/hawq_pri_filespc/gp1
Execute the configuration file to create the filespace:
$ hawq filespace --config hawq_filespace_config_1
Create the filespace at
cdbfast_fs_a and move an hdfs filesystem to it:
$ hawq filespace --movefilespace=cdbfast_fs_a --location=hdfs://gphd-cluster/cdbfast_fs_a/