linux安装elasticsearch 7.8

安装参考文档:

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

创建存储文件:

mkdir /itcast/es/

解压到这个文件里面去:

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

修改配置文件:

[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 

修改以下主要内容:

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

#设置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

在这里插入图片描述

说明:在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

在这里插入图片描述

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

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

在这里插入图片描述

让配置生效

sysctl -p

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

useradd elsearch

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

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

启动es服务

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

启动成功后通过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

在这里插入图片描述

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

猜你喜欢

转载自blog.csdn.net/weixin_46654114/article/details/124534742