集群CLI

通过将Databricks集群的CLI子命令追加到集群.这些子命令调用集群API 2.0

数据库集群-h
用法:databricks clusters [OPTIONS] COMMAND [ARGS]…与Databricks集群交互的实用程序。选项:-v,——version [version] -h,——help显示此信息并退出。命令:create创建Databricks集群。选项:——JSON - File PATH POST到/api/2.0/clusters/create的JSON请求文件。POST到/api/2.0/clusters/create的json字符串。delete删除Databricks集群。选项:——cluster-id CLUSTER_ID可以在https://< databics -instance>/?o=<16-digit-number>#/setting/clusters/$CLUSTER_ID/configuration中找到。edit编辑Databricks集群。选项:——JSON - File PATH POST到/api/2.0/clusters/edit的JSON请求文件。 --json JSON JSON string to POST to /api/2.0/clusters/edit. events Gets events for a Spark cluster. Options: --cluster-id CLUSTER_ID Can be found in the URL at https:///#/setting/clusters/$CLUSTER_ID/configuration. [required] --start-time TEXT The start time in epoch milliseconds. If unprovided, returns events starting from the beginning of time. --end-time TEXT The end time in epoch milliseconds. If unprovided, returns events up to the current time --order TEXT The order to list events in; either ASC or DESC. Defaults to DESC (most recent first). --event-type TEXT An event types to filter on (specify multiple event types by passing the --event-type option multiple times). If empty, all event types are returned. --offset TEXT The offset in the result set. Defaults to 0 (no offset). When an offset is specified and the results are requested in descending order, the end_time field is required. --limit TEXT The maximum number of events to include in a page of events. Defaults to 50, and maximum allowed value is 500. --output FORMAT can be "JSON" or "TABLE". Set to TABLE by default. get Retrieves metadata about a cluster. Options: --cluster-id CLUSTER_ID Can be found in the URL at https:///?o=<16-digit-number>#/setting/clusters/$CLUSTER_ID/configuration. list Lists active and recently terminated clusters. Options: --output FORMAT JSON or TABLE. Set to TABLE by default. list-node-types Lists node types for a cluster. list-zones Lists zones where clusters can be created. permanent-delete Permanently deletes a cluster. Options: --cluster-id CLUSTER_ID Can be found in the URL at https:///?o=<16-digit-number>#/setting/clusters/$CLUSTER_ID/configuration. resize Resizes a Databricks cluster given its ID. Options: --cluster-id CLUSTER_ID Can be found in the URL at https:///?o=<16-digit-number>#/setting/clusters/$CLUSTER_ID/configuration. --num-workers INTEGER Number of workers. [required] restart Restarts a Databricks cluster. Options: --cluster-id CLUSTER_ID Can be found in the URL at https:///?o=<16-digit-number>#/setting/clusters/$CLUSTER_ID/configuration. spark-versions Lists possible Databricks Runtime versions. start Starts a terminated Databricks cluster. Options: --cluster-id CLUSTER_ID Can be found in the URL at https:///?o=<16-digit-number>#/setting/clusters/$CLUSTER_ID/configuration.

创建集群

要显示使用文档,请运行集群创建——帮助

数据集群创建——json-file create-cluster.json

create-cluster.json

“cluster_name”“my-cluster”“spark_version”“7.3.x-scala2.12”“node_type_id”“i3.xlarge”“spark_conf”“spark.speculation”真正的},“aws_attributes”“可用性”“现货”“zone_id”“us-west-2a”},“num_workers”25
“cluster_id”:“1234 - 567890 batch123”

删除集群

要显示使用文档,请运行集群删除——帮助

数据库集群删除——cluster-id1234567890 - batch123

如果成功,则无输出。

更改集群配置

要显示使用文档,请运行集群编辑——帮助

数据库集群编辑——json-file edit-cluster.json

edit-cluster.json

“cluster_id”“1234 - 567890 batch123”“num_workers”10“spark_version”“7.3.x-scala2.12”“node_type_id”“i3.xlarge”

如果成功,则无输出。

列出集群的事件

要显示使用文档,请运行集群事件——帮助

