ElasticSearch的安装(Linux版)

1.获取安装资源(文末有文件)

https://www.elastic.co/cn/downloads/elasticsearch

2.上传文件并解压

shell 复制代码
cd /opt

tar -xf elasticsearch-7.8.0-linux-x86_64.tar.gz 

rm -rf elasticsearch-7.8.0-linux-x86_64.tar.gz 
  

3.创建普通用户并授权

shell 复制代码
# 新增user用户
useradd user  

# 为user用户设置密码
passwd  user123  

# 文件夹所有者
chown -R user:user /opt/elasticsearch-7.8.0 

4.修改文件

shell 复制代码
su user

vim /opt/elasticsearch-7.8.0/config/elasticsearch.yml 

将以下配置生效

cluster.name: my-application

node.name:node-1

network.host:0.0.0.0

http.port:9200

cluster.initial_master_nodes: ["node-1"]

luster.name:配置elasticsearch的集群名称,默认是elasticsearch。建议修改成一个有意义的名称

node.name:节点名,elasticsearch会默认随机指定一个名字,建议指定一个有意义的名称,方便管理

network.host:设置为0.0.0.0允许外网访问

http.port:Elasticsearch的http访问端口

cluster.initial_master_nodes:初始化新的集群时需要此配置来选举master

shell 复制代码
su root 


vim /etc/security/limits.conf 
# 在文件末尾中增加下面内容
user soft nofile 65536
user hard nofile 65536

vim /etc/security/limits.d/20-nproc.conf
# 在文件末尾中增加下面内容
user soft nofile 65536
user hard nofile 65536
*  hard    nproc     4096
# 注:* 代表Linux所有用户名称	


#2. ===最大虚拟内存太小=======
vim /etc/sysctl.conf
# 在文件中增加下面内容
vm.max_map_count=655360

# 重新加载,输入下面命令:
sysctl -p

5.启动ElasticSearch

shell 复制代码
# 切换到user用户启动
su user  
cd /opt/elasticsearch-7.8.0/bin

# 启动
./elasticsearch 

大功告成

所需要的文件

elasticsearch-7.8.0-linux-x86_64.tar.gz

相关推荐
hugerat1 天前
在AI的帮助下,用C++构造微型http server
linux·c++·人工智能·http·嵌入式·嵌入式linux
ha20428941941 天前
Linux操作系统学习记录之----自定义协议(网络计算器)
linux·网络·学习
想唱rap1 天前
MYSQL在ubuntu下的安装
linux·数据库·mysql·ubuntu
糖~醋排骨1 天前
DHCP服务的搭建
linux·服务器·网络
dust_and_stars1 天前
ubuntu24使用apt安装VS-code-server code-server
linux·服务器·windows
码农小韩1 天前
基于Linux的C++学习——循环
linux·c语言·开发语言·c++·算法
ling-451 天前
Linux-day09 11
linux·运维·服务器
202321336054 刘1 天前
Linux常用命令分类整理
linux·运维·数据库
南工孙冬梅1 天前
【久久派】 新世界系统安装
linux
zbguolei1 天前
Debian提示:“用户名” 不是 sudoers 文件
linux·服务器·debian