0
Nuget 패키지 관리자에서 신축 검색 클라이언트 Nest를 다운로드했습니다.C#을 사용하여 Elastic 검색 서버의 상태를 확인하는 방법은 무엇입니까?
및 서버의 상태를 확인하는 기능을 인식 할 수 없습니다.
제발 제안하십시오 ..
감사합니다. 모든 답변을 주시면 감사하겠습니다.
Nuget 패키지 관리자에서 신축 검색 클라이언트 Nest를 다운로드했습니다.C#을 사용하여 Elastic 검색 서버의 상태를 확인하는 방법은 무엇입니까?
및 서버의 상태를 확인하는 기능을 인식 할 수 없습니다.
제발 제안하십시오 ..
감사합니다. 모든 답변을 주시면 감사하겠습니다.
너겟 패키지 관리자에서 ElasticSearch.net과 Nest를 모두 설치해야하며 둘 다 같은 버전이어야합니다.
Nest Elastic Client를 사용하여 상태를 확인하는 방법입니다.
public string HealthCheck(WaitForStatus waitForStatus = WaitForStatus.Red, bool logResults = false)
{
var response = this._client.ClusterHealth(new ClusterHealthRequest() { WaitForStatus = waitForStatus });
var healthColor = response.Status.ToLower();
// this will give you the color code of the elastic search server health.
switch (healthColor)
{
case "green":
var message = "ElasticSearch Server health check returned [GREEN]";
break;
case "yellow":
var message = "ElasticSearch Server health check returned [YELLOW] (yellow is normal for single node clusters) ";
break;
default: // Includes "red"
var message = "ElasticSearch Server health check returned [{0}]".FormatInLine(response.Status.ToUpper());
break;
}
return message;
}
메시지가 표시되면 서버 상태를 확인할 수 있습니다. 녹색과 노란색은 허용되며 빨간색은 문제를 일으킬 수 있습니다.
감사합니다 ............