我正在尝试在不同的VM上设置ES
集群和Kibana
。 ES
集群已设置并由search-guard
保护,我什至可以从浏览器和curl
访问它。
我已经在另一台VM上设置了kibana
,并将elasticsearch.url
更改为ES
集群中的一台服务器,并且我还更新了elasticsearch.username
和elasticsearch.password
。
由于我使用的是自签名SSL
,因此我还设置了以下内容。
elasticsearch.ssl.verificationMode: none
端口5601
允许使用防火墙,日志如下,但是我仍然无法访问kibana
。我应该在kibana
上安装ES Node
使其正常工作还是如何工作?
Nov 07 02:55:42 Kibana systemd[1]: Started Kibana.
Nov 07 02:56:09 Kibana kibana[25483]: {"type":"log","@timestamp":"2018-11-07T02:56:09Z","tags":["info","optimize"],"pid":25483,"message":"Optimizing and caching bundles for ml, stateSessionStorageRedirect, status_page, timelion, graph, monitoring, dashboardViewer, apm and kibana. This may take a few minutes"}
答案 0 :(得分:1)
在kibana.yml中将public static void main(String[] args) throws UnsupportedEncodingException {
String url = "https://ap-south-1.console.aws.amazon.com/cloudwatch/home";
/**
* Add host without http or https protocol.
* You can also add other parameters based on your amazon service requirement.
*/
TreeMap<String, String> awsHeaders = new TreeMap<String, String>();
awsHeaders.put("host", "logs.ap-south-1.amazonaws.com/");
String jsonDocument = "{\"logGroupName\": \"/XXX-api-env\", \"logStreamName\": \"i-XXXX263XXX\"}";
HttpPost httpPost = new HttpPost(url);
AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder("Key", "secret_key")
.regionName("ap-south-1")
.serviceName("logs") // use your service name
.httpMethodName("POST") //GET, PUT, POST, DELETE, etc...
.canonicalURI("Action=Logs_20140328.GetLogEvents") //end point
.queryParametes(null) //query parameters if any
.awsHeaders(awsHeaders) //aws header parameters
.payload(jsonDocument) // payload if any
.debug() // turn on the debug mode
.build();
/* Get header calculated for request */
Map<String, String> header = aWSV4Auth.getHeaders();
for (Map.Entry<String, String> entrySet : header.entrySet()) {
String key = entrySet.getKey();
String value = entrySet.getValue();
httpPost.addHeader(key,value);
}
httpPostRequest(httpPost);
}
public static void httpPostRequest(HttpPost httpPost) {
/* Create object of CloseableHttpClient */
CloseableHttpClient httpClient = HttpClients.createDefault();
/* Response handler for after request execution */
ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
@Override
public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
/* Get status code */
int status = response.getStatusLine().getStatusCode();
if (status >= 200 && status < 300) {
/* Convert response to String */
HttpEntity entity = response.getEntity();
return entity != null ? EntityUtils.toString(entity) : null;
} else {
throw new ClientProtocolException("Unexpected response status: " + status);
}
}
};
try {
/* Execute URL and attach after execution response handler */
String strResponse = httpClient.execute(httpPost, responseHandler);
/* Print the response */
System.out.println("Response: " + strResponse);
} catch (Exception e) {
e.printStackTrace();
}
}
设置为在所有接口上监听