elasticsearch7.5安裝遇到的坑


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

原文:https://www.cnblogs.com/heermayou/p/12670662.html

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

 

1.到官網下載Elasticsearch

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

我下的是7.5.2

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
 

然后加載參數

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 65536

* 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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM