Elasticsearch 是一个分布式搜索引擎,相似产品还有solr-cloud 。Elasticsearch 相对于solr 而言,随着容量的变化,效率会比solr高,特点就是速度快。ES使用者众多,如:StackOverflow、github、维基百科等。

Elasticsearch 至少需要在java1.8 平台,官方建议使用 oracle jdk 1.8.0_131版本。

一、下载安装elasticsearch:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.1.tar.gz -O /opt/elasticsearch-5.6.1.tar.gz
tar xf /opt/elasticsearch-5.6.1.tar.gz -C /usr/local
vim /usr/local/elasticsearch-5.6.1/config/elasticsearch.yml #编辑elastic配置文件修改成如下内容
cluster.name: logging-cpy #集群名称
node.name: cpy04.dev.xjh.com #es节点ID
path.data: /usr/local/elasticsearch-5.6.1/data #es数据存放路径
path.logs: /usr/local/elasticsearch-5.6.1/logs #es 日志存放路径
bootstrap.memory_lock: true #禁用内存交换功能,防止性能瓶颈
network.host: 192.168.12.164 #集群通信节点地址,默认使用回环地址
http.port: 9200 #es 端口
discovery.zen.ping.unicast.hosts: ["192.168.12.164"] #将同一集群节点全部添加到列表中,会定期扫描急群众服务器的9300和9405端口,做健康检查
discovery.zen.minimum_master_nodes: 1 #防止脑裂,计算公式为"主节点个数/2 + 1" ,例如单点就是1 ,比如3个就是(3/2+1)=2

  

二、 配置系统内存锁定(由于es 配置文件中配置了内存锁定,如果系统不锁定会报:memory locking requested for elasticsearch process but memory is not locked)

vim /etc/security/limits.conf #添加如下内容
* soft memlock unlimited
* hard memlock unlimited

三、配置可创建最大文件(解决:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536])

vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536

四、配置可创建线程数(解决:max number of threads [1024] for user [elastic] is too low, increase to at least [2048])

vim /etc/security/limits.d/90-nproc.conf
#* soft nproc 1024 #注释这行改为2048
* soft nproc 2048
root soft nproc unlimited

五、修改最大虚拟内存大小(解决:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144])

vim /etc/sysctl.conf #添加如下内容
# max virtual memory size
vm.max_map_count=633360
保存退出后使用:sysctl -p 命令生效sysctl.conf 配置

六、解决centos6.x 不支持SecComp,ES5.2 后的版本默认使用 bootstrap.system_call_filter 检测,如果不通过则终止ES 进程,所以将该项改为false

vim /usr/local/elasticsearch-5.6.1/config/elasticsearch.yml
bootstrap.system_call_filter: false

七、 添加启动elasticsearch 用户(es 默认不能使用root 用户启动)

groupadd elastic
useradd elastic -g elastic

八、启动elasticsearch

su - elastic
/usr/local/elasticsearch-5.6.1/bin/elasticsearch -d

  

  

  

  

  

  

  

最新文章

  1. (十八)WebGIS中清空功能和地图定位功能的设计以及实现
  2. Leetcode Permutations
  3. "_OBJC_CLASS_$_AddFriendPageItem", referenced from:
  4. 浅谈Excel开发:四 Excel 自定义函数
  5. 4Web Service中的几个重要术语
  6. HDU 1015 Safecracker
  7. 从修复 testerhome(rubychina)网站的一个 bug 学习 ruby&rails on ruby
  8. (二)Android 基本控件
  9. Spring中的创建与销毁
  10. 斗牛app上架应用宝、牛牛手机游戏推广、百人牛牛app应用开发、棋牌游戏上传、手游APP优化
  11. 解读Raft(三 安全性)
  12. 解决OracleOraDb10g_home1TNSListener服务无法启动
  13. windows压缩图片
  14. Jmeter单个长连接发送多个Sample
  15. 第一节: 结合EF的本地缓存属性来介绍【EF增删改操作】的几种形式
  16. 爬坑记-tomcat 项目启动两次的的解决
  17. hdu5003 Osu!排序实现水题
  18. 转:关于将Java编译过的.class文件打成jar可执行文件/JAR详解
  19. 获取地图文档(*.mxd)中比例尺问题
  20. github与gitlab与git三个基佬的故事

热门文章

  1. Spring-data-jpa 之Specification in的用法
  2. 客户端连接Redis
  3. insert语句太长,有StringBuilder优化一下
  4. 利用JS实现vue中的双向绑定
  5. angular 学习理解笔记
  6. 怎样制作一个横版格斗过关游戏 Cocos2d-x 2.0.4
  7. 三位一体的漏洞分析方法-web应用安全测试方法
  8. Vue 进入/离开动画
  9. lucene 范围搜索表达式(range expression)
  10. Android Viewpager实现图片轮播(仿优酷效果)