用户命令行接口

Slack Docker Pulls

Alluxio的命令行接口提供给用户多种操作,例如:

  • 启动或者停止进程
  • 文件系统操作
  • 系统管理命令

调用下述命令来查看多种子命令:

$ ./bin/alluxio
Usage:
  bin/alluxio [command]

Available Commands:
  conf        Get, set, and validate configuration settings, primarily those defined in conf/alluxio-site.properties
  exec        Run the main method of an Alluxio class, or end-to-end tests on an Alluxio cluster.
  fs          Operations to interface with the Alluxio filesystem
  help        Help about any command
  info        Retrieve and/or display info about the running Alluxio cluster
  job         Command line tool for interacting with the job service.
  journal     Journal related operations
  license     Check and manage license status
  mount       Operations to manage mount points
  process     Start/stop cluster processes or remove workers
  quota       Operations to manage quota definitions
  security    Security server related commands

Flags:
      --debug-log               True to enable debug logging
      --skip-license-warnings   Skip the automatic warnings before expiration

Use "bin/alluxio [command] --help" for more information about a command.

要将JVM系统属性作为命令的一部分设置,请使用-D标志,格式为-Dproperty=value

要附加由$ALLUXIO_USER_ATTACH_OPTS指定的调试Java选项,请设置--attach-debug标志。

注意,作为Alluxio部署的一部分,当从${ALLUXIO_HOME}运行Alluxio shell时,它还将采用${ALLUXIO_HOME}/conf/alluxio-site.properties中的配置。

conf

获取、设置和验证Alluxio configuration,主要在conf/alluxio-site.properties中定义。

conf get

用法: bin/alluxio conf get [key] [flags]

get命令打印给定配置项的对应配置值。 如果配置项无效,返回非零的退出码。 如果配置项有效但未设置,则打印空字符串。 如果未指定配置项,则打印完整配置。

注意:此命令不需要Alluxio集群正在运行。

Flags:

  • --master: 显示由master节点使用的配置属性 (默认: false)
  • --source: 显示配置属性的来源而不是值 (默认: false)
  • --unit: 返回值的单位,转换为给定单位。 例如,使用”–unit KB”,配置值为”4096B”将返回4。 可能的选项包括B, KB, MB, GB, TP, PB, MS, S, M, H, D (默认: “”)

Examples:

# Display all the current node configuration
$ ./bin/alluxio conf get
# Display the value of a property key
$ ./bin/alluxio conf get alluxio.master.hostname
# Display the configuration of the current running Alluxio leading master
$ ./bin/alluxio conf get --master
# Display the source of the configuration
$ ./bin/alluxio conf get --source
# Display the values in a given unit
$ ./bin/alluxio conf get alluxio.user.block.size.bytes.default --unit KB
$ ./bin/alluxio conf get alluxio.master.journal.flush.timeout --unit S

exec

如何在一个Alluxio集群上运行Alluxio类的main方法、或者端到端的测试。

exec edgeTest

用法: bin/alluxio exec edgeTest [flags]

测试edge是否成功运行。

Flags:

  • --no-cluster: 仅与 edge 和 UFS 进行交互,而不访问 Dora 集群。 (默认: false)
  • --path: (必要) 路径可以是:
    1. 一个 Alluxio 路径,例如 ‘alluxio:///data’,仅当未设置 ‘–no-cluster’ 标志时使用。
    2. 没有协议(scheme)的路径,例如 ‘/’ 或 ‘/s3’。这是 Alluxio 路径的一种语法糖。
    3. 带有协议(scheme)的 UFS 路径,例如 ‘s3://bucket/data’。 路径必须存在于 Alluxio 命名空间的一个挂载点中。

exec ufsIOTest

用法: bin/alluxio exec ufsIOTest [flags]

A benchmarking tool for the I/O between Alluxio and UFS. This test will measure the I/O throughput between Alluxio workers and the specified UFS path. Each worker will create concurrent clients to first generate test files of the specified size then read those files. The write/read I/O throughput will be measured in the process.

Flags:

  • --io-size: specifies the amount of data each thread writes/reads. (默认: “”)
  • --java-opt: The java options to add to the command line to for the task. This can be repeated. The options must be quoted and prefixed with a space. For example: –java-opt “ -Xmx4g” –java-opt “ -Xms2g”. (默认: [])
  • --path: (必要) specifies the path to write/read temporary data in.
  • --threads: specifies the number of threads to concurrently use on each worker. (默认: 4)

Examples:

