centos安装es环境
安装jdk
rpm -qa |grep java
rpm -qa |grep jdk
rpm -qa |grep gcj
rpm -e
yum install java-1.8.0-openjdk* -y
java -version
下载elasticsearch-6.2.4
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz
tar -zxvf elasticsearch-6.2.4.tar.gz
新建一个es组和用户
groupadd es #新建组
useradd es -g es #新建用户
sudo chown es:es /usr/local/elasticsearch-6.2.4
su es #切换用户
修改配置文件
vim conf/elasticsearch
path.data: /usr/local/elasticsearch-6.2.4/data
path.logs: /usr/local/elasticsearch-6.2.4/logs
mkdir data
network.host: 0.0.0.0
vim conf/jvm.options
-Xms512m
-Xmx512m
启动
bin/elasticsearch
中文分词: elasticsearch-analysis-ik
https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.4/elasticsearch-analysis-ik-6.2.4.zip
mv elasticsearch-analysis-ik-6.2.4.zip ./elasticsearch-6.2.4/plugins/
unzip elasticsearch-analysis-ik-6.2.4.zip
rm elasticsearch-analysis-ik-6.2.4.zip
bin/elasticsearch
新装es启动时,会遇到以下错误情况:
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
解决办法:
编辑 /etc/security/limits.conf,追加以下内容;
- soft nofile 65536
- hard nofile 65536
此文件修改后需要重新登录用户,才会生效
[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=655360
保存后,执行:
sysctl -p
systemctl stop firewalld.service
docker exec -it e6c060f721fc nginx -s reload
最大尝试次数
php artisan queue:work --tries=3