天天看点

elasticsearch5.x系列之一 开始安装啦es 安装之单节点和多节点模式安装

以下是镇楼用的,各路退让,我要吹liubi 了

//
//                       _oo0oo_
//                      o8888888o
//                      88" . "88
//                      (| -_- |)
//                      0\  =  /0
//                    ___/`---'\___
//                  .' \\|     |// '.
//                 / \\|||  :  |||// \
//                / _||||| -:- |||||- \
//               |   | \\\  -  /// |   |
//               | \_|  ''\---/''  |_/ |
//               \  .-\__  '-'  ___/-. /
//             ___'. .'  /--.--\  `. .'___
//          ."" '<  `.___\_<|>_/___.' >' "".
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//         \  \ `_.   \_ __\ /__ _/   .-` /  /
//     =====`-.____`.___ \_____/___.-`___.-'=====
//                       `=---='
//
//
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//               佛祖保佑         永无BUG
//
//
//
           

es 安装之单节点和多节点模式安装

es 单节点模式安装

(Elastic 是java 写的搜索和分析引起,依赖jdk安装)
单节点安装:
I, 到Elasticsearch 官网上,把安装包下载到本地,

II, 解压tar包,并且配置conf 目录下面的elasticsearch.yml
目录内容大致如下:
[[email protected] elastic]# ls
bin  config  data  lib  LICENSE.txt  modules  NOTICE.txt  plugins
[[email protected] elastic]# ls config/
elasticsearch.yml  jvm.options  log4j2.properties  scripts
[[email protected] elastic]#

III, 把tar 包的文件和目录改成非root 用户。es 建议不要使用root 用户启动。
[[email protected] elastic]# ll
total 
drwxr-xr-x   elsearch elsearch    Jun  : bin
drwxr-xr-x   elsearch elsearch    Jun  : config
drwxr-xr-x   elsearch elsearch    Jun  : data
drwxr-xr-x   elsearch elsearch    Jun  : lib
-rwxr-xr-x   elsearch elsearch   Jun  : LICENSE.txt
drwxr-xr-x  elsearch elsearch    Jun  : modules
-rwxr-xr-x   elsearch elsearch  Jun  : NOTICE.txt
drwxr-xr-x   elsearch elsearch    Jun  : plugins
[[email protected] elastic]#


IV, 启动ElasticSearch  
./bin/elasticsearch 或者./bin/elasticsearch -d

elastic 的配置文档如下参考如下:
单节点elasticsearch.yml 配置
cluster.name: my-cluser
node.name: s100
network.host: 
http.port: 
#http.cors.enabled: true
#http.cors.allow-origin: "*"
#node.master: true
#node.data: true
#discovery.zen.ping.unicast.hosts: ["s100", "s101","s102"]
bootstrap.system_call_filter: false
           

集群安装模式

参考单节点配置,

每个节点的配置模板如下:

有问题欢迎来战,哦不,欢迎来撩,哦不,欢迎来问。

cluster.name: my-cluser
node.name: s100    --------> 对应每个节点,需要配置成相应的hostname, 或者ip 
network.host: 192.168.1.132    --------> 对应每个节点,需要配置成相应的hostname, 或者ip 
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["s100", "s101","s102"]
bootstrap.system_call_filter: false
           

启动需要到每一个节点上面进行启动es 服务。启动方式和单节点启动一样。

注意启动如果报错,请到安装目录的log目录下查看错误日记,然后,度娘去吧。

常见问题以及解决方案如下:

问题一:

[--T16::,][WARN ][o.e.b.JNANatives ] unable to install syscall filter:

Java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel + with CONFIG_SECCOMPandCONFIG_SECCOMP_FILTERcompiledinatorg.elasticsearch.bootstrap.Seccomp.linuxImpl(Seccomp.java:) ~[elasticsearch-.jar:]

at org.elasticsearch.bootstrap.Seccomp.init(Seccomp.java:) ~[elasticsearch-.jar:]

原因:报了一大串错误,大家不必惊慌,其实只是一个警告,主要是因为你Linux版本过低造成的。

解决方案:
、重新安装新版本的Linux系统
、警告不影响使用,可以忽略

问题二:
ERROR: bootstrap checks failed

max file descriptors [] for elasticsearch process likely too low, increase to at least []

原因:无法创建本地文件问题,用户最大可创建文件数太小

解决方案:
切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:

vi /etc/security/limits.conf

添加如下内容:
*  soft nofile 
* hard nofile 
* soft nproc 
* hard nproc 
备注:* 代表Linux所有用户名称(比如 hadoop)

保存、退出、重新登录才可生效

问题三:
max number of threads [] for user [es] likely too low, increase to at least []
原因:无法创建本地线程问题,用户最大可创建线程数太小
解决方案:切换到root用户,进入limits.d目录下,修改-nproc.conf 配置文件。

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

找到如下内容:

* soft nproc 

#修改为

* soft nproc 

问题四:
max virtual memory areas vm.max_map_count [] likely too low, increase to at least []
原因:最大虚拟内存太小
解决方案:切换到root用户下,修改配置文件sysctl.conf

vi /etc/sysctl.conf

添加下面配置:

vm.max_map_count=

并执行命令:

sysctl -p

然后重新启动elasticsearch,即可启动成功。

问题五:
ElasticSearch启动找不到主机或路由
原因:ElasticSearch 单播配置有问题
解决方案:
检查ElasticSearch中的配置文件
vi  config/elasticsearch.yml
找到如下配置:

discovery.zen.ping.unicast.hosts:["192.168.**.**:9300","192.168.**.**:9300"]
一般情况下,是这里配置有问题,注意书写格式

问题六:
org.elasticsearch.transport.RemoteTransportException: Failed to deserialize exception response from stream

原因:ElasticSearch节点之间的jdk版本不一致

解决方案:ElasticSearch集群统一jdk环境

问题七:
Unsupported major.minor version 

原因:jdk版本问题太低
解决方案:更换jdk版本,ElasticSearch5支持jdk1

问题八:
bin/elasticsearch-plugin install license
ERROR: Unknown plugin license

原因:ElasticSearch5以后插件命令已经改变
解决方案:使用最新命令安装所有插件
bin/elasticsearch-plugin install x-pack


[--T07::,][INFO ][o.e.b.BootstrapChecks    ] [node-] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: [] bootstrap checks failed
[]: max size virtual memory [] for user [es] is too low, increase to [unlimited]

启动的时候:
ulimit -v unlimited
           

最后,不用太感谢了哦。

继续阅读