# This runs the I/O benchmark to HDFS in your process locally
$ ./bin/alluxio runUfsIOTest --path hdfs://<hdfs-address>
# This invokes the I/O benchmark to HDFS in the Alluxio worker
# 2 threads will be created on each worker
# Each thread is writing then reading 512m of data
$ ./bin/alluxio runUfsIOTest --path hdfs://<hdfs-address> --io-size 512m --threads 2

exec ufsTest

用法: bin/alluxio exec ufsTest [flags]

Test the integration between Alluxio and the given UFS to validate UFS semantics

Flags:

  • --path: (必要) the full UFS path to run tests against.
  • --test: Test name, this option can be passed multiple times to indicate multipleZ tests (默认: [])

fs

与 Alluxio 文件系统进行交互的操作。 对于接受 Alluxio URI 作为参数的命令,如 ls 或 mkdir,参数应该是以下之一:

  • 完整的 Alluxio URI,例如 alluxio://<masterHostname>:<masterPort>/<path>
  • 不带协议(scheme)头的路径,例如 /path,以便使用在 alluxio-site.properties 中设置的默认主机名和端口

注意:所有文件系统命令都需要 Alluxio 集群正在运行。

大多数需要路径组件的命令允许使用通配符参数以方便使用。例如,bin/alluxio fs rm ‘/data/2014*’命令是删除数据目录中以 2014 为前缀的任何内容。 一些 shell 将尝试对输入路径进行模式匹配,导致奇怪的错误。作为解决方法,您可以禁用通配符扩展(取决于 shell 类型;例如,设置 -f)或通过转义通配符。 例如,bin/alluxio fs cat /\\*命令使用了两次转义反斜杠字符。 这是因为 shell 脚本最终会调用一个 Java 程序,该程序应该具有最终转义的参数cat /\\*

fs cat

用法: bin/alluxio fs cat [path]

cat 命令将 Alluxio 中的文件内容打印到 shell。

Examples:

# Print the contents of /output/part-00000
$ ./bin/alluxio fs cat /output/part-00000

fs check-cached

用法: bin/alluxio fs check-cached --path|--index-file <path> [--limit <limit-size>] [flags]

检查 Alluxio 中路径下的文件是否已经被缓存

Flags:

  • --index-file: 本地包含要检查的文件路径列表的索引文件。每行应该包含一个 UFS 文件路径。 (默认: “”)
  • --limit: 限制要检查的文件数量 (默认: 1000)
  • --path: 要检查缓存状态的路径 (默认: “”)
  • --recursive: 是否递归检查指定路径下的文件 (默认: false)

fs checksum

用法: bin/alluxio fs checksum [path]

checksum 命令输出 Alluxio 中文件的 MD5 值,这可以用于验证存储在 Alluxio 中的文件的内容。

Examples:

# Compare the checksum values
# value from Alluxio filesystem
$ ./bin/alluxio fs checksum /LICENSE
md5sum: bf0513403ff54711966f39b058e059a3
# value from local filesystem
md5 LICENSE
MD5 (LICENSE) = bf0513403ff54711966f39b058e059a3

fs chgrp

用法: bin/alluxio fs chgrp [group] [path] [flags]

chgrp 命令用于更改 Alluxio 中文件或目录的组,Alluxio 支持使用 POSIX 文件权限进行文件授权,并且文件所有者或超级用户可以执行此命令。

Flags:

  • --recursive,-R: 递归更改给定路径下所有文件和目录的组 (默认: false)

Examples:

# Change the group of a file
$ ./bin/alluxio fs chgrp alluxio-group-new /input/file1

fs chmod

用法: bin/alluxio fs chmod [mode] [path] [flags]

chmod 命令用于更改 Alluxio 中文件或目录的权限。权限模式表示为一个八进制的三位数值。详细了解权限模式,请参阅 https://en.wikipedia.org/wiki/Chmod#Numerical_permissions

Flags:

  • --recursive,-R: 递归更改给定路径下所有文件和目录的权限 (默认: false)

Examples:

# Set mode 755 for /input/file
$ ./bin/alluxio fs chmod 755 /input/file1

fs chown

用法: bin/alluxio fs chown <owner>[:<group>] <path> [flags]

chown 命令用于更改 Alluxio 文件或目录的所有者。只有超级用户才能更改文件的所有权。

Flags:

  • --recursive,-R: 递归更改给定路径下所有文件和目录的所有者 (默认: false)

Examples:

# Change the owner of /input/file1 to alluxio-user
$ ./bin/alluxio fs chown alluxio-user /input/file1

