Elasticsearch的安装与配置

注意:elasticsearch 禁止安装在/root路径下!

1、创建用户组

groupadd elastic

2、创建用户

useradd es -d /home/es -g elastic

echo 'es' | passwd es --stdin

3、给新创建的用户进行授权

chown -R es:elastic /home/es

chmod -R 775 /home/es

4、创建文件夹

mkdir /data/app/elasticsearch

cd /data/app/elasticsearch

5、上传并解压安装包

tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz

6、进入解压后的目录

cd elasticsearch-7.6.2/

chown -R es:elastic ./

7、修改配置

8、su es

vim config/elasticsearch.yml

找到如下配置并修改

network.host: 0.0.0.0

http.port: 9200

9. 查看限制

(结果是否为65536)

ulimit -Hn

10、切换回root用户

exit

11、打开配置文件vim /etc/security/limits.conf

在文件末尾添加如下内容:

es soft nofile 65536

es hard nofile 65536

12、切换用户到es

su es

查看限制(结果应为65536)

ulimit --Hn

如果还是没有变为65536,则执行

vi /etc/pam.d/su

在文件末尾添加:

session required pam_limits.so

保存后,重新查看。

13、配置max virtual memory areas

切换回root用户

exit

14、打开配置文件

vim /etc/sysctl.conf

文件末尾添加如下内容:

vm.max_map_count=262144

15、执行命令

sysctl -p

16、修改配置vim config/elasticsearch.yml

找到如下配置并修改

node.name: node-1

cluster.initial_master_nodes: ["node-1"]

17、修改权限

chown -R es:elastic /data/app/elasticsearch/elasticsearch-7.6.2

18、启动命令

19、su es

nohup bin/elasticsearch >/dev/null 2>&1 &

以下截图为yaml文件修改示意

20、验证

curl http://ip:9200

正常情况显示以下内容:

{

"name" : "node-1",

"cluster_name" : "elasticsearch",

"cluster_uuid" : "SENmAYuER-y1s41YiG6itA",

"version" : {

"number" : "7.6.2",

"build_flavor" : "default",

"build_type" : "tar",

"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",

"build_date" : "2020-03-26T06:34:37.794943Z",

"build_snapshot" : false,

"lucene_version" : "8.4.0",

"minimum_wire_compatibility_version" : "6.8.0",

"minimum_index_compatibility_version" : "6.0.0-beta1"

},

"tagline" : "You Know, for Search"

}

相关推荐
Yusei_05233 小时前
迅速掌握Git通用指令
大数据·git·elasticsearch
水无痕simon21 小时前
5 索引的操作
数据库·elasticsearch
Qlittleboy3 天前
tp5集成elasticsearch笔记
大数据·笔记·elasticsearch
Elasticsearch3 天前
Elasticsearch:使用 Gradio 来创建一个简单的 RAG 应用界面
elasticsearch
kong@react3 天前
spring boot配置es
spring boot·后端·elasticsearch
Elasticsearch3 天前
Elasticsearch:如何使用 Qwen3 来做向量搜索
elasticsearch
Elastic 中国社区官方博客3 天前
Elasticsearch:如何使用 Qwen3 来做向量搜索
大数据·人工智能·elasticsearch·搜索引擎·全文检索
xiao-xiang4 天前
elasticsearch mapping和template解析(自动分词)!
大数据·elasticsearch·搜索引擎
Elastic 中国社区官方博客4 天前
超越相似名称:Elasticsearch semantic text 如何在简洁、高效、集成方面超越 OpenSearch semantic 字段
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
现在,此刻4 天前
java面试题储备4: 谈谈对es的理解
java·开发语言·elasticsearch