1.elasticsearch 压缩包放到 /work 下 解压 tar -zxvf elasticsearch-5.4.2.tar.gz
2.解压elasticsearch-analysis-ik-5.4.2.zip 放到 安装目录的 plugins/ik
3.如果是以root用户登录并执行的上述命令,则会看到的错误提示需要新建用户 命令如下
useradd elasearch
修改文件所有用户chown -R elasearch /work/elasticsearch-5.4.2/
4.启动
su elasearch
./bin/elasticsearch &
5.elasticsearch的库
特别注意,elasticsearch配置:
/work/elasticsearch-5.4.2/config/elasticsearch.yml
添加
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
bootstrap.system_call_filter: false
es默认集群名字为cluster.name: my-application
在内网连通的情况下会自动寻找集群
测试es开启的时候,一定要指定一个与默认cluster.name不一致的名字
6.注意问题
修改以下错误需切换root用户
错误1: max number of threads [1024] for user [elasearch] is too low, increase to at least [2048]
添加或修改 /etc/security/limits.d/90-nproc.conf 中下面这句话
* softnproc 4096
错误2:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
执行 在/etc/sysctl.conf 最后一行添加 vm.max_map_count=262144
错误3:max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]
执行 ulimit -n 65536
错误4 :system call bootstrap.system_call_filter: false
添加 vim /etc/security/limits.conf
soft memlock unlimited
hard memlock unlimited
错误5 :max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
执行 cp /etc/security/limits.conf /etc/security/limits.conf.bak
cat /etc/security/limits.conf | grep -v "elasearch" > /tmp/system_limits.conf
echo "elasearch hard nofile 65536" >> /tmp/system_limits.conf
echo "elasearch soft nofile 65536" >> /tmp/system_limits.conf
mv /tmp/system_limits.conf /etc/security/limits.conf