fs compact

用法: bin/alluxio fs compact [path] [flags]

compact 命令用于合并 position write 类型的文件

Flags:

  • --commitTimeout: 在 compaction 时,默认会保留未提交的文件(文件的 mtime 大于 manifest 的 updateTs),可以配置此值来删除未提交的文件。比如我们可以配置为 8h,这代表当前时间减去文件的 mtime 大于 8h 的文件将会被删除,小于 8h 的文件将会被保留 (默认: “”)
  • --deleteOrphanFrameFiles: 如果为 true,将会删除未被引用的 frame 文件 (默认: false)
  • --deleteOrphanFrameListFiles: 如果为 true,将会删除未被引用的 frame list 文件 (默认: false)
  • --deleteSnapshotsReferencedFiles: 是否删除快照所引用的文件,如果删除,文件将不能回滚至旧版本 (默认: false)
  • --exportPath: 如果指定了该路径,在 compaction 时,会将 frame 合并成一个完整的文件,并且输出到给定路径 (默认: “”)
  • --fileLifecycle: 在 compaction 时,默认会删除没有引用的文件,可以配置此值来保留一些创建不久的文件。比如我们可以配置为 8h,这代表当前时间减去文件的 mtime 大于 8h 的文件将会被删除,小于 8h 的文件将会被保留 (默认: “”)
  • --maxRetainedSnapshots: 快照的最大保留个数,当快照的数量超过了配置的值,最老的快照将被删除 (默认: “”)
  • --parallelism: 设置 compact 任务的并发 (默认: “”)
  • --recursive: 如果为 true,将会递归合并目录内的 position write 类型的文件 (默认: false)

Examples:

# Compact file /log.txt
$ ./bin/alluxio fs compact [--deleteOrphanFrameListFiles] [--deleteOrphanFrameFiles] [--fileLifecycle 6h] [--commitTimeout 1h] [--maxRetainedSnapshots 4] [--deleteSnapshotsReferencedFiles] [--exportPath /log.compaction.txt] [--recursive] [--parallelism 8] /log.txt

fs cp

用法: bin/alluxio fs cp [srcPath] [dstPath] [flags]

cp 命令用于在 Alluxio 文件系统中或本地文件系统与 Alluxio 文件系统之间复制文件或目录。 file:// 协议(scheme)表示本地文件系统路径,而 alluxio:// 协议(scheme)或无协议(scheme)表示 Alluxio 文件系统路径。

Flags:

  • --buffer-size: 复制到本地或从本地复制时的读取缓冲区大小,默认分别为 64MB 和 8MB (默认: “”)
  • --preserve,-p: 复制文件时保留文件权限属性,包括所有权、权限和 ACL (默认: false)
  • --recursive,-R: 如果为 true,则复制目录子树到目标目录 (默认: false)
  • --thread: 用于并行复制文件的线程数,默认为 2 * CPU 核心数 (默认: 0)

Examples:

# Copy within the Alluxio filesystem
$ ./bin/alluxio fs cp /file1 /file2
# Copy a local file to the Alluxio filesystem
$ ./bin/alluxio fs cp file:///file1 /file2
# Copy a file in Alluxio to local
$ ./bin/alluxio fs cp alluxio:///file1 file:///file2
# Recursively copy a directory within the Alluxio filesystem
$ ./bin/alluxio fs cp -R /dir1 /dir2

fs head

用法: bin/alluxio fs head [path] [flags]

head 命令将文件的前 1KB 数据打印到 shell。指定 -c 标志可以设置要打印的字节数。

Flags:

  • --bytes,-c: 要打印的字节数 (默认: “”)

Examples:

# Print first 2048 bytes of a file
$ ./bin/alluxio fs head -c 2048 /output/part-00000

fs location

用法: bin/alluxio fs location [path]

显示存储指定文件的主机列表。

fs ls

用法: bin/alluxio fs ls [path] [flags]

ls 命令列出目录中的所有直接子项,并显示它们的文件信息。 在文件上使用 ls 将只显示该特定文件的信息。

Flags:

  • --cache-filter,-c: 根据缓存过滤配置显示文件的元数据和数据的可缓存性规则;如果未启用缓存过滤,则显示 “Disabled”。注意,解析的可缓存性基于命令行观察到的缓存过滤 (默认: false)
  • --help: 显示此命令的帮助信息 (默认: false)
  • --human-readable,-h: 以人类可读的格式打印大小 (默认: false)
  • --list-dir-as-file,-d: 将目录列为文件 (默认: false)
  • --recursive,-R: 递归列出子目录 (默认: false)

