在elastic官网下载elasticsearch到云主机后解压,执行bin/elasticsearch,首先遇到jdk版本不匹配,需要使用自带的Jdk,不能用root执行的问题,然后启动起来后,后台curl http://xxx:9200/发现有如下执行结果
{
"name" : "xxx",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "VMlGfplJQV270SJuOzCezQ",
"version" : {
"number" : "7.2.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "508c38a",
"build_date" : "2019-06-20T15:54:18.811730Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
但是就是不能在本地windows上访问,首先怀疑是端口没有开放,接着开放端口也不行,于是把防火墙关了,还是不行,后面看日志,发现9200端口绑定的地址是127.0.0.1,才恍然大悟。
修改netwok.host为本地eth0网卡地址后,发现后面还是有跑错,开放seed_hosts,测试终于OK了。
network.host: 171.29.0.5 #192.168.0.1
#
# Set a custom port for HTTP:
#
http.port: 9123
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["127.0.0.1", "171.29.0.5"]