数据集群事件——cluster-id1234567890 - batch123——启动时间1617238800000——世界末日1619485200000——订单DESC——限制5——事件类型的运行——JSON输出|金桥。
“事件”:[“cluster_id”:“1234 - 567890 batch123”,“时间戳”:1619214150232,“类型”:“运行”,"详细信息":{“current_num_workers”:2“target_num_workers”:2},...“cluster_id”:“1234 - 567890 batch123”,“时间戳”:1617895221986,“类型”:“运行”,"详细信息":{“current_num_workers”:2“target_num_workers”:2)," next_page ": {“cluster_id”:“1234 - 567890 batch123”,“start_time”:1617238800000,“end_time”:1619485200000,“订单”:“DESC”,“event_types”:(“运行”),“抵消”:5“限制”:5},“total_count”:11

获取集群信息

要显示使用文档,请运行集群得到——帮助

数据库集群获取——cluster-id1234567890 - batch123

或者:

数据库集群获取——cluster-name my-cluster
“cluster_id”:“1234 - 567890 batch123”,“spark_context_id”:8232037838300762810,:“cluster_name my-cluster”,:“spark_version 8.1.x-scala2.12”," aws_attributes ": {:“zone_id us-west-2c”,“first_on_demand”:1、“可用性”:“SPOT_WITH_FALLBACK”,“spot_bid_price_percent”:100年,“ebs_volume_count”:0},:“node_type_id i3.xlarge”,:“driver_node_type_id i3.xlarge”,“autotermination_minutes”:120年,“enable_elastic_disk”:假的," disk_spec ": {“disk_count”:0},“cluster_source”:“用户界面”,“enable_local_disk_encryption”:假的," instance_source ": {:“node_type_id i3.xlarge”}," driver_instance_source ": {:“node_type_id i3.xlarge”},“状态”:“终止”,"state_message": "非活动集群已终止(非活动120分钟).",“start_time”:1616773202562,“terminated_time”:1619228528317,“last_state_loss_time”:1619214150116,"自动定量":{“min_workers”:2“max_workers”:8}," default_tags ": {“供应商”:“砖”,“创造者”:“someone@example.com”,:“ClusterName my-cluster”,“ClusterId”:“1234 - 567890 batch123”},“creator_user_name”:“somone@example.com”," termination_reason ": {“代码”:“不活跃”,“参数”:{“inactivity_duration_min”:“120”},“类型”:“成功”},“init_scripts_safe_mode”:假的

列出所有可用集群的信息

要显示使用文档,请运行集群列表——帮助

数据库集群列表——输出JSON|金桥。
“集群”:(“cluster_id”:“1234 - 567890 batch123”,“spark_context_id”:8232037838300762810,:“cluster_name my-cluster”,:“spark_version 8.1.x-scala2.12”," aws_attributes ": {:“zone_id us-west-2c”,“first_on_demand”:1、“可用性”:“SPOT_WITH_FALLBACK”,“spot_bid_price_percent”:100年,“ebs_volume_count”:0},:“node_type_id i3.xlarge”,:“driver_node_type_id i3.xlarge”,“autotermination_minutes”:120年,“enable_elastic_disk”:假的," disk_spec ": {“disk_count”:0},“cluster_source”:“用户界面”,“enable_local_disk_encryption”:假的," instance_source ": {:“node_type_id i3.xlarge”}," driver_instance_source ": {:“node_type_id i3.xlarge”},“状态”:“终止”,"state_message": "非活动集群已终止(非活动120分钟).",“start_time”:1616773202562,“terminated_time”:1619228528317,“last_state_loss_time”:1619214150116,"自动定量":{“min_workers”:2“max_workers”:8}," default_tags ": {“供应商”:“砖”,“创造者”:“someone@example.com”,:“ClusterName my-cluster”,“ClusterId”:“1234 - 567890 batch123”},“creator_user_name”:“somone@example.com”," termination_reason ": {“代码”:“不活跃”,“参数”:{“inactivity_duration_min”:“120”},“类型”:“成功”},“init_scripts_safe_mode”:假的},...

列出可用的集群节点类型

要显示使用文档,请运行集群list-node-types——帮助

数据库集群列表-节点类型
“node_type”:(:“node_type_id z1d.12xlarge”,“memory_mb”:393216年,“num_cores”:48.0,“描述”:“z1d.12xlarge”,:“instance_type_id z1d.12xlarge”,“is_deprecated”:假的,“类别”:“内存优化”,“support_ebs_volumes”:没错,“support_cluster_tags”:没错,“num_gpus”:0," node_instance_type ": {:“instance_type_id z1d.12xlarge”,“local_disks”:2“local_disk_size_gb”:900年,"instance_family": "EC2 z1d Family vcpu ",“swap_size”:“10 g”},“is_hidden”:假的,“support_port_forwarding”:没错,“display_order”:0,“is_io_cache_enabled”:假的},...

列出可用于创建集群的可用分区

要显示使用文档,请运行集群list-zones——帮助

数据库集群列表区域
“区域”:(“us-west-2c”,“us-west-2a”,“us-west-2b”),:“default_zone us-west-2c”

永久删除集群

要显示使用文档,请运行集群permanent-delete——帮助

数据库集群永久删除——cluster-id1234567890 - batch123

如果成功,则无输出。

调整集群大小

要显示使用文档,请运行集群调整——帮助

数据库集群调整大小——cluster-id1234567890 - batch123——num-workers10

如果成功,则无输出。

重新启动集群

要显示使用文档,请运行集群重新启动——帮助

数据库集群重启——cluster-id1234567890 - batch123

如果成功,则无输出。

列出可用的Spark运行时版本

要显示使用文档,请运行集群spark-versions——帮助

数据库集群spark-versions
“版本”:(“关键”:“8.2.x-scala2.12”,"name": "8.2(包括Apache Spark 3.1.1, Scala 2.12)"},...

启动集群

要显示使用文档,请运行集群开始——帮助

数据库集群启动——cluster-id1234567890 - batch123

如果成功,则无输出。