public ActionResult SolrAdmin(string role) { SolrInstanceStatus status = new SolrInstanceStatus(); List <SolrInstanceStatus> statuses = new List <SolrInstanceStatus>(); if (role == "master") { status = GetSolrInstanceStatus(true, -1); statuses.Add(status); } else { int numInstances = HelperLib.Util.GetNumInstances(false); for (int iInstance = 0; iInstance < numInstances; iInstance++) { status = GetSolrInstanceStatus(false, iInstance); statuses.Add(status); } } ViewBag.Statuses = statuses; return(View()); }
private dynamic GetSolrInstanceStatus(bool isMaster, int iInstance) { SolrInstanceStatus status = new SolrInstanceStatus() { IsReady = false }; if (isMaster) { status.InstanceName = "Solr Master"; status.IsMaster = true; } else { status.InstanceName = "Solr Slave #" + iInstance; status.IsMaster = false; } string solrUrl = HelperLib.Util.GetSolrUrl(isMaster, iInstance); if (solrUrl == null) { return(status); } status.Url = solrUrl; try { string solrCommandUrl = solrUrl + "replication?command=details"; string result = ExecSolrCommand(solrCommandUrl); XmlDocument docResult = new XmlDocument(); docResult.LoadXml(result); XmlNode node; node = docResult.SelectSingleNode("response/lst[@name='details']/long[@name='indexVersion']"); if (node != null) { status.IndexVersion = node.InnerText; } node = docResult.SelectSingleNode("response/lst[@name='details']/str[@name='indexSize']"); if (node != null) { status.IndexSize = node.InnerText; } node = docResult.SelectSingleNode("response/lst[@name='details']/long[@name='generation']"); if (node != null) { status.Generation = node.InnerText; } if (!isMaster) { node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='timesIndexReplicated']"); if (node != null) { status.NumTimesReplicated = node.InnerText; } node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='indexReplicatedAt']"); if (node != null) { status.LastReplicationTime = node.InnerText; } node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='nextExecutionAt']"); if (node != null) { status.NextReplicationTime = node.InnerText; } node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='pollInterval']"); if (node != null) { status.PollInterval = node.InnerText; } } status.IsReady = true; } catch { } return(status); }
private dynamic GetSolrInstanceStatus(bool isMaster, int iInstance) { SolrInstanceStatus status = new SolrInstanceStatus() { IsReady = false }; if (isMaster) { status.InstanceName = "Solr Master"; status.IsMaster = true; } else { status.InstanceName = "Solr Slave #" + iInstance; status.IsMaster = false; } string solrUrl = HelperLib.Util.GetSolrUrl(isMaster, iInstance); if (solrUrl == null) return status; status.Url = solrUrl; try { string solrCommandUrl = solrUrl + "replication?command=details"; string result = ExecSolrCommand(solrCommandUrl); XmlDocument docResult = new XmlDocument(); docResult.LoadXml(result); XmlNode node; node = docResult.SelectSingleNode("response/lst[@name='details']/long[@name='indexVersion']"); if (node != null) status.IndexVersion = node.InnerText; node = docResult.SelectSingleNode("response/lst[@name='details']/str[@name='indexSize']"); if (node != null) status.IndexSize = node.InnerText; node = docResult.SelectSingleNode("response/lst[@name='details']/long[@name='generation']"); if (node != null) status.Generation = node.InnerText; if (!isMaster) { node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='timesIndexReplicated']"); if (node != null) status.NumTimesReplicated = node.InnerText; node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='indexReplicatedAt']"); if (node != null) status.LastReplicationTime = node.InnerText; node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='nextExecutionAt']"); if (node != null) status.NextReplicationTime = node.InnerText; node = docResult.SelectSingleNode("response/lst[@name='details']/lst[@name='slave']/str[@name='pollInterval']"); if (node != null) status.PollInterval = node.InnerText; } status.IsReady = true; } catch { } return status; }
public ActionResult SolrAdmin(string role) { SolrInstanceStatus status = new SolrInstanceStatus(); List<SolrInstanceStatus> statuses = new List<SolrInstanceStatus>(); if (role == "master") { status = GetSolrInstanceStatus(true, -1); statuses.Add(status); } else { int numInstances = HelperLib.Util.GetNumInstances(false); for (int iInstance = 0; iInstance < numInstances; iInstance++) { status = GetSolrInstanceStatus(false, iInstance); statuses.Add(status); } } ViewBag.Statuses = statuses; return View(); }