linux安装elasticsearch 7.8

举报
神的孩子在歌唱 发表于 2022/05/01 23:11:21 2022/05/01
【摘要】 安装参考文档: ELK官网:https://www.elastic.co/ ELK官网文档:https://www.elastic.co/guide/index.html ELK中文手册:https...

安装参考文档:

ELK官网:https://www.elastic.co/

ELK官网文档:https://www.elastic.co/guide/index.html

ELK中文手册:https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html

ELK中文社区:https://elasticsearch.cn/

ELK-API : https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html

下载软件

下载地址:https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-8-0

在这里插入图片描述

命令下载:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-linux-x86_64.tar.gz

  
 
  • 1

创建存储文件:

mkdir /itcast/es/

  
 
  • 1

解压到这个文件里面去:

tar -xvf elasticsearch-7.8.0-linux-x86_64.tar.gz -C /itcast/es/

  
 
  • 1

修改配置文件:

[root@VM-4-15-centos ~]# cd /itcast/es/elasticsearch-7.8.0/
[root@VM-4-15-centos elasticsearch-7.8.0]# vim config/elasticsearch.yml 

  
 
  • 1
  • 2

修改以下主要内容:

以下是我遇到了了全部错误后配置的全部内容

#设置ip地址,任意网络均可访问
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
node.name: "node-1"
discovery.seed_hosts: ["127.0.0.1", "[::1]"]
cluster.initial_master_nodes: ["node-1"]
# # 开启跨域访问支持,默认为false
http.cors.enabled: true
# 跨域访问允许的域名地址,(允许所有域名)以上使用正则
http.cors.allow-origin: "*"
http.max_content_length: 200mb
bootstrap.system_call_filter: false

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

在这里插入图片描述

说明:在Elasticsearch中如果,如果network.host不是localhost或者127.0.0.1的话,就会认为是生产环境,会对环境的要求比较高,我们的测试环境不一定能够满足,一般情况下需要修改2处配置

修改jvm启动参数

[root@VM-4-15-centos elasticsearch-7.8.0]# vim config/jvm.options

#可以根据自己机器情况修改
-Xms128m
-Xmx128m

  
 
  • 1
  • 2
  • 3
  • 4
  • 5

在这里插入图片描述

修改一个进程在VMAS(虚拟内存区域)创建内存映射最大数量

[root@VM-4-15-centos ~]# vim /etc/sysctl.conf 
vm.max_map_count=655360

  
 
  • 1
  • 2

在这里插入图片描述

让配置生效

sysctl -p

  
 
  • 1

因为安全问题elasticsearch 不让用root用户直接运行,所以要创建新用户elsearch 。

useradd elsearch

  
 
  • 1

为用户赋elasticsearch-7.8.0这个文件的操作权限

chown -R elsearch:elsearch /itcast/es/elasticsearch-7.8.0/

  
 
  • 1

启动es服务

su - elsearch
cd /itcast/es/elasticsearch-7.8.0/bin
./elasticsearch 或 ./elasticsearch -d#后台系统

  
 
  • 1
  • 2
  • 3

启动成功后通过ip加上端口号9200就可以访问了,如果是云服务器记得在防火墙那里开启端口9200

错误

参考:https://www.cnblogs.com/socketqiang/p/11363024.html

在这里插入图片描述

因为安全问题elasticsearch 不让用root用户直接运行,所以要创建新用户。

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
ERROR: Elasticsearch did not exit normally - check the logs at /itcast/es/elasticsearch-7.8.0/logs/elasticsearch.log

  
 
  • 1
  • 2
  • 3

在这里插入图片描述

解决:https://blog.csdn.net/qq_43655835/article/details/104637625

文章来源: chenyunzhi.blog.csdn.net,作者:神的孩子都在歌唱,版权归原作者所有,如需转载,请联系作者。

原文链接:chenyunzhi.blog.csdn.net/article/details/124534742

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

举报
请填写举报理由
0/200