1.创建ElasticSearch用户组
groupadd elasticsearch
2.创建用户
useradd es
passwd es
3.添加到用户组
usermod -G elasticsearch es
4.下载elasticsearch-7.0.0-linux-x86_64.tar.gz,以及解压 目录为/usr/es
下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.0-linux- x86_64.tar.gz
解压
tar -xzvf elasticsearch-7.0.0-linux-x86_64.tar.gz
5.赋予权限
chown -R es /usr/es/elasticsearch-7.0.0
此次可能在启动时要重新执行一遍
6.给es用户分配权限
visudo
es ALL=(ALL) ALL
7.创建目录
mkdir -p /usr/es/elasticsearch-7.0.0/log
mkdir -p /usr/es/elasticsearch-7.0.0/data
8.去配置文件
cd /usr/es/elasticsearch-7.0.0/config
放开
cluster.name: my-application
node.name: node-1
http.port: 9200
修改路径
path.data: /usr/es/elasticsearch-7.0.0/data
path.logs: /usr/es/elasticsearch-7.0.0/log
network.host: 0.0.0.0
discovery.seed_hosts: ["8.218.183.123"]
cluster.initial_master_nodes: ["node-1"]
添加
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.system_call_filter: false
bootstrap.memory_lock: false
9.处理可能出来的异常
sudo vi /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
此处注意空格
sudo vi /etc/security/limits.d/40-nproc.conf
* soft nproc 4096
root soft nproc unlimited
vim /etc/sysctl.conf
vm.max_map_count=655360
sysctl -p
如果内存不够配置/usr/es/elasticsearch-7.0.0/configjvm.options