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
相關文章
相關標籤/搜索