Files and unstructured data
Much of what AI and analytics teams work with never becomes a table: documents, images, audio, model checkpoints, raw extracts waiting to be loaded. A fileset catalog brings those files into the same catalog as your tables. Each fileset gives a directory in Amazon S3, Google Cloud Storage, Azure Data Lake Storage, Alibaba Cloud OSS or HDFS a name in Gravitino, and with the name come grants, tags, policies, an owner and audit. Code reads and writes the files by that name through GVFS and gets short-lived storage credentials from Gravitino, so it never holds a bucket path or a cloud key.
Common uses:
- Source files for AI. Documents, images or audio that an embedding job turns into vectors in a Lance table, as in the diagram. The files and the vectors are governed in one place, by the same grants.
- Landing zones. Raw extracts and logs that arrive before they are loaded into tables, with a name and an owner from the moment they land.
- Training data and model files. Datasets and checkpoints shared across teams without handing out bucket paths or keys. Models themselves are registered in an ML model catalog.
- Moving storage. Code uses the fileset's name, so moving the files to another bucket or cloud changes the fileset rather than every job that reads it.
Gravitino manages a fileset catalog itself rather than connecting an external system, so creating one needs no provider. Creating and managing filesets is covered in Filesets, and reading and writing the files in GVFS.
Quick start
The example creates the fileset catalog files with its base location in S3, then the schema raw.
Creating the schema creates its directory under the catalog's location, so it is the first step that
tests the storage settings. Creating filesets in the schema is covered in
Filesets.
- UI
- REST
-
Start the catalog. Open Connect → Catalogs, click + Catalog, enter
filesas the Catalog name, and choose Fileset as the Catalog type. -
Enter the storage. Under Connection, choose S3 as the Storage and enter
s3a://{bucket}/filesas the Location. Enterhttps://s3.{region}.amazonaws.comas the S3 endpoint, and{access_key_id}and{secret_access_key}as the Access key ID and AWS secret key; the form requires all three for S3. AWS region and Path-style access are optional. -
Test and create it. Click Test connection, then Create catalog.
-
Create the schema. In Explore, open
files, click + Schema, and createraw.
-
Create the catalog. A fileset catalog needs no provider.
Create an S3 fileset catalogcurl -sS -X POST "https://{gravitino_host}/api/metalakes/{metalake}/catalogs" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "files",
"type": "FILESET",
"comment": "Landing zone files",
"properties": {
"location": "s3a://{bucket}/files",
"s3-endpoint": "https://s3.{region}.amazonaws.com",
"s3-access-key-id": "{access_key_id}",
"s3-secret-access-key": "{secret_access_key}"
}
}' -
Create the schema. Its directory is
s3a://{bucket}/files/raw.Create a schemacurl -sS -X POST "https://{gravitino_host}/api/metalakes/{metalake}/catalogs/files/schemas" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name": "raw"}'
Catalog properties
These apply in addition to the common catalog properties.
| Property Name | Description | Default Value |
|---|---|---|
location | Base storage location, named unknown. Always a directory or path prefix, never a single file | (none) |
location- | Prefix for named locations, as location-{name}={path} | (none) |
credential-providers | Credential provider types, separated by commas | (none) |
config.resources | Configuration files to load, separated by commas, such as hdfs-site.xml,core-site.xml | (none) |
filesystem-conn-timeout-secs | Timeout when obtaining a filesystem client, in seconds | 6 |
disable-filesystem-ops | Stops the server creating and removing directories when schemas and filesets are created and dropped | false |
fileset-cache-eviction-interval-ms | Fileset cache eviction interval, where -1 never evicts | 3600000 |
fileset-cache-max-size | Maximum filesets held in the cache, where -1 is unlimited | 200000 |
fs.path.config.{n} | A logical location entry set to a base URI such as hdfs://cluster1/. Keys sharing the prefix are forwarded to that filesystem client | (none) |
The catalog finds file system providers on its own and picks one by the scheme of each location, so filesystem-providers is ignored. default-filesystem-provider, default builtin-local, only decides how a location written without a scheme is resolved.
Storage backends
The server image includes the file system support for every storage system below, so object storage needs only its credential properties. HDFS and local file systems need none.
| Storage system | URI scheme | Credential providers |
|---|---|---|
| Amazon S3 | s3a:// | s3-token, s3-secret-key |
| Google Cloud Storage | gs:// | gcs-token |
| Azure Data Lake Storage | abfss:// | adls-token, azure-account-key |
| Alibaba Cloud OSS | oss:// | oss-token, oss-secret-key |
| HDFS and local | hdfs://, file:// | None |
The GVFS client takes the same property names as the catalog, so a client reading an S3 fileset sets s3-endpoint, s3-access-key-id, and s3-secret-access-key alongside its base GVFS configuration. Setting credential-providers on the catalog removes that requirement, since Gravitino then issues short-lived credentials per request and the client holds no cloud keys at all. See credential vending.
Amazon S3
| Property Name | Description | Required |
|---|---|---|
s3-endpoint | Endpoint of the S3 service | Yes |
s3-access-key-id | Access key | Yes |
s3-secret-access-key | Secret key | Yes |
S3-compatible storage such as MinIO uses the same properties with its own endpoint.
curl -sS -X POST "https://{gravitino_host}/api/metalakes/{metalake}/catalogs" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "{catalog_name}",
"type": "FILESET",
"comment": "",
"properties": {
"location": "s3a://{bucket}/{prefix}",
"s3-endpoint": "{s3_endpoint}",
"s3-access-key-id": "{access_key_id}",
"s3-secret-access-key": "{secret_access_key}"
}
}'
Google Cloud Storage
| Property Name | Description | Required |
|---|---|---|
gcs-service-account-file | Path to the service account JSON file | Yes |
The path is read where it is used: in the server pod for the catalog, and on the client machine for a client not using vended credentials. Mount the key into the server pod from a Secret, as described in Google Cloud credentials.
Azure Data Lake Storage
| Property Name | Description | Required |
|---|---|---|
azure-storage-account-name | Storage account name | Yes |
azure-storage-account-key | Storage account key | Yes |
Alibaba Cloud OSS
| Property Name | Description | Required |
|---|---|---|
oss-endpoint | Endpoint of the OSS service | Yes |
oss-access-key-id | Access key | Yes |
oss-secret-access-key | Secret key | Yes |
Multiple storage systems
One catalog can carry the properties for several storage systems at once, and Gravitino selects among them by the URI scheme of the object being accessed.
HDFS and Kerberos
A secured HDFS cluster needs these on the catalog, and they can be narrowed on a schema or fileset.
| Property Name | Description | Default Value |
|---|---|---|
authentication.type | simple or kerberos | simple |
authentication.impersonation-enable | Whether the catalog impersonates the calling user | false |
authentication.kerberos.principal | Kerberos principal, required when the type is kerberos | (none) |
authentication.kerberos.keytab-uri | URI of the keytab, required when the type is kerberos | (none) |
authentication.kerberos.check-interval-sec | Credential check interval | 60 |
authentication.kerberos.keytab-fetch-timeout-sec | Timeout when retrieving the keytab | 60 |
The HDFS client itself is configured through the files named in config.resources, which are paths in the server pod; mount them there with gravitino.extraVolumes and gravitino.extraVolumeMounts, as described in Customize the Helm chart. In those files Gravitino recognizes three additional keys: hadoop.security.authentication.kerberos.principal, hadoop.security.authentication.kerberos.keytab, and hadoop.security.authentication.kerberos.krb5.conf.
Schema properties
Schemas inherit every catalog property and can override these.
| Property Name | Description | Default Value |
|---|---|---|
location | Base storage location for the schema, named unknown | (none) |
location- | Prefix for named locations | (none) |
credential-providers | Credential provider types, separated by commas | (none) |
config.resources | Configuration files to load | (none) |
authentication.type | simple or kerberos | Catalog value |
authentication.impersonation-enable | Whether to impersonate the calling user | Catalog value |
authentication.kerberos.principal | Kerberos principal for this schema | Catalog value |
authentication.kerberos.keytab-uri | Keytab URI for this schema | Catalog value |
Creating or dropping a schema creates or removes the matching directories, except when disable-filesystem-ops is true or the location contains placeholders.
Fileset properties
Filesets inherit every schema property, including those the schema inherited from the catalog.
| Property Name | Description | Default Value | Immutable |
|---|---|---|---|
location | Storage location for the fileset, named unknown | (none) | No |
default-location-name | Which location GVFS uses when none is named. Required with several | The only location, when there is one | Yes |
placeholder- | Values substituted into placeholders in the location | (none) | Yes |
credential-providers | Credential provider types, separated by commas | (none) | No |
config.resources | Configuration files to load | (none) | No |
authentication.type | simple or kerberos | Schema value | No |
authentication.impersonation-enable | Whether to impersonate the calling user | Schema value | Yes |
authentication.kerberos.principal | Kerberos principal for this fileset | Schema value | No |
authentication.kerberos.keytab-uri | Keytab URI for this fileset | Schema value | No |
Three placeholders are supplied by Gravitino and cannot be set: placeholder-catalog, placeholder-schema, and placeholder-fileset, which resolve to the names of the objects themselves.
Property inheritance
Authentication and credential settings resolve from the nearest level outward, so a fileset value beats a schema value, which beats a catalog value. A catalog can therefore set a default that individual filesets override without repeating the rest of the configuration.
Implement a custom filesystem provider
A storage system without built-in support can be added by implementing FileSystemProvider from gravitino-hadoop-common:
// Build a FileSystem from the properties set when the catalog was created.
FileSystem getFileSystem(@Nonnull Path path, @Nonnull Map<String, String> config)
throws IOException;
// URI scheme, such as 'file', 'hdfs', 's3a', 'gs', or 'oss'.
String scheme();
// Provider name, such as 'builtin-local', 'builtin-hdfs', 's3', 'gcs', or 'oss'.
String name();
The provider is discovered through Java SPI, so the jar needs a META-INF/services/org.apache.gravitino.catalog.hadoop.fs.FileSystemProvider file naming the implementing class. The jar has to be in /opt/gravitino/catalogs/fileset/libs/ in the server container when the server starts. Mount it there from a volume with a subPath, so the jars already in that directory stay, using gravitino.extraVolumes and gravitino.extraVolumeMounts.
Related
- Filesets, for the fileset model and API
- GVFS, for reading and writing fileset data
- Credential vending, for issuing short-lived storage credentials