安装ELASTICSERARCH
yum install bzip2 automake libtool gcc-c++ java-1.8.0-openjdk -y
mkdir -p /home/ELK/e
mkdir /home/ELK/e/{data,logs}
useradd elk
tar zxvf elasticsearch-5.5.0.tar.gz
mv elasticsearch-5.5.0 /home/ELK/e/
cd /home/ELK/e/elasticsearch-5.5.0/
vim config/elasticsearch.yml
#修改配置文件以下内容
cluster.name: es_cluster #ES集群名称
node.name: node-1 #这台站点名称
path.data: /home/ELK/e/data #数据存放路径
path.logs: /home/ELK/e/logs #日志存放路径
network.host: 127.0.0.1 #绑定IP,也就是别人访问ES的IP
http.port: 9200 #启动的端口
#以ELK用户启动elasticsearch,如果以root帐号启动会报错
chown -R elk.elk /home/ELK/
nohup su elk -l -c /home/ELK/e/elasticsearch-5.5.0/bin/elasticsearch &
以上为elasticsearch安装步骤。参考文章 http://mengphilip.blog.51cto.com/2243393/1690455
注意: es 必须用普通用户启动,不能用root 启动,否则会报错。
ERROR: bootstrap checks failed max file descriptors [10240] for elasticsearch process likely too low, increase to at least [65536] max number of threads [1024] for user [elsearch] likely too low, increase to at least [2048] max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144] [2016-11-14T10:22:17,569][INFO ][o.e.n.Node ] [mysteel-node1] stopping ... [2016-11-14T10:22:17,615][INFO ][o.e.n.Node ] [mysteel-node1] stopped [2016-11-14T10:22:17,615][INFO ][o.e.n.Node ] [mysteel-node1] closing ... [2016-11-14T10:22:17,638][INFO ][o.e.n.Node ] [mysteel-node1] closed
出现上面这个错误的时候,修改
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
问题三:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
问题四:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。
参考文章 http://www.cnblogs.com/sloveling/p/elasticsearch.html
下面先安装 分词器,下载地址 https://github.com/medcl/elasticsearch-analysis-ik/releases 我们选择5.50版本的,和ELASTICSEARCH对应的版本
建立ik目录 /home/ELK/e/elasticsearch-5.5.0/plugins/ik 将elasticsearch-analysis-ik上传到这个目录解压
重启elasticsearch即可
验证
curl -XGET 'http://192.168.153.128:9200/_analyze?pretty&analyzer=ik_max_word' -d '我是中国人'
这样分词搜索功能就实现了。参考文章 http://blog.csdn.net/haoxiaoyan/article/details/54668924