微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

centOs7 elasticsearch 安装

# 下载并安装GPG key

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

 

# 在/etc/yum.repos.d文件夹下新增elasticsearch.repo文件

cd /etc/yum.repos.d
mkdir elasticsearch.repo
vi elasticsearch.repo
# 将下面内容填入 elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

# 安装elasticsearch

yum install elasticsearch

# 修改配置文件

# 查看安装目录
whereis elasticsearch
# 编辑配置文件
vi /etc/elasticsearch/elasticsearch.yml

# 名称
cluster.name: my-application
# 地址
network.host: 0.0.0.0
# 端口
http.port: 9200

# 内存修改jvm.options

vi /etc/elasticsearch/jvm.options
# 调整大小
-xms256m
-Xmx256m

# 启动

# 启动
systemctl start elasticsearch
# 查看启动状态
systemctl status elasticsearch
# 如果启动报错,在日志中可看到详细信息
vi /var/log/elasticsearch/elasticsearch.log

一般报错情况:

1、max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

翻译:最大虚拟内存面积vm.max_map_count[65530]可能太低,至少增加到[262144]

解决办法:

vi /etc/sysctl.conf 
# 添加下面配置
vm.max_map_count= 262144
sysctl -p

2、to a majority of the number of master eligible nodes in your cluster

翻译:群集中大多数符合主节点条件的节点

解决办法:找不到对应的主节点,配置一下。

discovery.zen.ping.unicast.hosts: ["192.168.190.146"]
discovery.zen.minimum_master_nodes: 1

# 访问

# 访问
curl -X GET localhost:9200

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