安装7.3.0

373 阅读1分钟

下载

下载地址:

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.0-linux-x86_64.tar.gz

解压

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

修改配置文件

  1. 编辑elasticsearch.yml
vi /usr/local/elasticsearch/config/elasticsearch.yml

#单机安装取消注释:node.name: node-1,否则无法正常启动。(注意冒号后面有个空格)
node.name: node-1

#修改网络和端口,如果是云服务器,则此处设置为云服务器的内网地址
network.host: 172.0.0.1
http.port: 9200



#取消注释master节点,单机只保留一个node
cluster.initial_master_nodes: ["node-1"]
  1. 按需修改占用内存
vi /usr/local/elasticsearch/config/jvm.options


# 根据实际情况修改占用内存,默认都是1G,单机1G内存,启动会占用700M+然后在安装kibana后,基本上无法运行了,运行了一会就挂报内存不足。内存设置超出物理内存,也会无法启动。

-Xms1g
-Xmx1g
  1. 添加es用户,es默认root用户无法启动,需要改为其他用户
useradd estest

#修改用户密码
passwd estest

#改变es目录拥有者账号
chown -R estest /usr/local/elasticsearch/
  1. 修改/etc/sysctl.conf
vi /etc/sysctl.conf

#末尾添加
vm.max_map_count=655360


#保存退出,执行sysctl -p 让其生效
sysctl -p
  1. 修改/etc/security/limits.conf
vi /etc/security/limits.conf

#末尾添加

*    soft   nofile    65536

*    hard   nofile    65536

*    soft   nproc    4096

*    hard   nproc    4096
  1. 启动es
# 切换刚刚新建的用户
su estest

#启动命令
./usr/local/elasticsearch/bin/elasticsearch

#后台启动(若不后台启动,在关闭xshell链接窗口以后就会停止es服务)
nohup ./usr/local/elasticsearch/bin/elasticsearch &