目录
1、jdk安装
[root@elk app]# ln -s jdk1.8.0_51/ jdk
[root@elk bin]# vi /etc/profile
[root@elk bin]# source /etc/profile
export JAVA_HOME=/app/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
2、es安装
#es不能用root启动
[root@elk ~]# useradd es
[root@elk ~]# passwd es
[root@elk ~]# groupadd es
[root@elk ~]# usermod -G es es
[root@elk app]# chown -R es:es elasticsearch-6.6.1/
[es@elk elasticsearch-6.6.1]$ vi /app/elasticsearch-6.6.1/config/elasticsearch.yml
network.host: 192.168.198.136
http.port: 9200
3、es启动报错问题解决
************************************************************************************************
问题一: [2019-03-06T17:21:21,129][WARN ][o.e.b.JNANatives ] [unknown] unable to install syscall filter: java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
原因:报了一大串错误,大家不必惊慌,其实只是一个警告,主要是因为你 Linux 版本过低 造成的。
解决: 1、重新安装新版本的 Linux 系统 2、警告不影响使用,可以忽略
************************************************************************************************
问题二: [1]ERROR: bootstrap checks failed max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536] 原因:无法创建本地文件问题,用户最大可创建文件数太小
解决: 切换到 root 用户, vi /etc/security/limits.conf 添加如下内容: * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096 备注:* 代表 Linux 所有用户名称(比如 es) 保存、退出、重新登录才可生效
************************************************************************************************
问题三: [2]max number of threads [1024] for user [es] likely too low, increase to at least [2048]
原因:无法创建本地线程问题,用户最大可创建线程数太小
解决:切换到 root 用户,vi /etc/security/limits.d/90-nproc.conf 找到如下内容: * soft nproc 1024 #修改为 * soft nproc 4096
************************************************************************************************
问题四: [3]max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
原因:最大虚拟内存太小
解决:切换到 root 用户下,vi /etc/sysctl.conf
添加下面配置: vm.max_map_count=655360
并执行命令(配置生效): sysctl -p
************************************************************************************************
问题五: 报错: [4]ERROR: bootstrap checks failed system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因: 这是在因为 Centos6 不支持 SecComp,而 ES5.6.4 默认 bootstrap.system_call_filter 为 true 进 行检测,所以导致检测失败,失败后直接导致 ES 不能启动。
解决: 在 elasticsearch.yml 中在 Memory 下面: bootstrap.memory_lock: false bootstrap.system_call_filter: false
************************************************************************************************
reboot后重新启动即可。
[es@elk bin]$ sh /app/elasticsearch-6.6.1/bin/elasticsearch************************************************************************************************
4、测试es启动成功url
[root@elk bin]# curl http://192.168.198.136:9200
{
"name" : "KZsaE_I",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "10Qr2peaTS-AMQDS6bI8hQ",
"version" : {
"number" : "6.6.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "1fd8f69",
"build_date" : "2019-02-13T17:10:04.160291Z",
"build_snapshot" : false,
"lucene_version" : "7.6.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
5、head插件安装
head是一个用于管理Elasticsearch的web前端插件。
#搭建安装环境,下载head插件
[root@elk bin]# yum -y install nodejs npm git -y
*添加仓库参照https://blog.csdn.net/xiao_jun_0820/article/details/50838185
*npm事务测试报错,改为源码安装https://npm.taobao.org/mirrors/npm/
[root@elk bin]# git clone git://github.com/mobz/elasticsearch-head.git
5、head相关插件配置
[root@elk elasticsearch-head]# vi Gruntfile.js
server: {
options: {
port: 9100,
base: '.',
keepalive: true,
hostname: '*'
}
[root@elk elasticsearch-head]# vi _site/app.js
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.198.136:9200";
[root@elk elasticsearch-head]# vi /app/elasticsearch-6.6.1/config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
保存配置后重启es
6、后台启动head服务,url测试
[root@elk bin]# sh /app/elasticsearch-head/node_modules/grunt/bin/grunt server &
[root@elk bin]# curl http://192.168.198.136:9100/
右上角显示-集群健康值: green (0 of 0)说明es-head正常启动,索引等搭建见下一篇。一段时间后启动head报错
[root@elk /]# sh /app/elasticsearch-head/node_modules/grunt/bin/grunt server &
[1] 1583
[root@elk /]# /app/elasticsearch-head/node_modules/grunt/bin/grunt: line 3: syntax error near unexpected token `'grunt-cli/bin/grunt''
/app/elasticsearch-head/node_modules/grunt/bin/grunt: line 3: `require('grunt-cli/bin/grunt');'解决:
[root@elk elasticsearch-head]# npm install -g grunt-cli
[root@elk elasticsearch-head]# grunt server &