Permalink
Browse files

Auto-add-server nodes to cluster

  • Loading branch information...
1 parent 9551db3 commit e3151f1a02649ac8132e8f1bc4cb5488aa52ef31 @steveyen steveyen committed Jul 15, 2011
Showing with 3,369 additions and 602 deletions.
  1. +33 −20 membase.erb
  2. +28 −20 packs/1-pack-membase
  3. +172 −38 packs/10-pack-membase
  4. +1,612 −218 packs/100-pack-membase
  5. +44 −22 packs/2-pack-membase
  6. +332 −58 packs/20-pack-membase
  7. +60 −24 packs/3-pack-membase
  8. +76 −26 packs/4-pack-membase
  9. +92 −28 packs/5-pack-membase
  10. +812 −118 packs/50-pack-membase
  11. +108 −30 packs/6-pack-membase
View
@@ -74,26 +74,39 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
- <% if i == 0 %>
- ,
- "/opt/membase/bin/membase cluster-init -c 127.0.0.1",
- " --cluster-init-username=Administrator",
- " --cluster-init-password=", { "Ref" : "RESTPassword" },
- " --cluster-init-ramsize=", { "Ref" : "RAMPerServer" },"\n",
- "/opt/membase/bin/membase bucket-create -c 127.0.0.1",
- " -u Administrator -p ", { "Ref" : "RESTPassword" },
- " --bucket=default",
- " --bucket-type=membase",
- " --bucket-password=",
- " --bucket-ramsize=", { "Ref" : "RAMForDefaultBucket" },
- " --bucket-replica=1","\n",
- "curl -X PUT -H 'Content-Type:' --data-binary '{\"Status\" : \"SUCCESS\",",
- "\"Reason\" : \"Membase0 node is ready\",",
- "\"UniqueId\" : \"membase\",",
- "\"Data\" : \"Done\"}' ",
- "\"", {"Ref" : "WaitForMembase0WaitHandle"}, "\"\n"
- <% end %>
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+ <% if i == 0 %>
+ " /opt/membase/bin/membase cluster-init -c 127.0.0.1",
+ " --cluster-init-username=Administrator",
+ " --cluster-init-password=", { "Ref" : "RESTPassword" },
+ " --cluster-init-ramsize=", { "Ref" : "RAMPerServer" },"\n",
+ " /opt/membase/bin/membase bucket-create -c 127.0.0.1",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " --bucket=default",
+ " --bucket-type=membase",
+ " --bucket-password=",
+ " --bucket-ramsize=", { "Ref" : "RAMForDefaultBucket" },
+ " --bucket-replica=1","\n",
+ " curl -X PUT -H 'Content-Type:' --data-binary '{\"Status\" : \"SUCCESS\",",
+ "\"Reason\" : \"Membase0 node is ready\",",
+ "\"UniqueId\" : \"membase\",",
+ "\"Data\" : \"Done\"}' ",
+ "\"", {"Ref" : "WaitForMembase0WaitHandle"}, "\"\n",
+ <% else %>
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+ <% end %>
+ "fi","\n"
]]}}
}
<% if i > 0 %>
View
@@ -74,26 +74,34 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
- ,
- "/opt/membase/bin/membase cluster-init -c 127.0.0.1",
- " --cluster-init-username=Administrator",
- " --cluster-init-password=", { "Ref" : "RESTPassword" },
- " --cluster-init-ramsize=", { "Ref" : "RAMPerServer" },"\n",
- "/opt/membase/bin/membase bucket-create -c 127.0.0.1",
- " -u Administrator -p ", { "Ref" : "RESTPassword" },
- " --bucket=default",
- " --bucket-type=membase",
- " --bucket-password=",
- " --bucket-ramsize=", { "Ref" : "RAMForDefaultBucket" },
- " --bucket-replica=1","\n",
- "curl -X PUT -H 'Content-Type:' --data-binary '{\"Status\" : \"SUCCESS\",",
- "\"Reason\" : \"Membase0 node is ready\",",
- "\"UniqueId\" : \"membase\",",
- "\"Data\" : \"Done\"}' ",
- "\"", {"Ref" : "WaitForMembase0WaitHandle"}, "\"\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase cluster-init -c 127.0.0.1",
+ " --cluster-init-username=Administrator",
+ " --cluster-init-password=", { "Ref" : "RESTPassword" },
+ " --cluster-init-ramsize=", { "Ref" : "RAMPerServer" },"\n",
+ " /opt/membase/bin/membase bucket-create -c 127.0.0.1",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " --bucket=default",
+ " --bucket-type=membase",
+ " --bucket-password=",
+ " --bucket-ramsize=", { "Ref" : "RAMForDefaultBucket" },
+ " --bucket-replica=1","\n",
+ " curl -X PUT -H 'Content-Type:' --data-binary '{\"Status\" : \"SUCCESS\",",
+ "\"Reason\" : \"Membase0 node is ready\",",
+ "\"UniqueId\" : \"membase\",",
+ "\"Data\" : \"Done\"}' ",
+ "\"", {"Ref" : "WaitForMembase0WaitHandle"}, "\"\n",
+
+ "fi","\n"
]]}}
}
View
@@ -74,26 +74,34 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
- ,
- "/opt/membase/bin/membase cluster-init -c 127.0.0.1",
- " --cluster-init-username=Administrator",
- " --cluster-init-password=", { "Ref" : "RESTPassword" },
- " --cluster-init-ramsize=", { "Ref" : "RAMPerServer" },"\n",
- "/opt/membase/bin/membase bucket-create -c 127.0.0.1",
- " -u Administrator -p ", { "Ref" : "RESTPassword" },
- " --bucket=default",
- " --bucket-type=membase",
- " --bucket-password=",
- " --bucket-ramsize=", { "Ref" : "RAMForDefaultBucket" },
- " --bucket-replica=1","\n",
- "curl -X PUT -H 'Content-Type:' --data-binary '{\"Status\" : \"SUCCESS\",",
- "\"Reason\" : \"Membase0 node is ready\",",
- "\"UniqueId\" : \"membase\",",
- "\"Data\" : \"Done\"}' ",
- "\"", {"Ref" : "WaitForMembase0WaitHandle"}, "\"\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase cluster-init -c 127.0.0.1",
+ " --cluster-init-username=Administrator",
+ " --cluster-init-password=", { "Ref" : "RESTPassword" },
+ " --cluster-init-ramsize=", { "Ref" : "RAMPerServer" },"\n",
+ " /opt/membase/bin/membase bucket-create -c 127.0.0.1",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " --bucket=default",
+ " --bucket-type=membase",
+ " --bucket-password=",
+ " --bucket-ramsize=", { "Ref" : "RAMForDefaultBucket" },
+ " --bucket-replica=1","\n",
+ " curl -X PUT -H 'Content-Type:' --data-binary '{\"Status\" : \"SUCCESS\",",
+ "\"Reason\" : \"Membase0 node is ready\",",
+ "\"UniqueId\" : \"membase\",",
+ "\"Data\" : \"Done\"}' ",
+ "\"", {"Ref" : "WaitForMembase0WaitHandle"}, "\"\n",
+
+ "fi","\n"
]]}}
}
@@ -121,8 +129,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -153,8 +175,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -185,8 +221,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -217,8 +267,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -249,8 +313,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -281,8 +359,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -313,8 +405,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -345,8 +451,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
@@ -377,8 +497,22 @@
"yum -y install openssl098e","\n",
"wget ", { "Ref" : "MembasePackageURL" },"\n",
"rpm -i membase-server-community*.rpm","\n",
- "sleep 5","\n"
-
+ "sleep 5","\n",
+ "if [ \"host:port\" != \"", { "Ref" : "ExistingClusterHostPort" }, "\" ]; then","\n",
+ " echo Existing membase cluster...","\n",
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Ref" : "ExistingClusterHostPort" },
+ " --server-add=`hostname -i`:8091","\n",
+ "else","\n",
+ " echo New membase cluster...","\n",
+
+ " /opt/membase/bin/membase server-add",
+ " -u Administrator -p ", { "Ref" : "RESTPassword" },
+ " -c ", { "Fn::GetAtt" : [ "Membase0", "PublicIp" ] },
+ " --server-add=`hostname -i`:8091","\n",
+
+ "fi","\n"
]]}}
}
Oops, something went wrong.

0 comments on commit e3151f1

Please sign in to comment.