elasticsearch6 学习之安装

2018-02-26 08:11:03来源:cnblogs.com作者:小禾点点人点击

分享

安装环境:centos6.5  64位      jdk1.8      elasticsearch6.1.1

一、启动 [root@localhost bin]# ./elasticsearch -d -d在后台启动

启动异常: java.lang.RuntimeException: can not run elasticsearch as root(注:ES有执行脚本的能力,因安全因素,不能在root用户下运行,)
解决方案:创建一个es用户,使用 es用户启动
[root@localhost bin]# groupadd es
[root@localhost bin]# useradd es -g es -p 111111
[root@localhost bin]# chown -R es:es /usr/local/elasticsearch6.1/
[root@localhost bin]# su es
[es@localhost bin]$ ./elasticsearch -d
[es@localhost bin]$ ps -ef|grep java
es 1800 1 86 21:47 pts/0 00:00:11 /usr/local/jdk1.8/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/usr/local/elasticsearch6.1 -Des.path.conf=/usr/local/elasticsearch6.1/config -cp /usr/local/elasticsearch6.1/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
es 1820 1760 0 21:47 pts/0 00:00:00 grep java


:::* LISTEN 1800/java

二、查看是否启动成功

查看端口是否开启:
[root@localhost config]# netstat -nalp|grep 9200
tcp 0 0 ::ffff:127.0.0.1:9200 :::* LISTEN 1800/java
tcp 0 0 ::1:9200

[root@localhost bin]# curl -v http://127.0.0.1:9200 curl模拟http请求

三、设置外网访问
vim conf/elasticsearch.yml
修改:network.host: 0.0.0.0

再次启动elasticsearch 可能出现如下类似错误
1、bootstrap checks failed
max file descriptors [65535] for elasticsearch process is 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

vi /etc/security/limits.d/90-nproc.conf

修改
* soft nproc 1024
#修改为
* soft nproc 2048


vi /etc/sysctl.conf

添加下面配置:
vm.max_map_count=655360
并执行命令:sysctl -p

2、system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false


四、http://192.168.0.56:9200/ 访问地址

五、el的目录结构:

 

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台