IBM Cloud Docs
使用 ibm-lh 实用程序检索 QHMM 日志

使用 ibm-lh 实用程序检索 QHMM 日志

通过 ibm-lh 实用程序,您无需运行 SQL 查询即可检索 QHMM 日志(深入了解查询执行情况,使用户能够监控和分析性能指标)。 它可用于借助关键词轻松检索以下查询信息。

  • 基本查询信息
  • 查询失败的基本错误信息
  • 查询统计信息
  • 查询内存信息
  • 查询垃圾回收信息
  • 最高耗时查询

过程

  1. 安装 ibm-lh 客户端软件包。 有关信息,请参阅 安装 ibm-lh-client 软件包

  2. 使用 cert-mgmt 实用程序在 ibm-lh-client 信任存储中添加或删除 SSL 证书,以便与 Presto 引擎建立连接。

    ./cert-mgmt --op=add --host=<saas_host> --port=<port>
    
  3. 使用 ibm-lh-client 软件包实用程序建立与 watsonx.data 的连接。

    ./connect-lh --op=add --name=<your_saas_name> --host=<saas_host> --port=<port> --username=<your_username> --password=<your_password>
    

    更多信息,请参阅 建立 cconnection

  4. 使用以下命令配置 Presto 详细信息:

    ./ibm-lh config add_saas --name <your_saas_username> --crn <your_crn> --host <saas_host> --port <port> --prestohost <presto_host> --prestoport <presto_port> --username <your_username> --password <your_password>
    
  5. 选择当前实例。

    ./ibm-lh config select --current_instance <your_saas_username>
    
  6. 使用 ibm-lh monitor qhmm 实用程序命令检索 QHMM 日志。 有关语法和不同关键字的更多信息,请参阅 ibm-lh monitor qhmm

    语法为 ./ibm-lh monitor qhmm --type <type_name> --start-time <start_time> --end-time <end_time> --user <user_id> --query-id <query_id> --query-state <query_state

参数:

    • --type <type_name>:指定查询类型(如 query_failed_info、query_basic_info、query_stats_info、query_memory_info、query_gc_info)。
    • --start-time <start_time>:以 YYYY-MM-DD HH:MM:SS (UTC) 为单位的起始时间戳。
    • --end-time <end_time>:结束时间戳(可选)。
    • --user <user_id>:与查询相关的用户 ID(可选)。
    • --query-id <query_id>:特定查询 ID(可选)。
    • --query-state <query_state>:查询状态(如完成、失败)(可选)。
  • --limit <limit_value>:要返回的行数(可选)。
    • --order:排序列的名称(可选)。

查询示例,用于检索所有已执行查询的基本信息:

./ibm-lh monitor qhmm --type query_basic_info --start-time "2023-10-01 00:00:00" --end-time "2023-10-08 23:59:59" --user "user123"

该命令可获取 user123 在 2023 年 10 月 1st 日至 10 月 8th期间执行的查询的基本信息。