Creates a storage location where Vertica can store data. After you create the location, you create storage policies that assign the storage location to the database objects that will store data in the location.
Caution: While no technical issue prevents you from using
CREATE LOCATION to add one or more Network File System (NFS) storage locations, Vertica does not support NFS data or catalog storage except for MapR mount points. You will be unable to run queries against any other NFS data. When creating locations on MapR file systems, you must specify
ALL NODES SHARED.
If you use any HDFS storage locations, the HDFS data must be available at the time you start Vertica. Your HDFS cluster must be operational, and the ROS files must be present. If you have moved data files, or if they have become corrupted, or if your HDFS cluster is not responsive, Vertica cannot start.
CREATE LOCATION 'path' [NODE 'nodename' | ALL NODES] [SHARED] [USAGE 'usetype'] [LABEL 'labelname'] [LIMIT 'MaxSize']
Where Vertica will store this location's data. The type of filesystem on which the location is based determines the format of this argument:
The node or nodes on which the storage location is defined.
Indicates the location set by the path is shared (used by all of the nodes) rather than local to each node. See below for details.
The type of data the storage location can hold, where use‑type is one of the following:
A label for the storage location. You use this name later when assigning the storage location to data objects.
Maximum size for the storage location. You use this name later when assigning the storage location to data objects.
If set to 1, there is no limit on the storage location size.
The Vertica process must also have read and write permissions to the location where date will be stored. Each type of filesystem has its own requirements:
- Linux: The database superuser account (usually named dbadmin) must have full read and write access to the directory in the path argument.
- HDFS without Kerberos: Requires a Hadoop user whose username matches the Vertica database administrator username (usually dbadmin). This Hadoop user must have read and write access to the HDFS directory specified in the path argument.
- HDFS with Kerberos: Requires a Hadoop user whose username matches the principal in the keytab file on each Vertica node. This is not the same as the database administrator username. This Hadoop user must have read and write access to the HDFS directory stored in the path argument.
Shared Versus Local Storage
The SHARED keyword indicates that the location set by the path argument is shared by all nodes. Most remote filesystems (such as HDFS) are shared. For these filesystems, the path argument represents a single location where all of the nodes store data. Each node creates its own subdirectory to hold its own files in a shared storage location. These subdirectories prevent the nodes from overwriting each other's files. Even if your cluster has only one node, you must include the SHARED keyword if you are using a remote filesystem. If the location is declared as USER Vertica does not create sub directories for each node. The setting of USER takes precedence over SHARED.
If you do not supply this keyword, the new storage location is local. The path argument specifies a location that is unique for each node in the cluster. This location is usually a path in the node's own filesystem. Storage locations contained in filesystems that are local to each node (such as the Linux filesystem) are always local.
To specify a path for a location on HDFS, use URLs in the
hdfs scheme. In most cases you can use
hdfs:/// (three slashes) followed by the HDFS path. To use HDFS URLs you must give Vertica access to some HDFS configuration files. For more information, see Using HDFS URLs and Configuring the hdfs Scheme.
- Vertica node. This is not the same as the database administrator username. This Hadoop user must have read and write access to the HDFS directory stored in the path argument.
The following example shows how to create a storage location in the local Linux filesystem for temporary data storage.
=> CREATE LOCATION '/home/dbadmin/testloc' USAGE 'TEMP' LABEL 'tempfiles';
The following example shows how to create a storage location on HDFS in the
/user/dbadmin directory. The HDFS cluster does not use Kerberos.
=> CREATE LOCATION 'hdfs:///user/dbadmin' ALL NODES SHARED USAGE 'data' LABEL 'coldstorage';
The following example shows how to create the same storage location, but on a Hadoop cluster that uses Kerberos. Note the output that reports the principal being used.
=> CREATE LOCATION 'hdfs:///user/dbadmin' ALL NODES SHARED USAGE 'data' LABEL 'coldstorage'; NOTICE 0: Performing HDFS operations using kerberos principal [vertica/hadoop.example.com] CREATE LOCATION
The following example shows how to create a location for user data, grant access to it, and use it to create an external table.
=> CREATE LOCATION '/tmp' ALL NODES USAGE 'user'; CREATE LOCATION => GRANT ALL ON LOCATION '/tmp' to Bob; GRANT PRIVILEGE => CREATE EXTERNAL TABLE ext1 (x integer) AS COPY FROM '/tmp/data/ext1.dat' DELIMITER ','; CREATE TABLE
For an example of a USER storage location using S3, see Browsing S3 Data Using External Tables in Using Eon Mode.
- Managing Storage Locations in the Administrator's Guide
- Vertica Storage Location for HDFS in Integrating with Apache Hadoop.