之前使用es,都是直接在Windows操作,因为安装特别简单,这次向深入学习下ES,没想到Linux的安装这么多报错,记录下
一、安装Elasticsearch
参考博客:https://blog.csdn.net/widely5201/article/details/104359871
1、解压压缩包Elasticsearch:
[root@localhost ~]# cd /opt
[root@localhost opt]# tar -zvxf elasticsearch-6.5.4.tar.gz
[root@localhost bin]# ./elasticsearch
报错:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid24562.log
2、修改config下面的jvm.options
-Xms512m
-Xmx512m
3、修改配置文件elasticsearch.yml
network.host: 0.0.0.0
http.port: 9200
4、启动:
[root@localhost bin]# ./elasticsearch
报错:
can not run elasticsearch as root
5、创建用户和用户组
[root@localhost elasticsearch-6.5.4]# adduser es
[root@localhost elasticsearch-6.5.4]# passwd es
更改用户 es 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost elasticsearch-6.5.4]# chown es /opt/elasticsearch-6.5.4/ -R
[root@localhost elasticsearch-6.5.4]# chown -R es:es /opt/elasticsearch-6.5.4/
6、vi /etc/security/limits.conf:添加
es soft nofile 65536
es hard nofile 65536
es soft nproc 4096
es hard nproc 4096
7、 vi /etc/security/limits.d/20-nproc.conf,将* 改为用户名(es)
[root@localhost elasticsearch-6.5.4]# vi /etc/security/limits.d/20-nproc.conf
8、vi /etc/sysctl.conf,添加
vm.max_map_count = 655360
9、让配置文件生效
[root@localhost elasticsearch-6.5.4]# sysctl -p
10、重启elasticsearch:成功
[esuser@localhost elasticsearch-6.5.4]$ ./bin/elasticsearch
11、浏览器远程访问:
二、安装kibana
参考博客:https://www.cnblogs.com/nijunyang/p/12541542.html
参考博客:https://www.cnblogs.com/gwyy/p/12205250.html
1、解压压缩包:在/opt目录下
2、vi config/kibana.yml
server.port: 5601 端口
server.host: "0.0.0.0" 开放外网访问
elasticsearch.url: "http://192.168.157.130:9200" es的服务器
3、启动:
nohup ./bin/kibana &
三、IK分词器
1、下载压缩包:https://github.com/medcl/elasticsearch-analysis-ik/releases?after=v6.8.2
2、在plugins目录下创建IK,然后把解压的文件放进去即可
3、重启ES