丹调生活 发表于 2019-1-29 06:29:34

elasticsearch集群部署

  自行到https://www.elastic.co/downloads/elasticsearch下载所对应的ES版本,选择RPM 版本,我所使用的是6.4.1
  1,安装ES

#rpm -ivh elasticsearch-6.4.1.rpm  创建ES所需要的目录

  #mkdir -pv /data/elasticsearch

  #mkdir -p /data/logs/elasticsearch
  #chown -R elasticsearch.elasticsearch /data
  编译ES 配置文件
vim /etc/elasticsearch/elasticsearch.yml  cluster.name: elaseicsearch
  indices.memory.index_buffer_size: 30%
  indices.breaker.fielddata.limit: 20%
  indices.fielddata.cache.size: 15%
  indices.breaker.request.limit: 10%
  indices.breaker.total.limit: 40%
  thread_pool.bulk.size: 3
  thread_pool.bulk.queue_size: 1000
  #hread_pool.search.queue_size: 3000
  gateway.recover_after_nodes: 1
  gateway.expected_nodes: 1
  discovery.zen.ping_timeout: 30s
  discovery.zen.minimum_master_nodes: 1
  http.max_initial_line_length: 1mb
  discovery.zen.ping.unicast.hosts: ["1.1.1.1", "1.1.1.2", "1.1.1.3"]
  processors: 2
  discovery.zen.fd.ping_interval: 5s
  discovery.zen.fd.connect_on_network_disconnect: true
  index.store.type: niofs
  #script.max_compilations_per_minute: 100000
  network.tcp.keep_alive: false
  transport.ping_schedule: 10s
  bootstrap.memory_lock: false
  bootstrap.system_call_filter: false
  cluster.routing.allocation.same_shard.host: true
  path.data: /data/elasticsearch
  path.logs: /data/logs/elasticsearch
  network.host: 1.1.1.1
  http.port: 9200
  node.name: test
  node.master: false (哪台设置为主节点需要将此改为true)
  node.data: true
  node.ingest: true
  xpack.graph.enabled: true
  xpack.ml.enabled: true
  xpack.monitoring.enabled: true
  #xpack.reporting.enabled: true
  xpack.security.enabled: false
  注:根据实际环境自行更改配置
  修改jvm内存
vim /etc/elasticsearch/jvm.options
http://s1.运维网.com/images/20181130/1543560485475842.png

  将内存修改成主机的一半
  2,安装插件 x-pack ik分词器
  下载最新版本的包

wget https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-6.2.4.zip  安装x-pack

  #cd /usr/share/elasticsearch/bin
  #./elasticsearch-plugin install file:///root/x-pack-6.2.4.zip
  安装分词器
  #cd /usr/share/elasticsearch/plugins/
  #mkdir ik
  #mkdir pinyin
  下载分词器
  #wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.1/elasticsearch-analysis-ik-6.4.1.zip
  #wget https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v6.4.1/elasticsearch-analysis-pinyin-6.4.1.zip
  只需要将分词器解压到对应目录就OK
  #unzip elasticsearch-analysis-ik-6.4.1.zip -d /usr/share/elasticsearch/plugins/ik/
  #unzip elasticsearch-analysis-pinyin-6.4.1.zip -d /usr/share/elasticsearch/plugins/pinyin/
  启动ES
#/etc/init.d/elasticsearch restart


页: [1]
查看完整版本: elasticsearch集群部署