Apache Zeppelin 的 Alluxio 解释器
概述
Alluxio 是一个以内存为中心的分布式存储系统,能够在集群框架之间以内存速度实现可靠的数据共享。
配置
| 名称 | 类别 | 描述 |
|---|---|---|
| alluxio.master.hostname | localhost | Alluxio 主节点主机名 |
| alluxio.master.port | 19998 | Alluxio 主节点端口 |
启用Alluxio解释器
在笔记本中,要启用Alluxio解释器,请点击齿轮图标并选择Alluxio。
使用Alluxio解释器
在段落中,使用 %alluxio 选择 Alluxio 解释器,然后输入所有命令。
%alluxio
help
提示: 使用 ( Ctrl + . ) 进行自动补全。
解释器命令
Alluxio 解释器接受以下命令。
| Operation | Syntax | Description |
|---|---|---|
| cat | cat "path" | Print the content of the file to the console. |
| chgrp | chgrp "group" "path" | Change the group of the directory or file. |
| chmod | chmod "permission" "path" | Change the permission of the directory or file. |
| chown | chown "owner" "path" | Change the owner of the directory or file. |
| copyFromLocal | copyFromLocal "source path" "remote path" | Copy the specified file specified by "source path" to the path specified by "remote path". This command will fail if "remote path" already exists. |
| copyToLocal | copyToLocal "remote path" "local path" | Copy the specified file from the path specified by "remote path" to a local destination. |
| count | count "path" | Display the number of folders and files matching the specified prefix in "path". |
| du | du "path" | Display the size of a file or a directory specified by the input path. |
| fileInfo | fileInfo "path" | Print the information of the blocks of a specified file. |
| free | free "path" | Free a file or all files under a directory from Alluxio. If the file/directory is also in under storage, it will still be available there. |
| getCapacityBytes | getCapacityBytes | Get the capacity of the AlluxioFS. |
| getUsedBytes | getUsedBytes | Get number of bytes used in the AlluxioFS. |
| load | load "path" | Load the data of a file or a directory from under storage into Alluxio. |
| loadMetadata | loadMetadata "path" | Load the metadata of a file or a directory from under storage into Alluxio. |
| location | location "path" | Display a list of hosts that have the file data. |
| ls | ls "path" | List all the files and directories directly under the given path with information such as size. |
| mkdir | mkdir "path1" ... "pathn" | Create directory(ies) under the given paths, along with any necessary parent directories. Multiple paths separated by spaces or tabs. This command will fail if any of the given paths already exist. |
| mount | mount "path" "uri" | Mount the underlying file system path "uri" into the Alluxio namespace as "path". The "path" is assumed not to exist and is created by the operation. No data or metadata is loaded from under storage into Alluxio. After a path is mounted, operations on objects under the mounted path are mirror to the mounted under storage. |
| mv | mv "source" "destination" | Move a file or directory specified by "source" to a new location "destination". This command will fail if "destination" already exists. |
| persist | persist "path" | Persist a file or directory currently stored only in Alluxio to the underlying file system. |
| pin | pin "path" | Pin the given file to avoid evicting it from memory. If the given path is a directory, it recursively pins all the files contained and any new files created within this directory. |
| report | report "path" | Report to the master that a file is lost. |
| rm | rm "path" | Remove a file. This command will fail if the given path is a directory rather than a file. |
| setTtl | setTtl "time" | Set the TTL (time to live) in milliseconds to a file. |
| tail | tail "path" | Print the last 1KB of the specified file to the console. |
| touch | touch "path" | Create a 0-byte file at the specified location. |
| unmount | unmount "path" | Unmount the underlying file system path mounted in the Alluxio namespace as "path". Alluxio objects under "path" are removed from Alluxio, but they still exist in the previously mounted under storage. |
| unpin | unpin "path" | Unpin the given file to allow Alluxio to evict this file again. If the given path is a directory, it recursively unpins all files contained and any new files created within this directory. |
| unsetTtl | unsetTtl | Remove the TTL (time to live) setting from a file. |
如何测试它是否正常工作
请确保正确配置了Alluxio解释器,然后打开一个新段落并输入上述命令之一。
下面是一个简单的示例,展示如何与Alluxio解释器进行交互。 执行以下步骤:
- 使用 sh 解释器在本地机器上创建一个新的文本文件
- 使用Alluxio解释器:
- 列出了afs(Alluxio文件系统)根目录的内容
- 将之前创建的文件复制到afs
- 再次列出afs根目录的内容以检查新复制的文件是否存在
- 显示复制的文件内容(使用tail命令)
- 将之前复制到afs的文件复制到本地机器
- 使用 sh 解释器检查从 Alluxio 复制的新文件是否存在,并显示其内容