ElasticSearch安裝

之前項目中用過ElasticSearch,是一個不錯的搜索引擎,現在想深入的學習一下,嘗試自己安裝,遇到不少困難,踩了不少坑,參考網上很多優秀的文章得以解決,下面對自己的安裝過程做一個記錄:

一、環境準備

二、安裝es

1、將壓縮包上傳到虛擬機指定目錄,並解壓,整體命令如下:

[root@localhost ~]# cd /usr
[root@localhost usr]# mkdir elastic
[root@localhost usr]# cd elastic
[root@localhost elastic]# rz
[root@localhost elastic]# tar -zxvf elasticsearch-7.1.1-linux-x86_64.tar.gz
[root@localhost elastic]# ls
elasticsearch-7.1.1  elasticsearch-7.1.1-linux-x86_64.tar.gz

三、啓動

啓動遇到很多問題,需要做很多配置:

1、不支持root用戶啓動

需要創建其他用戶登錄,賦予權限,並啓動

  • 添加並切換用戶
user add zrk
tail -1 /etc/passwd
passwd zrk
chown -R zrk elasticsearch-7.1.1
su - zrk
  • 啓動
cd /usr/elastic/elasticsearch-7.1.1/bin
./elasticsearch
#後臺啓動
./elasticsearch -d 

2、bootstrap checks failed

報錯信息:

ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3891] for user [zrk] 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]: 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

解決方法:參考鏈接

3、外網無法訪問

通過瀏覽器無法訪問到虛擬機的9200端口
解決辦法:參考鏈接

四、訪問

[root@localhost elastic]# curl localhost:9200
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Z3U7OMa7QDOEmP9Cdw69dg",
  "version" : {
    "number" : "7.1.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "7a013de",
    "build_date" : "2019-05-23T14:04:00.380842Z",
    "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"
}

在這裏插入圖片描述
虛擬機、瀏覽器(postman代替)皆可訪問

五、參考鏈接

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章