Ubuntu Elasticsearch安装启动

1. 下载了安装包elasticsearch-8.3.2-linux-x86_64.tar

 tar -xf后启动报warning : ignoring JAVA_HOME=/usr/lib/jdk8/jdk1.8.0_251; using bundled JDK

原因大概是e8不支持java8

2. 重新下载安装包elasticsearch-7.17.2-linux-x86_64.tar,解压后运行./bin/elasticsearch报错

[2022-07-20T11:05:03,954][ERROR][o.e.i.g.GeoIpDownloader  ] [vm-10-15-7-72] exception during geoip databases update
java.net.SocketTimeoutException: connect timed out

解决:

config/elasticsearch.yml
ingest.geoip.downloader.enabled: false(注意false前必须有空格)

3.  再运行./bin/elasticsearch报错

ERROR: [2] bootstrap checks failed. You must address the points described in the following [2] lines before starting Elasticsearch.
bootstrap check failure [1] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
bootstrap check failure [2] of [2]: the default discovery settings are unsuitable for production use; at least one of 
                                     [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2022-07-20T11:16:48,526][INFO ][o.e.x.m.p.NativeController] [elastic-node-1] Native controller process has stopped - no new native processes can be started

解决:

解决[1] of [2]
sudo vim /etc/sysctl.conf
vm.max_map_count=655360
sudo sysctl -p
解决[
2] of [2] config/elasticsearch.yml #cluster.name: my-application #node.name: node-1 #cluster.initial_master_nodes: ["node-1", "node-2"] ---> cluster.name: elastic-my-application node.name: elastic-node-1 cluster.initial_master_nodes: ["elastic-node-1"]

4. 其他配置

config/elasticsearch.yml

#network.host: 192.168.0.1
#http.port: 9200
--->
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true //表示是否支持跨域,默认为false
http.cors.allow-origin: "*" //当设置允许跨域,默认为*,表示支持所有域名

node.master: true      #该节点是否是master,true表示是的,false表示否,默认是true
node.data: true        #该节点是否存储数据,默认true表示是的
transport.tcp.port: 9300 #节点之间通信的端口,默认为9300
xpack.security.enabled: false

 

5. 在浏览器访问 http://x.x.x.72:9200

{
  "name" : "elastic-node-1",
  "cluster_name" : "elastic-my-application",
  "cluster_uuid" : "-oJDhdiwS0OQ-X0Ha4gkDA",
  "version" : {
    "number" : "7.17.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "de7261de50d90919ae53b0eff9413fd7e5307301",
    "build_date" : "2022-03-28T15:12:21.446567561Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

 6.后台运行

nohup ./bin/elasticseartch &

 

posted @ 2022-07-20 14:50  jason47  阅读(1472)  评论(0编辑  收藏  举报