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?
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!
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:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.