我在我的 Azure 虚拟机 (linux) 中安装了一个带有私有 IP 的弹性搜索集群 10.176.83.156 和elasticsearch.yml 文件具有以下值
cluster.name: Test-cluster
node.name: node-1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["l01q23705150001"]
# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authentication
http.host: 0.0.0.0
我可以从 Linux 机器(10.176.83.156)的安装位置访问 Elasticsearch。
curl -u elastic:NYC59UxNJ3FRNZUpNhKa https://10.176.83.156:9200 -k
{
"name" : "l01q23705150001",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "wOepv5C_T3md3a0K6f1yOw",
"version" : {
"number" : "8.12.2",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "48a287ab9497e852de30327444b0809e55d46466",
"build_date" : "2024-02-19T10:04:32.774273190Z",
"build_snapshot" : false,
"lucene_version" : "9.9.2",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
但是使用 VPN 从我的本地计算机外部访问它时出现错误
curl -u elastic:NYC59UxNJ3FRNZUpNhKa https://10.176.83.156:9200 -k
curl: (7) Failed to connect to 10.192.85.168 port 9200: No route to host
enter code here
还向 Linux 计算机的 NSG 添加了以下入站规则。
错误消息表明存在路由问题。您确定 Azure VPN 已正确配置吗?如果是这样,您是否能够在 SSH 之后通过 VPN 连接到同一台计算机到该服务器,或者连接到该服务器上配置的任何其他服务? 作为附加测试,在同一子网中创建一台新计算机并尝试连接到 Elasticsearch 以确保 Elasticsearch 服务响应来自外部本地主机的请求 执行这些检查可以帮助找到问题的原因或至少缩小范围