elasticsearch7.5安裝遇到的坑

沒錯,從零開始的elasticsearch搭建教程開始了!h'h **html

原文:http://www.javashuo.com/article/p-mkliqcgu-e.htmljava

那麼首先假設 你已經裝好了一個CentOS系統 ,個人是centos6.7的node

 

1.到官網下載Elasticsearch

地址: https://www.elastic.co/cn/downloads/past-releases#elasticsearchlinux

我下的是7.5.2bootstrap

2.上傳壓縮包到Linux服務器(略)

3.安裝

  3.1 解壓上傳好的安裝包

tar -zxvf elasticsearch-7.5.2-linux-x86_64.tar.gz 
  

  3.2 嘗試啓動

linux中 elasticsearch不能以root用戶啓動
 
 
 
  
因此先建一個普通用戶
adduser username
更改文件夾所屬權
chown -R username ./elasticsearch-7.5.2 

進入已經解壓好的elasticsearch 的目錄中
cd elasticsearch-7.5.2/
切換用戶:
su username
啓動elasticsearch
./bin/elasticsearch
這裏來講通常都會成功,若是本的配置了JAVA_HOME的環境路徑,
並且java的版本比較低的話啓動就會失敗,elasticsearch中有jdk的版本最好使用該版本的jdk

 
vi bin/elasticsearch
在開始的位置加入:
export JAVA_HOME=/opt/program/elasticsarch/elasticsearch-7.5.2/jdk      #(此處es的jdk所在目錄)
export PATH=$JAVA_HOME/bin:$PATH
:wq 保存並退出

而後再次啓動,完美成功!
ctrl + c 關閉運行

 

3.3 開放遠程鏈接

修改 config下的 elasticsearch.yml
vi config/elasticsearch.yml
修改下面配置:
network.host: 0.0.0.0 #改成0.0.0.0對外開放,如對特定ip開放則改成指定ip
http.port: 9200 #可更改端口不爲9200
 
啓動可能會報錯:
1virtual65530is262144vi /etc/sysctl.conf
加入:
vm.max_map_count=655360
 

而後加載參數centos

sysctl -p
繼續啓動可能報的錯誤:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [1024] for user [elastic] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[5]: 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
 
.打開/etc/security/limits.conf,在裏面添加以下內容
 

* soft nofile 65536bash

* hard nofile 65536服務器

 
此處不行還要修改 /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
將上面修改成:
* soft nproc 2048
 其中*表示全部用戶  nofile表示最大文件句柄數,表示可以打開的最大文件數目

再次啓動出現下列錯誤時:
ERROR: [2] bootstrap checks failed
[1]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] mu

修改elastic search.yml文件加入:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

再次出現如下錯誤時:
ERROR: [1] bootstrap checks failed
[1]: 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
修改elasticsearch.yml文件加入:
cluster.initial_master_nodes: ["node-1"]
 
再次啓動應該就ok了。。。
 

3.4 elasticsearch 後臺啓動

./bin/elasticsearch -d
相關文章
相關標籤/搜索