cacheadmin

On the command-line, you can interact with cache pools and directives via the hdfs cacheadmin subcommand.

Cache directives are identified by a unique, non-repeating 64-bit integer ID. IDs will not be reused even if a cache directive is later removed. Cache pools are identified by a unique string name.

Cache directive commands

addDirective

Adds a new cache directive.

$ hdfs cacheadmin -addDirective -path <path> -pool <pool-name> [-force] [-replication <replication>] [-ttl <time-to-live>]
Arguments

<path>

A path to the cache. A path can be a directory or a file

<pool-name>

A pool to which the directive will be added. The user should have the write permission on the cache pool in order to add new directives

-force

Skips checking of cache pool resource limits

<replication>

The cache replication factor to use

<time-to-live>

Specifies the time period for the directive to be valid. Can be specified in minutes, hours, and days, e.g. 30m, 4h, 2d. If unspecified, the directive never expires

removeDirective

Removes every cache directive with the specified path.

$ hdfs cacheadmin -removeDirective <id>
Arguments

<path>

The path of the cache directives to remove. You must have the write permission on the pool of the directive in order to remove it

listDirectives

Lists cache directives.

$ hdfs cacheadmin -listDirectives [-stats] [-path <path>] [-pool <pool>]
Arguments

<path>

Lists only cache directives with this path. If there is a cache directive for a path in a cache pool that the user doesn’t have read access for, it will not be listed

<pool>

Lists only path cache directives in that pool

-stats

Lists path-based cache directive statistics

Cache pool commands

addPool

Adds a new cache pool.

$ hdfs cacheadmin -addPool <name> [-owner <owner>] [-group <group>] [-mode <mode>] [-limit <limit>] [-maxTtl <maxTtl>]
Arguments

<name>

A name for the new pool.

<owner>

The pool owner’s username. Defaults to the current user

<group>

The group of the pool. Defaults to the primary group name of the current user

<mode>

UNIX-style permissions for the pool. Permissions are specified in octal, e.g. 0755

<limit>

The maximum number of bytes that can be cached by directives in this pool, in aggregate. By default, no limit is set

<maxTtl>

The maximum allowed time-to-live for directives being added to the pool. Can be specified in seconds, minutes, hours, and days, e.g. 120s, 30m, 4h, 2d. By default, no maximum is set. The value of never specifies that there is no limit

modifyPool

Modifies the metadata of an existing cache pool.

$ hdfs cacheadmin -modifyPool <name> [-owner <owner>] [-group <group>] [-mode <mode>] [-limit <limit>] [-maxTtl <maxTtl>]
Arguments

<name>

The name of the pool to modify

<owner>

The pool owner’s username

<group>

The name of the group of the pool

<mode>

Unix-style permissions of the pool in octal

<limit>

The maximum number of bytes that can be cached by this pool

<maxTtl>

The maximum allowed time-to-live for directives being added to the pool

removePool

Removes a cache pool. This also uncaches paths associated with the pool.

$ hdfs cacheadmin -removePool <name>
Arguments

<name>

The name of the cache pool to remove

listPools

Displays information about one or more cache pools, e.g. name, owner, group, permissions, etc.

hdfs cacheadmin -listPools [-stats] [<name>]
Arguments

-stats

Displays additional cache pool statistics

<name>

If specified, lists only the named cache pool

help

Displays detailed information about the command.

$ hdfs cacheadmin -help <command-name>
Arguments

<command-name>

Command to display the information about

help

If no command is specified, prints detailed information about all commands

Found a mistake? Seleсt text and press Ctrl+Enter to report it