public class

IdealStateResource

extends ServerResource
java.lang.Object
   ↳ org.restlet.resource.Resource
     ↳ org.restlet.resource.ServerResource
       ↳ org.apache.helix.webapp.resources.IdealStateResource

Class Overview

Class for server-side resource at "/clusters/{clusterName}/resourceGroups/{resourceName}/idealState"

  • GET get ideal state
  • POST set ideal state

  • Summary

    Public Constructors
    IdealStateResource()
    Public Methods
    Representation get()
    Get ideal state

    Usage: curl http://{host:port}/clusters/{clusterName}/resourceGroups/{resourceName}/idealState

    Representation post(Representation entity)
    Set ideal state

    Usage:

  • Add ideal state: curl -d @'{newIdealState.json}' -H 'Content-Type: application/json' http://{host:port}/clusters/{cluster}/resourceGroups/{resource}/idealState
     newIdealState:
     jsonParameters={"command":"addIdealState"}&newIdealState={
      "id" : "{MyDB}",
      "simpleFields" : {
        "IDEAL_STATE_MODE" : "AUTO",
        "NUM_PARTITIONS" : "{8}",
        "REBALANCE_MODE" : "SEMI_AUTO",
        "REPLICAS" : "0",
        "STATE_MODEL_DEF_REF" : "MasterSlave",
        "STATE_MODEL_FACTORY_NAME" : "DEFAULT"
      },
      "listFields" : {
      },
      "mapFields" : {
        "{MyDB_0}" : {
          "{localhost_1001}" : "MASTER",
          "{localhost_1002}" : "SLAVE"
        }
      }
     }
     
  • Rebalance cluster: curl -d 'jsonParameters={"command":"rebalance","replicas":"{3}"}' -H "Content-Type: application/json" http://{host:port}/clusters/{cluster}/resourceGroups/{resource}/idealState
  • Expand resource: n/a
  • Add resource property: curl -d 'jsonParameters={"command":"addResourceProperty","{REBALANCE_TIMER_PERIOD}":"{500}"}' -H "Content-Type: application/json" http://{host:port}/clusters/{cluster}/resourceGroups/{resource}/idealState
  • [Expand]
    Inherited Methods
    From class org.restlet.resource.ServerResource
    From class org.restlet.resource.Resource
    From class java.lang.Object

    Public Constructors

    public IdealStateResource ()

    Public Methods

    public Representation get ()

    Get ideal state

    Usage: curl http://{host:port}/clusters/{clusterName}/resourceGroups/{resourceName}/idealState

    public Representation post (Representation entity)

    Set ideal state

    Usage:

  • Add ideal state: curl -d @'{newIdealState.json}' -H 'Content-Type: application/json' http://{host:port}/clusters/{cluster}/resourceGroups/{resource}/idealState
     newIdealState:
     jsonParameters={"command":"addIdealState"}&newIdealState={
      "id" : "{MyDB}",
      "simpleFields" : {
        "IDEAL_STATE_MODE" : "AUTO",
        "NUM_PARTITIONS" : "{8}",
        "REBALANCE_MODE" : "SEMI_AUTO",
        "REPLICAS" : "0",
        "STATE_MODEL_DEF_REF" : "MasterSlave",
        "STATE_MODEL_FACTORY_NAME" : "DEFAULT"
      },
      "listFields" : {
      },
      "mapFields" : {
        "{MyDB_0}" : {
          "{localhost_1001}" : "MASTER",
          "{localhost_1002}" : "SLAVE"
        }
      }
     }
     
  • Rebalance cluster: curl -d 'jsonParameters={"command":"rebalance","replicas":"{3}"}' -H "Content-Type: application/json" http://{host:port}/clusters/{cluster}/resourceGroups/{resource}/idealState
  • Expand resource: n/a
  • Add resource property: curl -d 'jsonParameters={"command":"addResourceProperty","{REBALANCE_TIMER_PERIOD}":"{500}"}' -H "Content-Type: application/json" http://{host:port}/clusters/{cluster}/resourceGroups/{resource}/idealState