Question

Automate the scaling out of Hadoop

I would like some advice on scaling out a Hadoop cluster, I have created 3 droplets and everything works fine.

I think I can automate the creating of the droplets using the API and I can script some of the Hadoop configuration required but I cannot see a way to resolve the IP address of newly created droplets.

can we set the private IP address when we create the droplet or can we find out what the IP addresses it was set to once created?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

When creating a new Droplet, the IP addresses are not assigned until after it has been provisioned. So they are not included in the initial response from the API. Though you can retrieve them programmatically. The JSON response to the create API call will provide a “links” object that can be used to check on the status of the create event. For example, it might look like:

{
  "droplet": {
    "id": 3164494,
    "name": "example.com",
    "memory": 512,
    "vcpus": 1,
    "disk": 20,
    "locked": true,
    "status": "new",
    "kernel": {
      "id": 2233,
      "name": "Ubuntu 14.04 x64 vmlinuz-3.13.0-37-generic",
      "version": "3.13.0-37-generic"
    },
    "created_at": "2014-11-14T16:36:31Z",
    "features": [
      "virtio"
    ],
    "backup_ids": [

    ],
    "snapshot_ids": [

    ],
    "image": {
    },
    "size": {
    },
    "size_slug": "512mb",
    "networks": {
    },
    "region": {
    },
    "tags": [

    ]
  },
  "links": {
    "actions": [
      {
        "id": 36805096,
        "rel": "create",
        "href": "https://api.digitalocean.com/v2/actions/36805096"
      }
    ]
  }
}

The link to the action object (in this case https://api.digitalocean.com/v2/actions/36805096) can then be called to see if the even is completed. Just check for the status field in the reply:

{
  "action": {
    "id": 36804636,
    "status": "completed",
    "type": "create",
    "started_at": "2014-11-14T16:29:21Z",
    "completed_at": "2014-11-14T16:30:06Z",
    "resource_id": 3164444,
    "resource_type": "droplet",
    "region": "nyc3",
    "region_slug": "nyc3"
  }
}

Once the status reports completed rather than in-progress, you can retrieve the IP addresses by querying the Droplet’s API endpoint.

You can find out more about using the actions endpoint and see a full example in this tutorial: