Instance(实例)
所有文档

          百度MapReduce

          Instance(实例)

          查询实例列表

          如下代码可查询指定集群和实例组的实例:

          public void listInstances(BmrClient client, String clusterId, String instanceGroupId) {
              try {
                  ListInstancesResponse response = client.listInstances(clusterId, instanceGroupId);
                  for (Instance instance : response.getIntances()) {
                      System.out.println(instance.getId() + "," + instance.getPrivateIpAddress()
                              + "," + instance.getPublicIpAddress());
                  }
              } catch (BceServiceException e) {
                  System.out.println("List instance failed: " + e.getErrorMessage());
              }
          }

          请求返回的ListInstancesResponse对象包含了相关的实例对象数组List, 获取实例对象数组的方法为response.getInstances()。实例对象Instance的属性包括了内网IP、公网IP等配置信息,每个属性均有对应的getter访问器方法。

          public class Instance {
              private String id;
              private String privateIpAddress;
              private String publicIpAddress;
          }
          上一篇
          安装SDK工具包
          下一篇
          InstanceGroup(实例组)