# 下载文件
cd /usr/local/software
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.1.zip
yum install unzip -y
unzip elasticsearch-6.2.1.zip
cd elasticsearch-6.2.1/
#添加用户
adduser elasticsearch
#给用户赋值
echo elasticsearch | passwd --stdin elasticsearch
# 给权限
chown -R elasticsearch /usr/local/software/elasticsearch-6.2.1
# 编辑文件
vi /etc/sysctl.conf
vm.max_map_count=655360
保存退出后执行:
sysctl -p
#在文件末尾添加
vi /etc/security/limits.conf
* soft nofile 204800
* hard nofile 204800
* soft nproc 204800
* hard nproc 204800
vi /etc/security/limits.d/90-nproc.conf
* soft nproc 204800
* hard nproc 204800
vi /etc/security/limits.d/def.conf
* soft nofile 204800
* hard nofile 204800
=====================================================================================================
3、安装中文分词插件
cd /usr/local/software
/usr/local/software/elasticsearch-6.2.1/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.1/elasticsearch-analysis-ik-6.2.1.zip
=====================================================================================================
# 4、 让其它IP可以访问,通过IPTABLES禁止非法IP访问,不用es自己控制。
vi /usr/local/software/elasticsearch-6.2.1/config/elasticsearch.yml
修改:
network.host: 0.0.0.0
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#然后需要重启一下elasticsearch-6.1.1
ps -ef | grep elasticsearch |awk '{print $2}'|xargs kill -9
# 以elasticsearch用户身份运行程序,而且是后台运行
su elasticsearch -l -c "/usr/local/software/elasticsearch-6.2.1/bin/elasticsearch -d"
# 调试错误
#su elasticsearch -l -c "/usr/local/software/elasticsearch-6.2.1/bin/elasticsearch"
=========================================================================================================
安装Header插件
https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm/ # 修改配置文件/usr/local/software/elasticsearch-headvi _site/app.js# 修改 『http://localhost:9200』字段到本机ES端口与IPcd elasticsearch-headgrunt servervi /usr/local/software/elasticsearch-6.2.1/config/elasticsearch.yml# 增加如下字段http.cors.enabled: truehttp.cors.allow-origin: "*"重启es和head即可
