Elasticsearch-01CentOS7单节点部署ES5.6.16
文章目錄
- 概述
- ES版本
- ES單實例安裝
- 防火墻檢查
- JDK版本
- ES下載
- root用戶修改系統(tǒng)參數(shù)
- 新建普通用戶elastic 安裝es
- es設置 elasticsearch.yml
- JVM設置 jvm.options
- 問題一: 瀏覽器中無法通過 http://ip:9200 訪問
- 問題二 : max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
- 問題三: max number of threads [1024] for user [elastic] is too low, increase to at least [4096]
- 問題四 :max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
- 問題五: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
- es 后臺運行
- Install Elasticsearch with Docker
概述
April 11, 2019 ,ES 發(fā)布了7.0.0 版本。 ES是一個搜索引擎,基于Lucene,提供了基于RESTful 的web接口,能夠達到實時,穩(wěn)定,可靠,快速的搜索引擎。
官網(wǎng): https://www.elastic.co/
Github: https://github.com/elastic/elasticsearch
中文論壇:https://elasticsearch.cn/
英文論壇: https://discuss.elastic.co/
銘毅天下的ES專欄寫的很全面豐富,可以學習一下:https://blog.csdn.net/wojiushiwo987/column/info/deep-elasticsearch
ES版本
1.x —> 2.x —> 5.x —>6.x —>7.x
說下這個從2.x到5.x版本變更,ES屬于ELK技術棧中的一員,ELK中的版本比較混亂,為了統(tǒng)一版本號,所以直接跳到了5.x的版本 。
ES單實例安裝
April 11, 2019 ,ES 發(fā)布了7.0.0 版本。跟不上趟了快。。。。
先用5.6.16版本來折騰下吧
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html
防火墻檢查
關閉防火墻或者開放指定的端口
JDK版本
JDK對應版本JDK8+
[root@localhost ~]# java -version openjdk version "1.8.0_201" OpenJDK Runtime Environment (build 1.8.0_201-b09) OpenJDK 64-Bit Server VM (build 25.201-b09, mixed mode) [root@localhost ~]#ES下載
進入官網(wǎng),右上角Download ,點擊進入 ,往下拉找到 past releases
選擇 ElasticSearch 5.x
https://www.elastic.co/downloads/past-releases/elasticsearch-5-6-16
root用戶修改系統(tǒng)參數(shù)
#!/bin/bash echo "* soft nproc 2048" >> /etc/security/limits.conf echo "* hard nproc 4096" >> /etc/security/limits.conf echo "* soft nofile 65536" >> /etc/security/limits.conf echo "* hard nofile 65536" >> /etc/security/limits.conf echo "* soft memlock unlimited" >> /etc/security/limits.conf echo "* hard memlock unlimited" >> /etc/security/limits.conf echo "vm.max_map_count = 262144" >> /etc/sysctl.conf sysctl -p ulimit -l unlimited-
soft nproc: 單個用戶可用的最大進程數(shù)量(軟限制)
-
hard nproc: 單個用戶可用的最大進程數(shù)量(硬限制)
-
soft nofile:單個用戶可打開的最大文件描述符數(shù)量(軟限制)
-
hard nofile:單個用戶可打開的最大文件描述符數(shù)量(硬限制)
-
max_map_count文件包含限制一個進程可以擁有的VMA(虛擬內(nèi)存區(qū)域)的數(shù)量。 默認65536
新建普通用戶elastic 安裝es
elasticsearch出于安全考慮,只能用非root用戶啟動 .
所以新建用戶elastic ,把剛才下載的elasticsearch-5.6.16.tar.gz 放到 /home/elastic 下解壓
es設置 elasticsearch.yml
/home/elastic/elasticsearch-5.6.16/config/elasticsearch.yml
其他參數(shù)見官網(wǎng): https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html
JVM設置 jvm.options
/home/elastic/elasticsearch-5.6.16/config/elasticsearch.ymlES默認是2G堆內(nèi)存,當內(nèi)存不足時,調(diào)整elasticsearch的內(nèi)存
-Xms4g -Xmx4g其他參數(shù)見官網(wǎng):https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html
問題一: 瀏覽器中無法通過 http://ip:9200 訪問
ElasticSearch默認的對外服務的HTTP端口是9200,節(jié)點間交互的TCP端口是9300
http://192.168.91.128:9200/ 訪問不了時,elasticsearch.yml中network.host指定為服務器本身的ip 或者 0.0.0.0 即可。
重啟es ,訪問 http://192.168.91.128:9200/
-bash-4.2$ ./elasticsearch [2019-04-18T05:18:06,141][INFO ][o.e.n.Node ] [] initializing ... [2019-04-18T05:18:07,143][INFO ][o.e.e.NodeEnvironment ] [rMTKRxD] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [12.8gb], net total_space [17.6gb], spins? [unknown], types [rootfs] [2019-04-18T05:18:07,144][INFO ][o.e.e.NodeEnvironment ] [rMTKRxD] heap size [1.9gb], compressed ordinary object pointers [true] [2019-04-18T05:18:07,147][INFO ][o.e.n.Node ] node name [rMTKRxD] derived from node ID [rMTKRxDTTQCznZ476RGYEg]; set [node.name] to override [2019-04-18T05:18:07,148][INFO ][o.e.n.Node ] version[5.6.16], pid[42265], build[3a740d1/2019-03-13T15:33:36.565Z], OS[Linux/3.10.0-123.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_201/25.201-b09] [2019-04-18T05:18:07,148][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/home/elastic/elasticsearch-5.6.16] [2019-04-18T05:18:16,186][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [aggs-matrix-stats] [2019-04-18T05:18:16,199][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [ingest-common] [2019-04-18T05:18:16,199][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [lang-expression] [2019-04-18T05:18:16,200][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [lang-groovy] [2019-04-18T05:18:16,200][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [lang-mustache] [2019-04-18T05:18:16,200][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [lang-painless] [2019-04-18T05:18:16,201][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [parent-join] [2019-04-18T05:18:16,201][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [percolator] [2019-04-18T05:18:16,201][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [reindex] [2019-04-18T05:18:16,201][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [transport-netty3] [2019-04-18T05:18:16,202][INFO ][o.e.p.PluginsService ] [rMTKRxD] loaded module [transport-netty4] [2019-04-18T05:18:16,203][INFO ][o.e.p.PluginsService ] [rMTKRxD] no plugins loaded [2019-04-18T05:18:24,465][INFO ][o.e.d.DiscoveryModule ] [rMTKRxD] using discovery type [zen] [2019-04-18T05:18:26,657][INFO ][o.e.n.Node ] initialized [2019-04-18T05:18:26,657][INFO ][o.e.n.Node ] [rMTKRxD] starting ... [2019-04-18T05:18:27,594][INFO ][o.e.t.TransportService ] [rMTKRxD] publish_address {192.168.91.128:9300}, bound_addresses {[::]:9300} [2019-04-18T05:18:27,621][INFO ][o.e.b.BootstrapChecks ] [rMTKRxD] bound or publishing to a non-loopback address, enforcing bootstrap checks [2019-04-18T05:18:29,492][INFO ][o.e.m.j.JvmGcMonitorService] [rMTKRxD] [gc][young][2][4] duration [933ms], collections [1]/[1.5s], total [933ms]/[3.4s], memory [130mb]->[49.6mb]/[1.9gb], all_pools {[young] [107.7mb]->[18.6mb]/[133.1mb]}{[survivor] [16.4mb]->[16.6mb]/[16.6mb]}{[old] [5.8mb]->[16.9mb]/[1.8gb]} [2019-04-18T05:18:29,501][WARN ][o.e.m.j.JvmGcMonitorService] [rMTKRxD] [gc][2] overhead, spent [933ms] collecting in the last [1.5s] [2019-04-18T05:18:31,594][INFO ][o.e.c.s.ClusterService ] [rMTKRxD] new_master {rMTKRxD}{rMTKRxDTTQCznZ476RGYEg}{8hR6L-tHTV6W8R5eRxnQNQ}{192.168.91.128}{192.168.91.128:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) [2019-04-18T05:18:32,328][INFO ][o.e.g.GatewayService ] [rMTKRxD] recovered [0] indices into cluster_state [2019-04-18T05:18:32,629][INFO ][o.e.h.n.Netty4HttpServerTransport] [rMTKRxD] publish_address {192.168.91.128:9200}, bound_addresses {[::]:9200} [2019-04-18T05:18:32,630][INFO ][o.e.n.Node ] [rMTKRxD] started問題二 : max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
無法創(chuàng)建本地文件問題,用戶最大可創(chuàng)建文件數(shù)太小
執(zhí)行 root用戶修改系統(tǒng)參數(shù)中的腳本即可
問題三: max number of threads [1024] for user [elastic] is too low, increase to at least [4096]
無法創(chuàng)建本地線程問題,用戶最大可創(chuàng)建線程數(shù)太小
執(zhí)行 root用戶修改系統(tǒng)參數(shù)中的腳本即可
問題四 :max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
最大虛擬內(nèi)存太小
執(zhí)行 root用戶修改系統(tǒng)參數(shù)中的腳本即可
問題五: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
如果是Centos6的話,CentOS 6內(nèi)核不支持SecComp,而ES 5x默認是要執(zhí)行檢測命,把這個環(huán)境檢測禁掉即可 ,elasticsearch.yml中追加如下配置.
bootstrap.system_call_filter: falsees 后臺運行
后臺以守護進程模式運行, 添加 -d 參數(shù)
-bash-4.2$ /home/elastic/elasticsearch-5.6.16/bin/elasticsearch -d -bash-4.2$ -bash-4.2$ netstat -anp|grep 9200 (Not all processes could be identified, non-owned process infowill not be shown, you would have to be root to see it all.) tcp6 0 0 :::9200 :::* LISTEN 42443/java -bash-4.2$ ps -ef|grep 42443 elastic 42443 1 15 05:22 pts/0 00:00:43 /bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/home/elastic/elasticsearch-5.6.16 -cp /home/elastic/elasticsearch-5.6.16/lib/* org.elasticsearch.bootstrap.Elasticsearch -d elastic 42547 11339 0 05:26 pts/0 00:00:00 grep --color=auto 42443 -bash-4.2$ netstat -anp|grep 9300 (Not all processes could be identified, non-owned process infowill not be shown, you would have to be root to see it all.) tcp6 0 0 :::9300 :::* LISTEN 42443/java -bash-4.2$Install Elasticsearch with Docker
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
總結
以上是生活随笔為你收集整理的Elasticsearch-01CentOS7单节点部署ES5.6.16的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring Cloud【Finchle
- 下一篇: Elasticsearch-02Cent