ECS:如何使用 JCASScript 执行有时限查询

Summary: 如何使用 JCASScript 执行有时限的查询。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

JCASScript 运行一个有时间限制的查询,并生成在该时间范围内写入的片段。
要运行此查询,我们需要相应的 PEA 文件。请参阅知识库文章 ECS:如何使用 JCASScript.jar  在 ECS 上执行基本的 CAS API作以查找存储区所有者以及如何获取相应的 PEA 文件。
如果我们没有 ECS UI 的 root 访问权限,戴尔支持团队会请求用户提供相应的 PEA 文件。

从 ECS 节点使用 JCASScript:

  • 以管理员用户身份登录到任何节点,进入 object-main 容器。
admin@ecsnode1:~>  sudo dockobj
  • 切换到 castools 目录。
ecsnode1:/ # cd /opt/storageos/tools/castools
  • 创建您的 PEA 文件:
ecsnode1:/opt/storageos/tools/castools # vi icoe_cas.pea
ecsnode1:/opt/storageos/tools/castools # cat icoe_cas.pea
<pea version="1.0.0">
<defaultkey name="icoe_cas_obusr">
<credential id="csp1.secret" enc="base64">UmJaVGNsb1Z1M0hxaHVDN3ZXTmE=</credential>
</defaultkey>
<key type="cluster" id="23a0767d-d6e7-3f41-bc1d-89d139549fe2" name="icoe_cas_obusr">
<credential id="csp1.secret" enc="base64">UmJaVGNsb1Z1M0hxaHVDN3ZXTmE=</credential>
</key>
</pea>
ecsnode1:/opt/storageos/tools/castools #
  • 将 castools 导出到”$LD_LIBRARY_PATH":
ecsnode1:/opt/storageos/tools/castools # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/storageos/tools/castools/
  • 获取侦听 CAS 端口 (3218) 的 IP 地址:
ecsnode1:/opt/storageos/tools/castools # sudo ss -nap | grep :3218 | grep LISTEN | grep -oP "(?:[0-9]{1,3}\.){3}[0-9]{1,3}"
  • 开始 ”JCASScript.jar交互式 CLI:
ecsnode1:/opt/storageos/tools/castools # java -jar JCASScript.jar

CASScript>
  • 连接到池:
# poolOpen <ipaddress>?<path to pea file>
在下面的示例中,使用 localhost,我们可以使用上述步骤中返回的数据 IP。
For example:
CASScript>po localhost?icoe_cas.pea

Attempting to connect to: localhost?icoe_cas.pea

Connected to: localhost?icoe_cas.pea

CASPool Properties:
         Connection String:                 localhost?icoe_cas.pea
         Cluster Time:                      2020.07.30 02:06:39 GMT
         Buffer Size:                       16384
         Prefetch Buffer Size:              32768
         Connection Timeout:                120000
         Multi-Cluster Failover Enabled:    True
         Collision Avoidance Enabled:       False

CASScript>
  • 要启动有时间限制的查询,我们必须设置下限和上限。
    querySetLower Bound 设置查询表达式的开始日期。开始日期表示查询表达式的下限。

    语法:querySetLower Bound startDate

    querySetUpper Bound 设置查询表达式的结束日期。结束日期表示查询表达式

    的上限 语法:querySetUpper Bound endTime
For example:

CASScript>querySetLowerBound "2020.07.29 00:00:00"

Query Expression Properties:
        Start Time: 2020.07.29 00:00:00
        End Time  : UNBOUNDED
        Type      : EXISTING

CASScript>querySetUpperBound  "2020.07.30 14:00:00"

Query Expression Properties:
        Start Time: 2020.07.29 00:00:00
        End Time  : 2020.07.30 14:00:00
        Type      : EXISTING
  • 运行查询并将剪辑保存到文件。
queryToFile(qtf) 基于查询表达式对象查询群集,并将 C-Clip ID 存储在指定文件中。我们可以选择设置要返回的最大 C-Clip ID 数。

语法: qtf clips
For example: 

CASScript>qtf cliplist_30Jul2020

Performing clip query

Query Expression Properties:
        Start Time: 2020.07.29 00:00:00
        End Time  : 2020.07.30 14:00:00
        Type      : EXISTING


Number of clips returned:     50
All results returned:         True
Query results written to:     cliplist_30Jul2020


CASScript>
  • 仅获取要返回的特定数量的剪辑,然后使用以下选项
语法:queryToFile fileName maxClipIDsToReturn
For example:

CASScript>qtf cliplist_30Jul2020_limited 25

Performing clip query

Query Expression Properties:
        Start Time: 2020.07.29 00:00:00
        End Time  : 2020.07.30 14:00:00"querySetUpperBound "2020.07.30 14:00:00
        Type      : EXISTING


Number of clips returned:     25
All results returned:         False
Point of incompletion:        2020.07.30 01:20:45 GMT
Query results written to:     cliplist_30Jul2020_limited

CASScript>
  • 验证返回的剪辑数量。
Exit from JCASScript

CASScript>exit

ecsnode1:/opt/storageos/tools/castools # wc -l cliplist_30Jul2020_limited
25 cliplist_30Jul2020_limited
ecsnode1:/opt/storageos/tools/castools #

ecsnode1:/opt/storageos/tools/castools # wc -l cliplist_30Jul2020
50 cliplist_30Jul2020
ecsnode1:/opt/storageos/tools/castools #

Additional Information

有关 JCASScript 用法的更多详细信息,请参阅知识库文章 ECS:如何使用JCASScript.jar在 ECS 上执行基本的 CAS API作

Affected Products

Elastic Cloud Storage

Products

ECS Appliance Hardware Series, ECS Appliance Software with Encryption, ECS Appliance Software without Encryption, Elastic Cloud Storage
Article Properties
Article Number: 000020612
Article Type: How To
Last Modified: 27 Aug 2025
Version:  5
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.