Elasticsearch-下载和安装详解

导读

本文的说明及讲解是基于ElasticSearch 7.15.1 版本,安装在centos7环境上,如文章配置有差异之处,以官网文档为准,主要介绍下载、安装、运行和主要配置说明。

1. 下载

官网下载地址

JVM配置-config/jvm.options 默认设置的是4GB

配置建议:Xmx不用超过机器内存的50%,最大不要超过30GB

2. 安装

官网安装文档

#下载及安装
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.1-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.1-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-7.15.1-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-7.15.1-linux-x86_64.tar.gz
cd elasticsearch-7.15.1/
# 安装分词插件
./bin/elasticsearch-plugin install  analysis-icu
# 查看插件
./bin/elasticsearch-plugin list

3.运行

# 启动
./bin/elasticsearch

#验证ES是否启动成功 查看进程 
ps -ef|grep es

# 访问端口验证:curl http://127.0.0.1:9200
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "_na_",
  "version" : {
    "number" : "7.15.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "83c34f456ae29d60e94d886e455e6a3409bba9ed",
    "build_date" : "2021-10-07T21:56:19.031608185Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

# 运行多实例
./bin/elasticsearch -d -E cluster.name=my_cluster -Enode.name=node_1

# 守护进程启动
./bin/elasticsearch -d -p pid
# 关闭
pkill -F pid

4.问题

问题1:用户

Exception java.lang.RuntimeException: can not run elasticsearch as root

sudo userad es  
sudo passwd es
sudo chown -R es:es  elasticsearch-7.15.1
问题2:文件描述符
bootstrap check failure [1] of [3]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
#追加内容;重新登录用户,才会生效
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "es soft nofile 65536" >> /etc/security/limits.conf
echo "es hard nofile 65536" >> /etc/security/limits.conf
问题3:线程数
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
#追加内容
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "vm.max_map_count=655360" >> /etc/sysctl.conf
sysctl -p
问题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_master_nodes: ["node-1"]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值