Search code examples
rackspace-cloudrackspacejclouds

jclouds and rackspace clouddb private ip address to create loadbalancer


I was able to create a mysql instance and got the host name . Now trying to create a loadbalancer using the jclouds rackspace api but fails on validation with hostname in builder. I am passing in the hostname in the place of ip address. How do I get private ip address of the clouddb instance i created on rackspace using jclouds ? How do I create a Load Balancer using jclouds using clouddb host name ?

Here is my code that fails :

org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;

    AddNode addNode = AddNode.builder()
            .address(hostName)
            .condition(ENABLED)
            .port(3306)
            .weight(20)
            .build();

Any help would be appreciated.


Solution

  • This example should demonstrate how to use clouddb with loadbalancers:

    https://github.com/jclouds/jclouds-examples/blob/master/rackspace/src/main/java/org/jclouds/examples/rackspace/clouddatabases/TestDatabase.java

    The part you might be interested in is

    AddNode addNode01 = AddNode.builder()
          .address(getInstance().getHostname())
          .condition(Node.Condition.ENABLED)
          .port(3306)
          .build();