如何解决Kibana的拒绝连接问题



我在Kibana中编写了一个创建图表的函数。

首先,我在本地电脑上安装了Kibana和Elasticsearch。我正在发送一个创建数据和图表的请求,并从那里获取嵌入的iframe代码。

在这种情况下,一切都很好。我可以清楚地创建图表,我的功能也很好。我可以在我的页面上显示图表。

然后我在服务器上安装了我的项目kibana和弹性搜索。我在iframe标签中得到了这个错误:

2*.**6拒绝连接。

问题出在哪里?

我的部分功能

elasticsearch_address= 'http://localhost:9200'
self.es = Elasticsearch([elasticsearch_address], use_ssl=False,
verify_certs=False, ssl_show_warn=False, send_get_body_as='POST', )

它运行良好。我可以获取请求并将其发送到此地址。所以,我认为问题出在基巴纳。

我的部分功能

url3 = "http://localhost:5601/api/saved_obj..."
headers3 = {"Accept-Language": "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3",
"Accept-Encoding": "gzip, deflate",
"Referer": 
"http://localhost:5601/app/management/kibana/objects",
"Content-Type": "multipart/form-data; boundary=-..."
"Origin": "http://localhost:5601", "kbn-xsrf": "true", "Sec- 
Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin"}
data3 = "--...."
r3 = requests.post(url3, headers=headers3, data=data3)
destinationid = re.findall(r""destinationId":"(.*?)"", r3.text)
destinationid = destinationid[-1]
request_text = "http://localhost:5601/app/dashboards#..."
user = request.user
user.iframe = request_text.replace("localhost", "2**.***.***.**")
user.save()

user.iframe部分,我得到了iframe代码。我用服务器的IP号码将其更改为可以从浏览器访问。

我的错误在哪里?Kibana有这样的背景吗?

您需要检查Kibana和弹性搜索是否绑定到正确的ip和端口

在您的服务器中,检查您的kibana.yml

server.port: 5601
server.host: 2**.***.***.****
server.name: "kibanaserver" 
elasticsearch.url: "***.***.***.****:9200" 
kibana.index: ".tkibana" 
logging.dest: /var/log/kibana/kibana.log

类似的事情,你需要在你的弹性搜索中做。yml也

然后尝试连接

curl -XGET "***.***.***.***:5601" 
curl -XGET "***.***.***.***:9200" 

你不应该在这里拒绝连接

如果端口正在侦听,您也可以从服务器进行检查

netstat -a -n | grep tcp | grep 9200
netstat -a -n | grep tcp | grep 5601

最新更新