Created
April 2, 2013 19:45
-
-
Save ahgittin/5295547 to your computer and use it in GitHub Desktop.
experimenting with syntax for creating MapR clusters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NewMapRSyntaxPlaying { | |
{ | |
// 0.5.0-rc.1 | |
// option 1 -- clusters with spec | |
// core = addChild(cluster( | |
// spec(MapRNode.class). | |
// roles(ZOOKEEPER, CLDB)). | |
// initialSize(4)); | |
// | |
// transient1 = addChild(cluster( | |
// spec(MapRNode.class). | |
// roles(JOBTRACKER, ...)). | |
// initialSize(10)); | |
// | |
// transient2 = addChild(cluster( | |
// spec(MapRNode.class). | |
// roles(JOBTRACKER, ...)). | |
// initialSize(10)); | |
// option 2 -- declarative API after the fact (in memory) | |
nodes = createMaprNodes(10); | |
nodes.applyRoleTo(ZOOKEEPER, nodes[0], nodes[1], nodes[2]); | |
nodes.applyRolesTo( [ FILESERVER, TASKTRACKER, HBASE_REGION_SERVER] , nodes[0], nodes[1], nodes[2]); | |
nodes.specifySpindleCount(2, nodes[0]) | |
// option 3 | |
MapRSoftwareSpec softwareSpec1 = MapRSoftwareSpec.builder().XXX(); | |
// MapRNodeSpec type1 = new MaprNodeSpec(softwareSpec1, hardwareSpec1); | |
// MapRNodeSpec type2 = new Spec(); | |
// MapRNodeSpec type3 = new Spec(); | |
type1.setRoles(ZOOKEEPER, TASKTRACKER); | |
type2.setRoles(...); | |
type2.setProvisioningFlag("minRam", 4096); | |
type2.setSpindleCount(); | |
// type2.setJavaFlavor(ORACLE_JDK, JavaVersion.V1_7); | |
type2.getJavaFrom("http://myrepo/oracle_17.rpm"); | |
addNodes(5, softwareSpec1, hardwareSpec1); | |
addNodes(5, type2); | |
// OR this allows: | |
addNodes(5, MaprSpec.builder().withRoles(XXX, XXX).spindleCount(XXX).build()); | |
start(amazon); | |
// flexible clusters | |
addCluster(name: "default elasticity group", type2, initialSize: 5); | |
// where MapRNodeSet.addNodeWithSpec(String) | |
// effectors | |
node.addRole(ZOOKEEPER) | |
node.removeRole(ZOOKEEPER) | |
// would _not_ reconfigure | |
// then: | |
cluster.applyPlan(PLAN); | |
// where PLAN might be making 3 nodes zookeeper, 2 nodes jobtracker, etc.... | |
// OR simpler than plan | |
cluster.reconfigure() | |
// the policies have a mutex so only one applies changes at a given time | |
// AND the policy runs the addRole and then the reconfigure | |
// policies | |
addPolicy(MaintainMinimumCount(1).preferringXXX()); | |
addPolicy(MaintainMinimumCount(3).preferringXXX()); | |
addPolicy(MaintainMinimumCount(3, ZOOKEEPER).prefer(Predicates.notWithRole(JOBTRACKER))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment