Elasticsearch 安装笔记

今天玩了下Elastic官网:https://www.elastic.co/cn/ 下的两个产品 Elasticsearch 和 Kibana

安装笔记如下下载elasticsearch

https://www.elastic.co/cn/downloads/elasticsearch

第一步 下载完上传解压

重命名成elasticsearch

安装了jdk1.8才能运行

第二步 出于安全考虑,elasticsearch默认不允许以root账号运行。

创建用户:

useradd feng

设置密码:

passwd xxx 
chown feng:groupfeng elasticsearch -R          (在root用户下给elasticsearch 文件目录下的全部修改拥有者改为feng:和groupfeng这个组)

切换用户:

su  feng

第三部 修改配置

我们把data和logs目录修改指向了elasticsearch的安装目录。但是这两个目录并不存在,因此我们需要创建出来。

进入elasticsearch的根目录,然后创建:

mkdir data
mkdir logs

 


cd config
vi elasticsearch.yml

network.host: 0.0.0.0 # 绑定到0.0.0.0,允许任何ip来访问 默认只允许本机访问,修改为0.0.0.0后则可以远程访问

elasticsearch.yml的其它可配置信息:

属性名 说明
cluster.name 配置elasticsearch的集群名称,默认是elasticsearch。建议修改成一个有意义的名称。
node.name 节点名,es会默认随机指定一个名字,建议指定一个有意义的名称,方便管理
path.conf 设置配置文件的存储路径,tar或zip包安装默认在es根目录下的config文件夹,rpm安装默认在/etc/ elasticsearch
path.data 设置索引数据的存储路径,默认是es根目录下的data文件夹,可以设置多个存储路径,用逗号隔开
path.logs 设置日志文件的存储路径,默认是es根目录下的logs文件夹
path.plugins 设置插件的存放路径,默认是es根目录下的plugins文件夹
bootstrap.memory_lock 设置为true可以锁住ES使用的内存,避免内存进行swap
network.host 设置bind_host和publish_host,设置为0.0.0.0允许外网访问
http.port 设置对外服务的http端口,默认为9200。
transport.tcp.port 集群结点之间通信端口
discovery.zen.ping.timeout 设置ES自动发现节点连接超时的时间,默认为3秒,如果网络延迟高可设置大些
discovery.zen.minimum_master_nodes 主结点数量的最少值 ,此值的公式为:(master_eligible_nodes / 2) + 1 ,比如:有3个符合要求的主结点,那么这里要设置为2

vi jvm.options 内存大小更加自己情况调整

第四步 进入elasticsearch/bin目录,可以看到下面的执行文件:

./elasticsearch

启动报错是百度得知是因为linux内核版本为2.6。而Elasticsearch的插件要求至少3.5以上版本内核过低做如下配置

修改elasticsearch.yml文件,在最下面添加如下配置bootstrap.system_call_filter: false

再次启动报

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

是因为 feng用户权限不足

vim /etc/security/limits.conf

* soft nofile 65536

* hard nofile 131072

* soft nproc 4096

* hard nproc 4096

[1]: max number of threads [1024] for user [leyou] is too low, increase to at least [4096]

这是线程数不够。

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

* soft nproc 1024 改为

* soft nproc 4096

 

[3]: max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

 vm.max_map_count:限制一个进程可以拥有的VMA(虚拟内存区域)的数量,继续修改配置文件, :

 vim /etc/sysctl.conf 

添加下面内容:

vm.max_map_count=655360

保存后运行

sysctl -p 

再次使feng 用户重启OK

 浏览器

 

证明启动没问题了

再就是安装

猜你喜欢

转载自www.cnblogs.com/javademo/p/10510053.html