您可以使用ecluster命令方便地管理资源的生命周期、查看运行过程的日志等操作。

ecluster命令

ecluster支持的命令如下表所示。
命令 命令说明 命令示例
export 获取阿里云账号的信息,在本地机器使用FastGPU时需要获取AccessKey、默认地域、默认可用区等信息。
  • export ALIYUN_ACCESS_KEY_ID=L****
  • export ALIYUN_ACCESS_KEY_SECRET=v****
  • export ALIYUN_DEFAULT_REGION=cn-hangzhou
  • export ALIYUN_DEFAULT_ZONE=cn-hangzhou-i
ecluster [help,-h,--help] 查看所有ecluster命令。 ecluster --help
ecluster {command} --help 查看指定的ecluser命令。 ecluster ls --help
ecluster create --config create.cfg 基于配置文件创建实例。create.cfg文件定义实例的配置环境,运行命令前您需要先创建create.cfg文件。更多信息,请参见创建配置文件示例 ecluster create --config create.cfg
ecluster create --name {instance_name} --machines {instance_num} ... 基于参数创建实例。 ecluster create --name task0.ncluster-v100 --machines 1
ecluster ls 列出已自动创建的实例。包括以下信息:
  • name:实例名称。
  • hours_live:实例创建至今的时间,以小时为单位。
  • instance_type:实例规格。
  • public_ip:实例的公网IP。
  • key/owner:密钥对和账号名。
  • private_ip:实例的内网。
  • instance_id:实例的id。
ecluster ls
ecluster ssh {instance_name} 登录指定的实例。 ecluster ssh task0.ncluster-v100
ecluster tmux {instance_name} 连接到运行中的实例,如果没有tmux会话,则使用ssh连接。 ecluster tmux task0.ncluster-v100
ecluster stop {instance_name} 停止指定的实例。
  • 停止task0对应的实例:ecluster stop task0.ncluster-v100
  • 停止一组实例:ecluster stop {ncluster-v100}
ecluster start {instance_name} 启动指定的实例。
  • 启动task0对应的实例:ecluster start task0.ncluster-v100
  • 启动一组实例:ecluster start {ncluster-v100}
ecluster kill {instance_name} 释放指定的实例。
  • 释放task0对应的实例:ecluster kill task0.ncluster-v100
  • 释放一组实例:ecluster kill {ncluster-v100}
ecluster mount {instance_name} 为指定的实例挂载NAS文件系统到/ncluster目录。 ecluster mount task0.ncluster-v100
ecluster scp {source} {destination} 安全拷贝文件或目录。 ecluster scp /local/path/to/upload task0.ncluster-v100:/remote/path/to/save
ecluster addip {instance_name} 将指定任务中实例的固定公网IP添加到安全组。 ecluster addip task0.ncluster-v100
ecluster rename {old_name} {new_name} 重命名指定实例。 ecluster rename task0.ncluster-v100 task1.ncluster-v100

创建配置文件示例

基于配置文件创建实例时,您可以参考以下内容新建配置文件。
; config.ini

[ncluster]
; The job name for current creation job.
name=ncluster-v100
; The number of machine you want to create
machines=1
; The system disk size for instances in GB
system_disk_size=300
; The data disk size for instances in GB
data_disk_size=0
; The system image name you want to installed in the instances.
image_name=ubuntu_18_04_64_20G_alibase_20190624.vhd
; The instance type you want to create at Alibaba Cloud.
instance_type=ecs.gn6v-c10g1.20xlarge
; The spot instance option; If you want to buy spot instance, please set it to True.
spot=False
; If only used to create instances, it can set to True.
confirm_cost=False
; Confirm the next operation will cost money, if set to True will default confirmed.
skip_setup=True
; Nas create/mount options; Set True will disable nas mount for current job.
disable_nas=True
; The zone id info. The option provided to use resource in the zone.
zone_id=cn-hangzhou-i
; Specify the vpc name
vpc_name=ncluster-vpc

[cmd]
install_script=pwd