Examples:

# List immediate children of /s3/data
$ ./bin/alluxio fs ls /s3/data

fs mkdir

用法: bin/alluxio fs mkdir [path1 path2 ...]

mkdir 命令在 Alluxio 文件系统中创建新目录。 它是递归的,并将创建所有不存在的父目录。 请注意,创建的目录在底层存储系统中不会被创建,直到目录中的文件被持久化到底层存储为止。 在无效或已存在的路径上使用 mkdir 将会失败。

Examples:

# Creating a folder structure
$ ./bin/alluxio fs mkdir /users
$ ./bin/alluxio fs mkdir /users/Alice
$ ./bin/alluxio fs mkdir /users/Bob

fs mv

用法: bin/alluxio fs mv [srcPath] [dstPath]

mv 命令将文件或目录移动到 Alluxio 中的另一个路径。 目标路径必须不存在或不是一个目录。 如果它是一个目录,文件或目录将作为该目录的子项放置。 该命令仅是一个元数据操作,不会影响文件的数据块。

Examples:

# Moving a file
$ ./bin/alluxio fs mv /data/2014 /data/archives/2014

fs rm

用法: bin/alluxio fs rm [path] [flags]

rm 命令从 Alluxio 空间和底层存储系统中删除文件。 此命令返回后,文件将立即不可用,但实际数据可能稍后被删除。

Flags:

  • --alluxio-only: 如果为 true,则仅从 Alluxio 缓存中删除数据和元数据 (默认: false)
  • --recursive,-R: 如果为 true,则递归删除指定目录子树中的文件 (默认: false)
  • --skip-ufs-check,-U: 如果为 true,则跳过检查对应的 UFS 内容是否同步 (默认: false)

Examples:

# Remove a file from Alluxio and the under storage system
$ ./bin/alluxio fs rm /tmp/unused-file
# Remove a file from Alluxio filesystem only
$ ./bin/alluxio fs rm --alluxio-only --skip-ufs-check /tmp/unused-file2
# Note it is recommended to use both --alluxio-only and --skip-ufs-check together in this situation

fs stat

用法: bin/alluxio fs stat [path] [flags]

stat 命令将文件或目录的 FileInfo 表示形式转储到 shell。

