在 CIFS 服务器上配置 BranchCache
可配置 BranchCache,以便为每个共享提供 BranchCache 服务。或者,可配置 BranchCache 以自动启用所有 SMB 共享上的高速缓存。
关于本任务
可在 SVM 上配置 BranchCache。
如果要为 CIFS 服务器上所有 SMB 共享中的所有内容提供高速缓存服务,可以创建所有共享 BranchCache 配置。
如果要为 CIFS 服务器上选定 SMB 共享中的内容提供高速缓存服务,可以创建每个共享 BranchCache 配置。
配置 BranchCache 时,必须指定以下参数:
必需参数 | 描述 |
---|---|
SVM 名称 | 每个 SVM 上已配置 BranchCache。必须指定要配置 BranchCache 服务的支持 CIFS 的 SVM。 |
哈希存储路径 | BranchCache 哈希已存储在 SVM 卷的常规文件中。必须指定要 ONTAP 存储哈希数据的现有目录路径。 BranchCache 哈希路径必须可读写。不允许使用只读路径,例如快照目录。可在包含其他数据的卷中存储哈希数据,或创建单独的卷以存储哈希数据。 如果该 SVM 是 SVM 灾难恢复源,则哈希路径无法在根卷上。这是因为根卷不会复制到灾难恢复目标。 哈希路径可包含空格和任何有效的文件名字符。 |
可选择指定以下参数:
可选参数 | 描述 |
---|---|
支持版本 | ONTAP 支持 BranchCache 1 和 2。可启用版本 1、版本 2 或同时启用两个版本。默认同时启用两个版本。 |
哈希存储最大大小 | 可指定用于哈希数据存储的大小。如果哈希数据超过此值,ONTAP 则会删除旧哈希,而为新哈希留出空间。哈希存储的默认大小为 1 GB。 如果哈希不以过度积极的方式丢弃,则 BranchCache 会更有效执行。如果确定常因哈希存储已满而将哈希丢弃,可通过修改 BranchCache 配置增加哈希存储大小。 |
服务器密钥 | 可指定 BranchCache 服务使用的服务器密钥以防止客户端模拟 BranchCache 服务器。如果未指定服务器密钥,则将在创建 BranchCache 配置时随机生成。 可以将此服务器密钥指定为一个特定值,这样,如果多台服务器为相同的文件提供 BranchCache 数据,则客户端便可使用共享这一服务器密钥的任一服务器中的哈希。如果此服务器密钥包含空格,则必须使用引号将服务器密钥引起来。 |
运行模式 | 默认为每个共享启用 BranchCache。
|
示例
以下命令可同时验证 SMB 2.1 和 3.0 是否启用,并配置 BranchCache 以自动启用 SVM vs1 上所有 SMB 共享的高速缓存:
cluster1::> set -privilege advanced
Warning: These advanced commands are potentially dangerous; use them
only when directed to do so by technical support personnel.
Do you wish to continue? (y or n): y
cluster1::*> vserver cifs options show -vserver vs1 -fields smb2-enabled,smb3-enabled
vserver smb2-enabled smb3-enabled
------- ------------ ------------
vs1 true true
cluster1::*> set -privilege admin
cluster1::> vserver cifs branchcache create -vserver vs1 -hash-store-path /
hash_data -hash-store-max-size 20GB -versions enable-all -server-key "my server key" -operating-mode all-shares
cluster1::> vserver cifs branchcache show -vserver vs1
Vserver: vs1
Supported BranchCache Versions: enable_all
Path to Hash Store: /hash_data
Maximum Size of the Hash Store: 20GB
Encryption Key Used to Secure the Hashes: -
CIFS BranchCache Operating Modes: all_shares
以下命令可同时验证 SMB 2.1 和 3.0 是否启用,并配置 BranchCache 以启用 SVM vs1 上的每个共享的高速缓存,并验证 BranchCache 配置:
cluster1::> set -privilege advanced
Warning: These advanced commands are potentially dangerous; use them
only when directed to do so by technical support personnel.
Do you wish to continue? (y or n): y
cluster1::*> vserver cifs options show -vserver vs1 -fields smb2-enabled,smb3-enabled
vserver smb2-enabled smb3-enabled
------- ------------ ------------
vs1 true true
cluster1::*> set -privilege admin
cluster1::> vserver cifs branchcache create -vserver vs1 -hash-store-path /
hash_data -hash-store-max-size 20GB -versions enable-all -server-key "my server key"
cluster1::> vserver cifs branchcache show -vserver vs1
Vserver: vs1
Supported BranchCache Versions: enable_all
Path to Hash Store: /hash_data
Maximum Size of the Hash Store: 20GB
Encryption Key Used to Secure the Hashes: -
CIFS BranchCache Operating Modes: per_share