SHOW SERVICE INSTANCES IN SERVICE

列出 服务 的实例。

命令输出通过显示每个服务实例的状态,能够清晰地呈现自动扩展和滚动升级的情况。

另请参阅:

Snowpark Container Services 概述CREATE SERVICESHOW SERVICESSHOW SERVICE CONTAINERS IN SERVICE

语法

SHOW SERVICE INSTANCES IN SERVICE <name>
Copy

参数

name

指定要列出其实例的服务的标识符。

不支持带引号的特殊字符名称或区分大小写的名称。

输出

命令输出在以下列中提供服务实例的属性和元数据:

描述

database_name

在其中创建服务的数据库。

schema_name

在其中创建服务的架构。

service_name

服务的名称。

service_status

以下各值之一,表示服务的当前状态:

  • PENDING

  • RUNNING

  • FAILED

  • DONE

  • SUSPENDING

  • SUSPENDED

  • DELETING

  • DELETED

  • INTERNAL_ERROR

请注意,此列中的值与 DESCRIBE SERVICE 输出中的 status 列相同。

instance_id

服务实例的 ID(这是从 0 开始的服务实例索引)。

status

以下各值表示服务实例的不同当前状态:

  • PENDING:服务实例目前正在部署中,尚未准备好为请求提供服务。

  • READY:服务实例中的所有容器都已就绪;服务实例已准备好为请求提供服务。

  • FAILED:服务实例中至少有一个容器因故障退出。

  • TERMINATING:服务实例正在终止,将在该过程结束后移除。

  • SUCCEEDED:该服务是一项作业服务,服务实例中的所有容器都已成功终止。

spec_digest

代表服务规范内容的唯一且不可变的标识符。

creation_time

Snowflake 开始创建服务实例的时间。

start_time

Snowflake 确认服务实例在节点上运行的时间。

ip_address

服务实例的 IP 地址。同一服务(或其他服务)的其他实例可以使用此 IP 地址来连接到特定的服务实例。

运行多个服务实例时,您可以通过以下方式在服务实例中实施 Leader 选举:instance_id 0 的实例作为 Leader。

访问控制要求

用于执行此操作的 角色 必须至少具有以下 权限

权限

对象

备注

以下任何一项权限:OWNERSHIP 或 MONITOR

服务

The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema. Note that a role granted any privilege on a schema allows that role to resolve the schema. For example, a role granted CREATE privilege on a schema can create objects on that schema without also having USAGE granted on that schema.

有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色

有关对 安全对象 执行 SQL 操作的相应角色和权限授予的一般信息,请参阅 访问控制概述

使用说明

  • 该命令不需要正在运行的仓库即可执行。

  • 该命令仅返回当前用户的当前角色已获授至少一项访问权限的对象。

  • MANAGE GRANTS 访问权限隐式允许其持有者查看账户中的每个对象。默认情况下,只有账户管理员(具有 ACCOUNTADMIN 角色的用户)和安全管理员(具有 SECURITYADMIN 角色的用户)才具有 MANAGE GRANTS 权限。

  • To post-process the output of this command, you can use the pipe operator (->>) or the RESULT_SCAN function. Both constructs treat the output as a result set that you can query.

    The output column names for this command are generated in lowercase. If you consume a result set from this command with the pipe operator or the RESULT_SCAN function, use double-quoted identifiers for the column names in the query to ensure that they match the column names in the output that was scanned. For example, if the name of an output column is type, then specify "type" for the identifier.

  • 该命令 最多 返回指定对象类型的 1 万条记录,由用于执行命令的角色的访问权限决定。即使应用了筛选器,也不会返回任何超过 1 万条限制的记录。

    要查看存在超过 1 万条记录的结果,请在 Snowflake Information Schema 中查询相应的视图(如果存在)。

示例

以下示例列出了会话的当前数据库和架构中的 echo_service 服务:

SHOW SERVICE INSTANCES IN SERVICE echo_service;
Copy

示例输出:

+---------------+-------------+--------------+----------------+-------------+--------+------------------------------------------------------------------+----------------------+----------------------+------------+
| database_name | schema_name | service_name | service_status | instance_id | status | spec_digest                                                      | creation_time        | start_time           | ip_address |
|---------------+-------------+--------------+----------------+-------------+--------+------------------------------------------------------------------+----------------------+----------------------+------------|
| TUTORIAL_DB   | DATA_SCHEMA | ECHO_SERVICE | RUNNING        | 0           | READY  | 2831c241b8d64104fbc562d60764d7abd28602c70b6a8357341e8c8210b79da4 | 2025-04-25T06:01:32Z | 2025-04-25T06:01:32Z | 10.244.0.9 |
+---------------+-------------+--------------+----------------+-------------+--------+------------------------------------------------------------------+----------------------+----------------------+------------+
语言: 中文