Flags:

  • --format,-f: 以给定格式显示信息: “%N”: 文件名 “%z”: 文件大小(以字节为单位 “%u”: 所有者 “%g”: 所有者的组名 “%i”: 文件的文件ID “%y”: 修改时间(UTC 时间),格式为 ‘yyyy-MM-dd HH:mm’ “%Y”: 修改时间的 Unix 时间戳(毫秒 “%b”: 为文件分配的块数 (默认: “”)

Examples:

# Display file's stat
$ ./bin/alluxio fs stat /data/2015/logs-1.txt
# Display directory's stat
$ ./bin/alluxio fs stat /data/2015
# Display the size of file
$ ./bin/alluxio fs stat -f %z /data/2015/logs-1.txt

fs tail

用法: bin/alluxio fs tail [path] [flags]

tail 命令将文件的最后 1KB 数据打印到 shell。 指定 –bytes 标志可以设置要打印的字节数。

Flags:

  • --bytes: 要打印的字节数 (默认: “”)

Examples:

# Print last 2048 bytes of a file
$ ./bin/alluxio fs tail --bytes 2048 /output/part-00000

fs test

用法: bin/alluxio fs test [path] [flags]

测试路径的属性,如果属性为真则返回 0,否则返回 1。

Flags:

  • --dir,-d: 测试路径是否是目录 (默认: false)
  • --exists,-e: 测试路径是否存在 (默认: false)
  • --file,-f: 测试路径是否是文件 (默认: false)
  • --not-empty,-s: 测试路径是否不为空 (默认: false)
  • --zero,-z: 测试路径是否为零长度 (默认: false)

fs touch

用法: bin/alluxio fs touch [path]

在指定路径创建一个 0 字节的文件,该文件也将在底层文件系统中创建。

info

检索和/或显示运行中的 Alluxio 集群的信息。

info cluster

用法: bin/alluxio info cluster

打印绑定的集群信息

info nodes

用法: bin/alluxio info nodes

显示所有注册的worker节点状态

info production

用法: bin/alluxio info production

打印生产 ID

info version

用法: bin/alluxio info version

打印 Alluxio 版本信息

job

用于与作业服务交互的命令行工具。

job free

用法: bin/alluxio job free [flags]

free 命令触发一个调度器作业,以释放目录并在各worker节点分布的worker节点page stores中释放缓存的page。

Flags:

  • --batch-size: [submit]每个worker节点每秒释放文件的速度。如果值为 0 或为空,将设置为 alluxio.job.batch.size 的值 (默认: 0)
  • --force: [submit] 即使一些worker节点离线也触发释放 (默认: false)
  • --format: [progress] 输出格式,TEXT 或 JSON (默认: “”)
  • --path: (必要) [All] 释放操作的源路径
  • --progress: 查看已提交作业的进度 (默认: false)
  • --recursive: [submit] 递归释放所有文件 (默认: true)
  • --stop: 停止正在运行的作业 (默认: false)
  • --submit: 提交作业 (默认: false)
  • --verbose: [progress] 详细输出 (默认: false)

Examples:

# Submit a free job to free path cache
$ ./bin/alluxio job free --path s3://bucket/path --submit
# View the progress of a submitted job
$ ./bin/alluxio job free --path s3://alluxio/path --progress
Progress for Free path file 's3://alluxio/path':
	Job Id: b21ce9fb-f332-4d39-8bb4-554f9a4fa601
	Job Submitted: Fri Feb 02 21:28:56 CST 2024
	Job path: s3://alluxio/path
	Job State: SUCCEEDED, finished at Fri Feb 02 21:29:01 CST 2024
	Free Info :	totalFile:4 totalByte:3072.00KB
	Free Files Failed: 0
	Free Bytes Failed: 0B
	Free Files Succeeded: 4
	Free Bytes Succeeded: 3072.00KB
# Stop a submitted job with best effort. Workers will stop freeing cache under the specified path as soon as possible.
$ ./bin/alluxio job free --path s3://alluxio/path --stop

job list

用法: bin/alluxio job list [flags]

根据job类型和job状态,list所有满足条件的job。

Flags:

  • --job-state: job状态. RUNNING VERIFYING STOPPED SUCCEEDED FAILED ALL (默认: “”)
  • --job-type: job类型. 可选值:LOAD FREE COPY MOVE ALL (默认: “”)

Examples:

$./bin/alluxio job list --job-type all --job-state all
List job type:ALL state:ALL
{"mJobId":"1c723247-8381-4d69-bd29-b0f4fb34fc8d","mFreePath":"s3://alluxio/test-dir/","mJobType":"free","mJobState":"SUCCEEDED","mFreeBytes":81920000,"mFreeFileNums":20000,"mFreeFailFileNums":0,"mFreeFailBytes":0,"mFailInfos":{},"mTasks":{"WorkerInfo{id=0, identity=worker-1, address=WorkerNetAddress{host=hostname, containerHost=, rpcPort=29999, dataPort=29997, webPort=30000, domainSocketPath=, secureRpcPort=0, httpServerPort=0}, lastContactSec=0, state=LIVE, capacityBytes=0, usedBytes=0, startTimeMs=0, capacityBytesOnTiers=null, usedBytesOnTiers=null, version=, revision=}":"SUCCESS"},"mVerbose":true,"mStartTime":1722490595894,"mEndTime":1722490606649}
{"mPath":"s3://alluxio/test-dir/","mIndexFile":"","mJobType":"load","mVerbose":true,"mJobState":"SUCCEEDED","mVerificationEnabled":false,"mSkippedByteCount":0,"mLoadedByteCount":81920000,"mScannedInodesCount":20000,"mLoadedNonEmptyFileCopiesCount":20000,"mTotalByteCount":81920000,"mThroughput":1462857,"mFailureFilesPercentage":0.0,"mFailureSubTasksPercentage":0.0,"mRetrySubTasksPercentage":0.0,"mFailedFileCount":0,"mRecentFailedSubtasksWithReasons":[],"mRecentRetryingSubtasksWithReasons":[],"mSkipIfExists":false,"mMetadataOnly":false,"mRunningStage":"","mRetryDeadLetterQueueSize":0,"mTimeElapsed":52693,"mSegmentEnabled":false}

job load

用法: bin/alluxio job load [flags]

load 命令将数据从底层存储系统移动到 Alluxio 存储中。 例如,load 可用于为分析作业预取数据。 如果在目录上运行 load,目录中的文件将被递归加载。

Flags:

  • --bandwidth: [submit] 单个worker节点读取带宽限制 (默认: “”)
  • --batch-size: [submit] 每个worker节点加载的批次大小。如果值为 0 或为空,将设置为 alluxio.job.batch.size 的值 (默认: 0)
  • --file-filter-regx: [submit] 跳过匹配正则表达式模式的文件 (默认: “”)
  • --force: [submit] 即使某些worker节点离线也触发元数据同步 (默认: false)
  • --format: [progress] 输出格式,TEXT 或 JSON (默认: “”)
  • --index-file: [all] 加载操作的索引文件的源路径 (默认: “”)
  • --metadata-only: [submit] 仅加载文件元数据 (默认: false)
  • --partial-listing: [submit] 使用部分目录列表,在读取整个目录之前初始化加载,但无法报告某些进度详细信息 (默认: false)
  • --path: [all] 加载操作的源路径 (默认: “”)
  • --progress: 查看已提交作业的进度 (默认: false)
  • --replicas: [submit] 加载的副本数量 (默认: 1)
  • --skip-if-exists: [submit] 跳过现有的已完全缓存的文件 (默认: false)
  • --skip-quota-check: [submit] 强制跳过quota check提交load任务 (默认: false)
  • --stop: 停止正在运行的作业 (默认: false)
  • --submit: 提交作业 (默认: false)
  • --verbose: [progress] 详细输出 (默认: false)
  • --verify: [submit] 加载完成后运行验证,如果有新文件则加载 (默认: false)

Examples:

# Submit a load job
$ ./bin/alluxio job load --path <full-ufs-path> --submit
OR
$ ./bin/alluxio job load --index-file <full-ufs-path> --submit
If --index-file is used, load command will read the index file and load the file paths in it.
Both file and directory are supported. In the index file, each line represents an UFS path.
An example index file looks like the following:
hdfs://cluster/root/file
s3://bucket/directory/
#file:///ignored
The hdfs path will be loaded as a single file,
the s3 path will be loaded recursively as a directory,the s3 path will be loaded recursively as a directory,
because it ends with the separator / ,
while the local file will be ignored as it starts with # and considered as a line of comment.
# View the progress of a submitted job
$ ./bin/alluxio job load --path <full-ufs-path> --progress
OR
$ ./bin/alluxio job load --index-file <full-ufs-path> --progress
# Example output
Progress for loading path '/path':
        Settings:       bandwidth: unlimited    verify: false
        Job State: SUCCEEDED
        Files Processed: 1000
        Bytes Loaded: 125.00MB
        Throughput: 2509.80KB/s
        Block load failure rate: 0.00%
        Files Failed: 0
# Stop a submitted job
$ ./bin/alluxio job load --path <full-ufs-path> --stop
OR
$ ./bin/alluxio job load --index-file <full-ufs-path> --stop

journal

日志相关操作

journal checkpoint

用法: bin/alluxio journal checkpoint

checkpoint 命令会在被选举出的 Alluxio master节点创建日志检查点。 该命令主要用于调试和避免master节点日志无限增长。 检查点需要暂停master节点元数据更改,因此请谨慎使用此命令,以避免干扰系统的其他用户。

journal format

用法: bin/alluxio journal format

format 命令格式化本地 Alluxio master节点的日志。

警告: 只有在集群未运行时才应调用格式化命令。

journal read

用法: bin/alluxio journal read [flags]

read 命令解析当前的日志,并将人类可读的版本输出到本地文件夹。这个命令可能会花费一些时间,具体取决于日志的大小。

注意: 此命令要求 Alluxio 集群 运行。

Flags:

  • --end: 结束日志序列号(独占) (默认: -1)
  • --input-dir: 从磁盘读取日志内容的输入目录 (默认: “”)
  • --master: master节点类的名称 (默认: “”)
  • --output-dir: 将日志内容写入的输出目录 (默认: “”)
  • --start: 开始日志序列号 (默认: 0)

Examples:

$ ./bin/alluxio journal read
# output
Dumping journal of type EMBEDDED to /Users/alluxio/journal_dump-1602698211916
2020-10-14 10:56:51,960 INFO  RaftStorageDirectory - Lock on /Users/alluxio/alluxio/journal/raft/02511d47-d67c-49a3-9011-abb3109a44c1/in_use.lock acquired by nodename 78602@alluxio-user
2020-10-14 10:56:52,254 INFO  RaftJournalDumper - Read 223 entries from log /Users/alluxio/alluxio/journal/raft/02511d47-d67c-49a3-9011-abb3109a44c1/current/log_0-222.

license

检查和管理许可证状态

license check-expiration

用法: bin/alluxio license check-expiration

验证许可证并在即将超出任何约束时打印警告。

license show

用法: bin/alluxio license show [flags]

根据产品 jar 和配置显示许可证的详细信息。

Flags:

  • --output,-o: 输出格式,可以是 json/yaml (默认: “”)

license status

用法: bin/alluxio license status [flags]

列出许可证可能使用的集群的当前状态。

Flags:

  • --raw: 输出原始 JSON 数据,而不是人类可读格式的字节、日期时间和持续时间。 (默认: false)

license update

用法: bin/alluxio license update [flags]

使用当前site properties中的许可证进行更新。

Flags:

  • --process: 您要使用新许可证更新的进程 (默认: “”)

mount

mount 命令管理从底层存储路径到 Alluxio 路径的映射,其中在该路径下创建的 Alluxio 空间中的文件和文件夹将由底层存储路径中相应的文件或文件夹支持。

mount add

用法: bin/alluxio mount add [flags]

add 命令可用于将另一个存储系统中的数据提供给 Alluxio。 请注意,–readonly 标志的挂载点对于防止意外写操作非常有用。 如果多个 Alluxio 卫星集群挂载一个作为事实来源的远程存储集群,–readonly 选项可以帮助防止来自卫星集群的任何写操作抹掉远程存储中的数据。

要连接到挂载点的 UFS,Alluxio 会在 ${ALLUXIO_HOME}/lib/ 下寻找相应的连接器,并使用第一个支持该路径的连接器。 连接器的 JAR 文件看起来像 lib/alluxio-underfs-hdfs-2.7.1.jar。 决定连接器是否支持路径的逻辑取决于 UnderFileSystemFactory 实现。 当同一 UFS 有多个连接器时,比如 lib/alluxio-underfs-hdfs-2.7.1.jar、lib/alluxio-underfs-hdfs-2.7.1-patch1.jar、lib/alluxio-underfs-hdfs-2.7.1-patch2.jar,选项 alluxio.underfs.strict.version.match.enabled 可以确保选择正确的连接器。 例如,如果 HDFS 运行的是 2.7.1-patch1,您可以使用 alluxio.underfs.version 和 alluxio.underfs.strict.version.match.enabled=true 来确保使用 lib/alluxio-underfs-hdfs-2.7.1-patch1.jar 连接到目标 HDFS(如 hdfs://ns1/)。

Flags:

  • --master: 设置为 true 以创建由 Alluxio master节点跟踪的挂载点 (默认: false)
  • --option: 挂载点的配置选项,以 key=value 的形式,如凭据(credentials) (默认: [])
  • --path: (必要) 要挂载到的 Alluxio 路径
  • --shared: 将挂载点的权限位设置为所有 Alluxio 用户都可以访问 (默认: false)
  • --ufs-uri: (必要) 要挂载的 UFS URI

Examples:

# Add a mount point at /hdfs to access hdfs://host1:9000/data/
# Note that the mount point must be under the root directory
$ ./bin/alluxio mount add --path /hdfs --ufs-uri hdfs://host1:9000/data/
# Add a read only mount that is accessible to all Alluxio users
$ ./bin/alluxio mount add --path /hdfs2 --ufs-uri hdfs://host2:9000/data/ --shared --readonly
# Add a S3 bucket mount with S3 credentials required to access the bucket
$ ./bin/alluxio mount add --path /s3 --ufs-uri s3://data-bucket/ --option s3a.accessKeyId=<accessKey> --option s3a.secretKey=<secretKey> --option alluxio.underfs.s3.region=us-east-1
# Add a HDFS mount using a specific UFS jar in lib/
$ ./bin/alluxio mount add --path /ns1 --ufs-uri hdfs://ns1/ --option alluxio.underfs.version=2.7.1-patch1 --option alluxio.underfs.strict.version.match.enabled=true

mount list

用法: bin/alluxio mount list [flags]

出设置在 Alluxio 文件系统上的所有已知挂载点。

Flags:

  • --master: 设置为 true 以基于master节点注册列出挂载点 (默认: false)

Examples:

# List mount points
$ ./bin/alluxio mount list

mount remove

用法: bin/alluxio mount remove [flags]

移除指定路径处的挂载点。

Flags:

  • --master: 设置为 true 以删除master节点注册的挂载点 (默认: false)
  • --path: (必要) 要取消挂载的 Alluxio 路径

Examples:

# Remove mount point at /mnt/hdfs
$ ./bin/alluxio mount remove --path /mnt/hdfs

process

启动/停止集群进程或移除worker节点

process remove-worker

用法: bin/alluxio process remove-worker [flags]

从集群中移除给定的worker节点,这样客户端和其他worker节点将不再考虑已移除的worker节点提供服务。 在安全地从集群中移除worker节点之前,必须先停止该worker节点。

Flags:

  • --name,-n: (必要) worker节点的 ID

process start

用法: bin/alluxio process start [flags]

启动单个进程本地或跨集群启动一组相似的进程。 对于启动一组进程,假定本地主机可以无密码访问集群中的其他节点。 该命令将通过读取 conf/coordinator 和 conf/workers 文件来解析要运行的主机名,具体取决于进程类型。

Flags:

  • --async,-a: 异步启动进程,而不监视启动完成 (默认: false)
  • --console-log,-c: Log output to stdout in addition to log file (默认: false)
  • --direct,-d: (用于 docker)直接运行启动命令,跳过所有其他步骤,并避免使用 nohup 启动 (默认: false)
  • --skip-kill-prev,-N: 在启动时避免终止先前运行的进程 (默认: false)

process stop

用法: bin/alluxio process stop [flags]

停止单个进程本地或跨集群停止一组相似的进程。 对于停止一组进程,假定本地主机可以无密码访问集群中的其他节点。 该命令将通过读取 conf/coordinator 和 conf/workers 文件来解析要运行的主机名,具体取决于进程类型。

Flags:

  • --soft,-s: 仅软关闭,不强制终止进程 (默认: false)

quota

The quota command manges all quota definitions in Alluxio system. Alluxio supports setting quota on directories in Alluxio path.

quota add

用法: bin/alluxio quota add [flags]

在一个Alluxio目录上添加一个Quota定义。Quota定义的缓存空间上限是所有Alluxio worker缓存的总和。

Flags:

  • --directory: (必要) 设置目标Alluxio目录路径,如 /s3/。注意这个路径必须在某个已有的挂载点下或者是挂载点路径本身。
  • --quota-size: (必要) 设置Quota大小,如 10GB, 1TB

Examples:

# Add a quota of 10GB to the directory /s3/ in Alluxio namespace
# The cache in all Alluxio workers combined will be limited to 10GB
$ bin/alluxio quota add --directory /s3/ --quota-size 10GB

quota list

用法: bin/alluxio quota list [flags]

列出当前所有的Quota使用情况

Flags:

  • --interval: 刷新Quota使用信息的间隔时间,如 5s,1m。如果设置了–interval,则会每隔指定的时间刷新一次并输出,直到命令行被终止。 (默认: “”)

Examples:

# Lists current quota usage
$ bin/alluxio quota list
Alluxio path: /local, Quota capacity bytes: 11534336, Used bytes: 10486645, State: Available
Alluxio path: /s3/data, Quota capacity bytes: 10737418240, Used bytes: Calculating, State: Available
# Keeps running until interrupted by user by pressing ctrl+C
$ bin/alluxio quota list --interval 5s
Polling quota usage summary from the master every 5s
Alluxio path: /local, Quota capacity bytes: 11534336, Used bytes: 10486645, State: Available
Alluxio path: /s3/data, Quota capacity bytes: 10737418240, Used bytes: Calculating, State: Available
Alluxio path: /local, Quota capacity bytes: 11534336, Used bytes: 10486645, State: Available
Alluxio path: /s3/data, Quota capacity bytes: 10737418240, Used bytes: Calculating, State: Available
Alluxio path: /local, Quota capacity bytes: 11534336, Used bytes: 10486645, State: Available
Alluxio path: /s3/data, Quota capacity bytes: 10737418240, Used bytes: 10486645, State: Available

quota remove

用法: bin/alluxio quota remove [flags]

删除一个已有的Quota定义

Flags:

  • --directory: (必要) 要删除Quota定义的目标Alluxio目录路径,如 /s3/。

Examples:

$ bin/alluxio quota remove --directory /s3/
Successfully removed quota definition for path /s3/data.

quota update

用法: bin/alluxio quota update [flags]

更新一个已有的Quota定义

Flags:

  • --directory: (必要) 要更新的目标Alluxio目录路径,如 /s3/。
  • --force: Whether to force the update of the quota, even if it violates the existing space usage (默认: false)
  • --quota-size: (必要) 新的Quota大小,如 10GB, 1TB

Examples:

$ bin/alluxio quota update --directory /local/data/ --quota-size 100GB

security

安全服务器相关命令

security token

用法: bin/alluxio security token

从安全服务器获取一个token。