mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'sharding' of https://github.com/triAGENS/ArangoDB into sharding
This commit is contained in:
commit
b79313e697
|
@ -61,6 +61,56 @@
|
|||
k.runInfo = config.runInfo;
|
||||
return k;
|
||||
},
|
||||
startUp = function(req, res) {
|
||||
cleanUp();
|
||||
var config = {},
|
||||
input = req.body(),
|
||||
result = {},
|
||||
starter,
|
||||
i,
|
||||
tmp,
|
||||
planner;
|
||||
|
||||
if (input.type === "testSetup") {
|
||||
config.dispatchers = {
|
||||
"d1": {
|
||||
"endpoint": "tcp://" + input.dispatcher
|
||||
}
|
||||
};
|
||||
config.numberOfDBservers = input.numberDBServers;
|
||||
config.numberOfCoordinators = input.numberCoordinators;
|
||||
} else {
|
||||
i = 0;
|
||||
config.dispatchers = {};
|
||||
config.numberOfDBservers = 0;
|
||||
config.numberOfCoordinators = 0;
|
||||
_.each(input.dispatcher, function(d) {
|
||||
i++;
|
||||
var inf = {};
|
||||
inf.endpoint = "tcp://" + d.host;
|
||||
if (d.isCoordinator) {
|
||||
config.numberOfCoordinators++;
|
||||
} else {
|
||||
inf.allowCoordinators = false;
|
||||
}
|
||||
if (d.isDBServer) {
|
||||
config.numberOfDBservers++;
|
||||
} else {
|
||||
inf.allowDBservers = false;
|
||||
}
|
||||
config.dispatchers["d" + i] = inf;
|
||||
});
|
||||
}
|
||||
require("console").log(JSON.stringify(config));
|
||||
result.config = config;
|
||||
planner = new cluster.Planner(config);
|
||||
result.plan = planner.getPlan();
|
||||
starter = new cluster.Kickstarter(planner.getPlan());
|
||||
tmp = starter.launch();
|
||||
result.runInfo = tmp.runInfo;
|
||||
plans.storeConfig(result);
|
||||
res.json(result);
|
||||
},
|
||||
cleanUp = function() {
|
||||
var k = getStarter();
|
||||
if (k) {
|
||||
|
@ -68,55 +118,8 @@
|
|||
}
|
||||
};
|
||||
// only make these functions available in dispatcher mode!
|
||||
controller.post("/plan", function(req, res) {
|
||||
cleanUp();
|
||||
var config = {},
|
||||
input = req.body(),
|
||||
result = {},
|
||||
starter,
|
||||
i,
|
||||
tmp,
|
||||
planner;
|
||||
|
||||
if (input.type === "testSetup") {
|
||||
config.dispatchers = {
|
||||
"d1": {
|
||||
"endpoint": "tcp://" + input.dispatcher
|
||||
}
|
||||
};
|
||||
config.numberOfDBservers = input.numberDBServers;
|
||||
config.numberOfCoordinators = input.numberCoordinators;
|
||||
} else {
|
||||
i = 0;
|
||||
config.dispatchers = {};
|
||||
config.numberOfDBservers = 0;
|
||||
config.numberOfCoordinators = 0;
|
||||
_.each(input.dispatcher, function(d) {
|
||||
i++;
|
||||
var inf = {};
|
||||
inf.endpoint = "tcp://" + d.host;
|
||||
if (d.isCoordinator) {
|
||||
config.numberOfCoordinators++;
|
||||
} else {
|
||||
inf.allowCoordinators = false;
|
||||
}
|
||||
if (d.isDBServer) {
|
||||
config.numberOfDBservers++;
|
||||
} else {
|
||||
inf.allowDBservers = false;
|
||||
}
|
||||
config.dispatchers["d" + i] = inf;
|
||||
});
|
||||
}
|
||||
result.config = config;
|
||||
planner = new cluster.Planner(config);
|
||||
result.plan = planner.getPlan();
|
||||
starter = new cluster.Kickstarter(planner.getPlan());
|
||||
tmp = starter.launch();
|
||||
result.runInfo = tmp.runInfo;
|
||||
plans.storeConfig(result);
|
||||
res.json(result);
|
||||
});
|
||||
controller.post("/plan", startUp);
|
||||
controller.put("/plan", startUp);
|
||||
|
||||
controller.get("/plan", function(req, res) {
|
||||
res.json(plans.loadConfig());
|
||||
|
@ -128,7 +131,13 @@
|
|||
});
|
||||
|
||||
controller.get("/healthcheck", function(req, res) {
|
||||
res.json(!getStarter().isHealthy().error);
|
||||
var out = getStarter().isHealthy();
|
||||
var stf = JSON.stringify(out);
|
||||
if (out.error || stf.indexOf("NOT-FOUND") !== -1) {
|
||||
res.json(false);
|
||||
return;
|
||||
}
|
||||
res.json(true);
|
||||
});
|
||||
|
||||
controller.get("/shutdown", function(req, res) {
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
|
||||
url: "cluster/plan",
|
||||
|
||||
isNew : function() {
|
||||
return true;
|
||||
},
|
||||
|
||||
idAttribute: "config",
|
||||
|
||||
getCoordinator: function() {
|
||||
if (this._coord) {
|
||||
|
@ -53,7 +50,6 @@
|
|||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -107,11 +107,10 @@
|
|||
if (!this.clusterDownView) {
|
||||
this.clusterDownView = new window.ClusterDownView();
|
||||
}
|
||||
this.clusterDownView.render(content);
|
||||
this.clusterDownView.render();
|
||||
},
|
||||
|
||||
dashboard: function(server) {
|
||||
console.log(server);
|
||||
if (this.statisticsDescription === undefined) {
|
||||
this.statisticsDescription = new window.StatisticsDescription();
|
||||
this.statisticsDescription.fetch({
|
||||
|
@ -121,9 +120,6 @@
|
|||
if (this.statistics === undefined) {
|
||||
this.statisticsCollection = new window.StatisticsCollection();
|
||||
}
|
||||
console.log(this.statisticsCollection);
|
||||
console.log(this.statisticsDescription);
|
||||
console.log( window.arangoDocumentsStore);
|
||||
if (this.dashboardView === undefined) {
|
||||
this.dashboardView = new dashboardView({
|
||||
collection: this.statisticsCollection,
|
||||
|
|
|
@ -7,16 +7,12 @@
|
|||
window.App = new window.ClusterRouter();
|
||||
Backbone.history.start();
|
||||
|
||||
//für zum testen
|
||||
// this.clusterPlan.set({"plan": "blub"});
|
||||
|
||||
if(window.App.clusterPlan.get("plan")) {
|
||||
if(window.App.clusterPlan.isAlive()) {
|
||||
window.App.showCluster();
|
||||
} else {
|
||||
window.App.handleClusterDown();
|
||||
}
|
||||
|
||||
} else {
|
||||
window.App.planScenario();
|
||||
}
|
||||
|
|
|
@ -24,34 +24,6 @@
|
|||
<ul class="thumbnails2">
|
||||
<div class="headerBar">
|
||||
<a class="arangoHeader">Cluster Management</a>
|
||||
<div class="headerButtonBar pull-right">
|
||||
<ul class="headerButtonList">
|
||||
<li class="enabled">
|
||||
<a id="importConnectInfo" class="headerButton">
|
||||
<span class="icon_arangodb_youtube" title="Connect to Cluster"></span>
|
||||
</a>
|
||||
<a id="importRunInfo" class="headerButton">
|
||||
<span class="icon_arangodb_export" title="Upload Cluster Information"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="runinfoDropdownImport" class="dropdownImport">
|
||||
<div class="queryline">
|
||||
<input id="importRunInfoFile" name="importRunInfo" type="file" accept="application/json" />
|
||||
<button id="confirmRunInfoImport" class="button-success btn-old-padding" style="float:right">
|
||||
<img id="uploadIndicator" style="display: none;" src="img/ajax-loader.gif"/>Import Plan
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="connectDropdownImport" class="dropdownImport">
|
||||
<div class="queryline">
|
||||
<input id="connectInfoFile" name="connectionInfo" type="file" accept="application/json" />
|
||||
<button id="confirmConnectImport" class="button-success btn-old-padding" style="float:right">
|
||||
<img id="connectIndicator" style="display: none;" src="img/ajax-loader.gif"/>Connect to Cluster
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -4,60 +4,26 @@
|
|||
<a class="arangoHeader">Plan a single server test configuration</a>
|
||||
</div>
|
||||
</ul>
|
||||
<%
|
||||
if (config) {
|
||||
dispatcher = config.dispatcher;
|
||||
hostname = dispatcher.split(':')[0];
|
||||
port = dispatcher.split(':')[1];
|
||||
numberDBServers = config.numberDBServers;
|
||||
numberCoordinators = config.numberCoordinators;
|
||||
}
|
||||
%>
|
||||
<form action="javascript:void(0);" autocomplete="on" class="form-horizontal">
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<label for="host" class="control-label">Server:</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="host" placeholder="Server" class="input-xlarge"
|
||||
<%if (config) {%>
|
||||
value="<%=hostname%>"
|
||||
<%} else {%>
|
||||
value="<%=window.location.hostname%>"
|
||||
<%}%>
|
||||
></input>
|
||||
<span class="searchEqualsLabel">:</span>
|
||||
<input type="text" maxlength="5" class="input-small" id="port" placeholder="port"
|
||||
<%if (config) {%>
|
||||
console.log("blub);
|
||||
value="<%=port%>"
|
||||
<%} else {%>
|
||||
value="<%=window.location.port%>"
|
||||
<%}%>
|
||||
></input>
|
||||
<input type="text" id="host" placeholder="Server" class="input-xlarge" value="<%=hostname%>"></input>
|
||||
<span class="searchEqualsLabel">:</span>
|
||||
<input type="text" maxlength="5" class="input-small" id="port" placeholder="port" value="<%=port%>" ></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label for="coordinators" class="control-label">Coordinators:</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="coordinators" placeholder="Number of Coordinators" class="input-xlarge"
|
||||
<%if (config) {%>
|
||||
value="<%=numberCoordinators%>"
|
||||
<%} else {%>
|
||||
value="1"
|
||||
<%}%>
|
||||
></input>
|
||||
<input type="text" id="coordinators" placeholder="Number of Coordinators" class="input-xlarge" value="<%=coords%>" ></input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label for="dbs" class="control-label">DB Servers:</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="dbs" placeholder="Number of DBServers" class="input-xlarge"
|
||||
<%if (config) {%>
|
||||
value="<%=numberDBServers%>"
|
||||
<%} else {%>
|
||||
value="2"
|
||||
<%}%>
|
||||
></input>
|
||||
<input type="text" id="dbs" placeholder="Number of DBServers" class="input-xlarge" value="<%=dbs%>"></input>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -16,72 +16,37 @@
|
|||
"click #deletePlan" : "deletePlan"
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.dbservers = new window.ClusterServers([], {
|
||||
interval: this.interval
|
||||
});
|
||||
this.dbservers.fetch({
|
||||
async: false
|
||||
});
|
||||
this.dbservers.startUpdating();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
$(this.el).html(this.template.render({}));
|
||||
},
|
||||
|
||||
relaunchCluster: function() {
|
||||
console.log("relaunchCluster");
|
||||
var result = false;
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type: "GET",
|
||||
async: false, // sequential calls!
|
||||
url: "/cluster/relaunch",
|
||||
url: "cluster/relaunch",
|
||||
success: function(data) {
|
||||
result = data;
|
||||
},
|
||||
error: function(data) {
|
||||
window.App.navigate("showCluster", {trigger: true});
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
editPlan: function() {
|
||||
console.log("editPlan");
|
||||
//welches Scenario und entsprechende View rendern
|
||||
//siehe showClusterView.js
|
||||
|
||||
|
||||
var byAddress = this.listByAddress();
|
||||
if (Object.keys(byAddress).length === 1) {
|
||||
this.type = "testPlan";
|
||||
} else {
|
||||
this.type = "other";
|
||||
}
|
||||
|
||||
if (this.type === "testPlan") {
|
||||
var config = window.App.clusterPlan.get("config");
|
||||
if (_.size(config.dispatchers) === 1) {
|
||||
window.App.navigate("planTest", {trigger : true});
|
||||
} else {
|
||||
// window.App.navigate("planSymmetrical", {trigger : true});
|
||||
window.App.navigate("planAsymmetrical", {trigger : true});
|
||||
return;
|
||||
}
|
||||
//TODO
|
||||
// window.App.navigate("planSymmetrical", {trigger : true});
|
||||
window.App.navigate("planAsymmetrical", {trigger : true});
|
||||
},
|
||||
|
||||
deletePlan: function() {
|
||||
console.log("deletePlan");
|
||||
//irgendwie löschen
|
||||
//view planScenario
|
||||
},
|
||||
|
||||
listByAddress: function() {
|
||||
var byAddress = this.dbservers.byAddress();
|
||||
byAddress = this.coordinators.byAddress(byAddress);
|
||||
return byAddress;
|
||||
window.App.clusterPlan.destroy();
|
||||
window.App.planScenario();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
|
@ -13,11 +13,7 @@
|
|||
events: {
|
||||
"click #multiServerSymmetrical": "multiServerSymmetrical",
|
||||
"click #multiServerAsymmetrical": "multiServerAsymmetrical",
|
||||
"click #singleServer": "singleServer",
|
||||
"click #importRunInfo": "togglePlanImport",
|
||||
"click #confirmRunInfoImport": "uploadPlan",
|
||||
"click #importConnectInfo": "toggleConnectImport",
|
||||
"click #confirmConnectImport": "uploadConnect"
|
||||
"click #singleServer": "singleServer"
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -39,24 +35,6 @@
|
|||
);
|
||||
},
|
||||
|
||||
togglePlanImport: function() {
|
||||
this.hideConnectImportModal();
|
||||
$('#runinfoDropdownImport').slideToggle(200);
|
||||
},
|
||||
|
||||
hidePlanImportModal: function() {
|
||||
$('#runinfoDropdownImport').hide();
|
||||
},
|
||||
|
||||
toggleConnectImport: function() {
|
||||
this.hidePlanImportModal();
|
||||
$('#connectDropdownImport').slideToggle(200);
|
||||
},
|
||||
|
||||
hideConnectImportModal: function() {
|
||||
$('#connectDropdownImport').hide();
|
||||
},
|
||||
|
||||
readJSON: function(fileInput, callback) {
|
||||
var file = fileInput.files[0];
|
||||
var textType = 'application/json';
|
||||
|
@ -65,33 +43,7 @@
|
|||
reader.onload = callback.bind(reader);
|
||||
reader.readAsText(file);
|
||||
}
|
||||
},
|
||||
|
||||
uploadConnect: function() {
|
||||
var self = this;
|
||||
this.readJSON(document.getElementById("connectInfoFile"), function() {
|
||||
$.ajax("cluster/healthcheck", {
|
||||
//$.ajax("cluster/relaunch", {
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: this.result
|
||||
}).done(function(d) {
|
||||
alert(JSON.stringify(d));
|
||||
self.hideConnectImportModal();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
uploadPlan: function() {
|
||||
alert("Sorry not yet implemented");
|
||||
return;
|
||||
var info = {"config":{"dispatchers":{"d1":{"endpoint":"tcp://localhost:8529"}},"numberOfDBservers":2,"numberOfCoordinators":1},"plan":{"dispatchers":{"d1":{"endpoint":"tcp://localhost:8529","id":"d1","avoidPorts":{"4004":true,"4005":true,"4006":true,"7004":true,"7005":true,"7006":true,"8531":true,"8631":true,"8632":true},"arangodExtraArgs":[],"allowCoordinators":true,"allowDBservers":true}},"commands":[{"action":"startAgent","dispatcher":"d1","extPort":4004,"intPort":7004,"peers":[],"agencyPrefix":"meier","dataPath":"","logPath":"","agentPath":"","onlyLocalhost":true},{"action":"startAgent","dispatcher":"d1","extPort":4005,"intPort":7005,"peers":["tcp://localhost:7004"],"agencyPrefix":"meier","dataPath":"","logPath":"","agentPath":"","onlyLocalhost":true},{"action":"startAgent","dispatcher":"d1","extPort":4006,"intPort":7006,"peers":["tcp://localhost:7004","tcp://localhost:7005"],"agencyPrefix":"meier","dataPath":"","logPath":"","agentPath":"","onlyLocalhost":true},{"action":"sendConfiguration","agency":{"agencyPrefix":"meier","endpoints":["tcp://localhost:4004","tcp://localhost:4005","tcp://localhost:4006"]},"data":{"meier":{"Target":{"Lock":"\"UNLOCKED\"","Version":"\"1\"","DBServers":{"Pavel":"\"none\"","Perry":"\"none\""},"MapLocalToEndpoint":{},"MapIDToEndpoint":{"Pavel":"\"tcp://localhost:8631\"","Perry":"\"tcp://localhost:8632\"","Claus":"\"tcp://localhost:8531\""},"Coordinators":{"Claus":"\"none\""},"Databases":{"_system":"{\"name\":\"_system\"}"},"Collections":{"_system":{}}},"Plan":{"Lock":"\"UNLOCKED\"","Version":"\"1\"","DBServers":{"Pavel":"\"none\"","Perry":"\"none\""},"MapLocalToEndpoint":{},"Coordinators":{"Claus":"\"none\""},"Databases":{"_system":"{\"name\":\"_system\"}"},"Collections":{"_system":{}}},"Current":{"Lock":"\"UNLOCKED\"","Version":"\"1\"","DBservers":{},"Coordinators":{},"Databases":{"_system":{}},"Collections":{"_system":{}},"ServersRegistered":{"Version":"\"1\""},"ShardsCopied":{}},"Sync":{"ServerStates":{},"Problems":{},"LatestID":"\"0\"","Commands":{},"HeartbeatIntervalMs":"1000"},"Launchers":{"d1":"{\"DBservers\":[\"Pavel\",\"Perry\"],\"Coordinators\":[\"Claus\"]}"}}}},{"action":"startServers","dispatcher":"d1","DBservers":["Pavel","Perry"],"Coordinators":["Claus"],"name":"d1","dataPath":"","logPath":"","arangodPath":"","onlyLocalhost":true,"agency":{"agencyPrefix":"meier","endpoints":["tcp://localhost:4004","tcp://localhost:4005","tcp://localhost:4006"]}},{"action":"createSystemColls","url":"http://localhost:8531"},{"action":"initializeFoxx","url":"http://localhost:8531"}]},"runInfo":{"error":false,"errorMessage":"none","runInfo":[{"error":false,"isStartAgent":true,"pid":{"pid":36758},"endpoint":"tcp://localhost:4004"},{"error":false,"isStartAgent":true,"pid":{"pid":36759},"endpoint":"tcp://localhost:4005"},{"error":false,"isStartAgent":true,"pid":{"pid":36760},"endpoint":"tcp://localhost:4006"},{"error":false,"isSendConfiguration":true},{"error":false,"isStartServers":true,"pids":[{"pid":36764},{"pid":36765},{"pid":36766}],"endpoints":["tcp://localhost:8631","tcp://localhost:8632","tcp://localhost:8531"],"roles":["DBserver","DBserver","Coordinator"]},{"code":200,"message":"OK","headers":{"connection":"Keep-Alive","content-length":"26","content-type":"application/json; charset=utf-8","http/1.1":"200 OK","server":"ArangoDB"},"body":"{\"error\":false,\"code\":200}"},{"error":false}]}};
|
||||
$.ajax("cluster/shutdown", {
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(info)
|
||||
});
|
||||
this.hidePlanImportModal();
|
||||
}
|
||||
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
var isDBServer;
|
||||
var isCoordinator;
|
||||
var self = this;
|
||||
var data = {dispatcher : []};
|
||||
var data = {dispatchers: []};
|
||||
var foundCoordinator = false;
|
||||
var foundDBServer = false;
|
||||
$(".dispatcher").each(function(i, dispatcher) {
|
||||
|
@ -36,7 +36,7 @@
|
|||
foundCoordinator = foundCoordinator || hostObject.isCoordinator;
|
||||
foundDBServer = foundDBServer || hostObject.isDBServer;
|
||||
|
||||
data.dispatcher.push(hostObject);
|
||||
data.dispatchers.push(hostObject);
|
||||
})
|
||||
if (!self.isSymmetric) {
|
||||
if (!foundDBServer) {
|
||||
|
@ -48,7 +48,7 @@
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
if ( data.dispatcher.length === 0) {
|
||||
if ( data.dispatchers.length === 0) {
|
||||
alert("Please provide at least one Host");
|
||||
return;
|
||||
}
|
||||
|
@ -56,12 +56,14 @@
|
|||
}
|
||||
|
||||
data.type = this.isSymmetric ? "symmetricalSetup" : "asymmetricalSetup";
|
||||
$.ajax("cluster/plan", {
|
||||
type: "POST",
|
||||
data: JSON.stringify(data)
|
||||
}).done(function(info) {
|
||||
window.App.showDownload(info);
|
||||
});
|
||||
this.model.save(
|
||||
data,
|
||||
{
|
||||
success : function(info) {
|
||||
window.App.navigate("showCluster", {trigger: true});
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
addEntry: function() {
|
||||
|
|
|
@ -42,17 +42,32 @@
|
|||
numberDBServers: parseInt(d, 10),
|
||||
numberCoordinators: parseInt(c, 10)
|
||||
},
|
||||
{success : function(info) {
|
||||
console.log("planTestView.js");
|
||||
window.App.navigate("showCluster", {trigger: true});
|
||||
}}
|
||||
{
|
||||
success : function(info) {
|
||||
window.App.navigate("showCluster", {trigger: true});
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
$(this.el).html(this.template.render({
|
||||
config : this.model.get("config")
|
||||
}));
|
||||
var param = {};
|
||||
var config = this.model.get("config");
|
||||
if (config) {
|
||||
param.dbs = config.numberOfDBservers;
|
||||
param.coords = config.numberOfCoordinators;
|
||||
var host = config.dispatchers.d1.endpoint;
|
||||
host = host.split("://")[1];
|
||||
host = host.split(":");
|
||||
param.hostname = host[0];
|
||||
param.port = host[1];
|
||||
} else {
|
||||
param.dbs = 2;
|
||||
param.coords = 1;
|
||||
param.hostname = window.location.hostname;
|
||||
param.port = window.location.port;
|
||||
}
|
||||
$(this.el).html(this.template.render(param));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue