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