ElasticSearch 学习笔记 - 1. 安装、配置

一、安装JDK8

java

二、建立用户

建立bigdata 用户组

groupadd bigdata

建立用户es,并修改密码

useradd es
passwd es

将es用户添加到bigdata组

usermod -G bigdata es

visudo 权限设置

找到root ALL=(ALL) ALL一行,添加es用户,以下。bootstrap

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
es      ALL=(ALL)       ALL

切换用户

su es

三、ElasticSearch 6.x 软件包下载

官网: https://www.elastic.co/produc...
下载:浏览器

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz

解压:elasticsearch

tar -zxf elasticsearch-6.4.2.tar.gz

四、修改配置

修改elasticsearch.yml

vi config/elasticsearch.yml

修改host和portide

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.70.4
#
# Set a custom port for HTTP:
#
http.port: 9200

修改/etc/sysctl.conf

添加spa

vm.max_map_count=262144

使用修改生效code

sysctl -p

修改文件/etc/security/limits.conf

添加如下内容server

* hard nofile 65536
* soft nofile 65536

* soft nproc 2048
* hard nproc 4096

五、ElasticSearch启动与中止

直接启动ip

bin/elasticsearch

中止
ctrl+c

后台启动ci

bin/elasticsearch -d

验证

jps

61562 Jps
61503 Elasticsearch

浏览器 :http://hserver3:9200/

clipboard.png

六、问题解决

1. 权限问题

Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to Permission denied

Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /home/es/elasticsearch-6.4.2/config/elasticsearch.keystore
Likely root cause: java.nio.file.AccessDeniedException: /home/es/elasticsearch-6.4.2/config/elasticsearch.keystore

解决方法:
由于第一次启动不当心用了root启动,致使用root生成了对应的文件。切换es帐号以后,没有对应文件的权限致使,删除相关的东西便可。

2. max number of threads [1024]

ERROR: [2] bootstrap checks failed
[1]: max number of threads [1024] for user [es] is too low, increase to at least [4096]
[2]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

解决:

ulimit -a

max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
vi /etc/security/limits.d/90-nproc.conf 

# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

* hard nproc 4096
* soft nproc 4096
*          soft    nproc     4096
root       soft    nproc     unlimited

3. 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.2.0默认bootstrap.system_call_filter为true进行检测,因此致使检测失败,失败后直接致使ES不能启动。

解决:

在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
相关文章
相关标签/搜索