ELFK安裝

下載地址

https://www.elastic.co/cn/downloads/

安裝elasticsearch

#安裝JDK環境(Java虛擬機)
#下載地址:
https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html
rpm -ivh jdk-13.0.1_linux-x64_bin.rpm
#檢查是否安裝完成:java -version
[root@localhost ~]# java -version
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
 
#下載安裝包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.2-linux-x86_64.tar.gz
tar xf elasticsearch-7.4.2-linux-x86_64.tar.gz
mv elasticsearch-7.4.2 /usr/local/
cd /usr/local/elasticsearch-7.4.2/
useradd elasticsearch
chown -R elasticsearch. /usr/local/elasticsearch-7.4.2/
su - elasticsearch
cd /usr/local/elasticsearch-7.4.2/
./bin/elasticsearch -d
#輸出:
[root@localhost elasticsearch-7.4.2]# ./bin/elasticsearch -d
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
#檢查是否啓動成功:netstat -tnulp |egrep "9200|9300"
[root@localhost local]# netstat -tnulp |egrep "9200|9300"
tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN      2345/java           
tcp6       0      0 ::1:9200                :::*                    LISTEN      2345/java           
tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN      2345/java           
tcp6       0      0 ::1:9300                :::*                    LISTEN      2345/java           

如果啓動成功,可以再端口9200訪問到信息,或輸入:jps

[root@localhost ~]# curl localhost:9200
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "rwzJsBR1QrqZyjpzh7tP2Q",
  "version" : {
    "number" : "7.4.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "2f90bbf7b93631e52bafb59b3b049cb44ec25e96",
    "build_date" : "2019-10-28T20:40:44.881551Z",
    "build_snapshot" : false,
    "lucene_version" : "8.2.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

瀏覽器安裝elasticsearch-head谷歌插件:
下載地址(個人博客網站,安全,請放心使用):

首先修改配置文件:
vim /usr/local/elasticsearch-7.4.2/config/elasticsearch.yml
在第55行,輸入:55 dd ,取消註釋,修改爲:network.host: 0.0.0.0
#修改後執行jps找到elasticsearch的PID,kill殺掉,切換到elastic用戶重啓,此處發現一個報錯:
#重啓後稍等一會
[root@localhost elasticsearch-7.4.2]# 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 [3802] for user [elasticsearch] 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
#解決方案放在文章最末尾,如果沒有繼續執行

點此下載或使用網址: http://49.232.43.42:83/install/elasticseacrh-head.rar
谷歌瀏覽器插件:設置–>左邊點擊擴展程序–>右上角打開開發者模式,
導入過程
在這裏插入圖片描述
插入數據進行測試:
如果是按照我的目錄部署,可以直接下載腳本 (數據是公司自己用的,安全,博客是自己的)
腳本執行報錯請手動執行或修改後發給我

如果不是可以手動輸入

錯誤解決方案

#輸出內容可能不是完全一致,再此分條解釋:
 [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
#解決方法:
修改elasticsearch.yml配置文件,找到cluster.initial,默認是註釋行,取消註釋,改爲單節點
cluster.initial_master_nodes: ["node-1"]
########這三條一般一起出現
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3802] for user [elasticsearch] 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 
編輯 /etc/security/limits.conf,追加以下內容;
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
#修改後重連生效
編輯 /etc/sysctl.conf,追加以下內容:
vm.max_map_count=655360
保存後,執行:
sysctl -p
或直接複製命令:
cat >>/etc/security/limits.conf<<EOF
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
EOF
echo "vm.max_map_count=655360" >>vm.max_map_count=655360 && sysctl -p &&bash
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章