qq70191 发表于 2019-1-29 10:59:26

CentOS7部署ElasticSearch

  

CentOS7部署ElasticSearch-2.1.1集群
系统规划
  主机名
  IP地址
  系统版本
  软件版本
  node160
  192.168.1.160
  centos7
  ElasticSearch-2.1.1
  node161
  192.168.1.161
  centos7
  ElasticSearch-2.1.1
  node162
  192.168.1.162
  centos7
  ElasticSearch-2.1.1
  
所有节点检查java版本
# java-version
javaversion "1.8.0_40"
Java(TM)SE Runtime Environment (build 1.8.0_40-b26)
JavaHotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)  
所有节点配置hosts文件
192.168.1.160   node160
192.168.1.161   node161
192.168.1.162   node162  

所有节点安装ElasticSearch
# mkdir   /opt/elk
# cd /opt/elk
#wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.1.1/elasticsearch-2.1.1.tar.gz  
# tar xfelasticsearch-2.1.1.tar.gz  

创建启动elasticsearch用户
# groupadd elk
# useradd elk -g elk -p elasticsearch
# chown-R elk.elkelasticsearch-2.1.1
# passwdelk
更改用户 elk 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。启动elasticsearch
# suelk
$ bin/elasticsearch  

version, pid,build
initializing ...
loaded [], sites []
using data paths, mounts [[/ (rootfs)]], netusable_space , net total_space , spins? , types
initialized
starting ...
publish_address {127.0.0.1:9300}, bound_addresses{127.0.0.1:9300}, {[::1]:9300}
elasticsearch/dJDdF4-sSdOsVsnzrEBk7g
new_master {SeaUrchin}{dJDdF4-sSdOsVsnzrEBk7g}{127.0.0.1}{127.0.0.1:9300}, reason:zen-disco-join(elected_as_master, joins received)
publish_address {127.0.0.1:9200}, bound_addresses{127.0.0.1:9200}, {[::1]:9200}
started
recovered indices into cluster_state  
所有节点配置elk启动内存
# vielasticsearch.in.sh
ES_MIN_MEM=32g
ES_MAX_MEM=32g  
所有节点配置elk集群模式
  # vielasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#---------------------------------- Cluster -----------------------------------
cluster.name: elastic
#------------------------------------ Node ------------------------------------
node.name: elastic160
#node.master: true
node.data: true
#----------------------------------- Paths ------------------------------------
path.conf    : /application/elasticsearch-2.1.1/config
path.data    : /application/elasticsearch-2.1.1/data
path.logs    : /application/elasticsearch-2.1.1/logs
path.plugins : /application/elasticsearch-2.1.1/plugins
path.work    : /tmp
#----------------------------------- Memory -----------------------------------
bootstrap.mlockall: true
#---------------------------------- Http -----------------------------------
http.enabled:       true
http.host:          192.168.1.160
http.bind_host:   192.168.1.160
http.publish_host:192.168.1.160
http.port:          9200
http.max_content_length:      100mb
http.max_initial_line_length: 4kb
http.max_header_size:         8kb
http.compression:             true
http.compression_level:       3
http.cors.max-age:            1728000
# ----------------------------------- Index -------------------------------------
index.number_of_shards: 5
index.number_of_replicas: 1
#---------------------------------- Network -----------------------------------
#关系推到: 通过network.host----->network.bind_host ------>network.publish_host
network.host:         192.168.1.160
network.bind_host:    192.168.1.160
network.publish_host: 192.168.1.160
#---------------------------------- Transport-----------------------------------
transport.host:                192.168.1.160
transport.bind_host:         192.168.1.160
transport.publish_host:      192.168.1.160
transport.tcp.connect_timeout: 10s
transport.ping_schedule:       2s
transport.tcp.port:            9300
transport.publish_port:      9300
transport.tcp.compress:      true
#---------------------------------- Descovery-----------------------------------
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elastic160", "elastic161","elastic162"]
discovery.zen.join_timeout: 3s
#配置当前集群中最少的主节点,对于多于两个节点的集群环境,建议配置大于1.
discovery.zen.minimum_master_nodes: 2
ping_interval:   1
ping_timeout:    15
ping_retries:    3
#---------------------------------- Gateway -----------------------------------
gateway.recover_after_nodes: 3
# ---------------------------------- Various -----------------------------------
action.destructive_requires_name: true  

  # vielasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#---------------------------------- Cluster -----------------------------------
cluster.name: elastic
#------------------------------------ Node ------------------------------------
node.name: elastic161
#node.master: true
node.data: true
#----------------------------------- Paths ------------------------------------
path.conf    : /application/elasticsearch-2.1.1/config
path.data    : /application/elasticsearch-2.1.1/data
path.logs    : /application/elasticsearch-2.1.1/logs
path.plugins : /application/elasticsearch-2.1.1/plugins
path.work    : /tmp
#----------------------------------- Memory -----------------------------------
bootstrap.mlockall: true
#---------------------------------- Http -----------------------------------
http.enabled:       true
http.host:          192.168.1.161
http.bind_host:   192.168.1.161
http.publish_host:192.168.1.161
http.port:          9200
http.max_content_length:      100mb
http.max_initial_line_length: 4kb
http.max_header_size:         8kb
http.compression:             true
http.compression_level:       3
http.cors.max-age:            1728000
# ----------------------------------- Index -------------------------------------
index.number_of_shards: 5
index.number_of_replicas: 1
#---------------------------------- Network -----------------------------------
#关系推到: 通过network.host----->network.bind_host ------>network.publish_host
network.host:         192.168.1.161
network.bind_host:    192.168.1.161
network.publish_host: 192.168.1.161
#---------------------------------- Transport-----------------------------------
transport.host:                192.168.1.161
transport.bind_host:         192.168.1.161
transport.publish_host:      192.168.1.161
transport.tcp.connect_timeout: 10s
transport.ping_schedule:       2s
transport.tcp.port:            9300
transport.publish_port:      9300
transport.tcp.compress:      true
#---------------------------------- Descovery-----------------------------------
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elastic160", "elastic161","elastic162"]
discovery.zen.join_timeout: 3s
#配置当前集群中最少的主节点,对于多于两个节点的集群环境,建议配置大于1.
discovery.zen.minimum_master_nodes: 2
ping_interval:   1
ping_timeout:    15
ping_retries:    3
#---------------------------------- Gateway -----------------------------------
gateway.recover_after_nodes: 3
# ---------------------------------- Various -----------------------------------
action.destructive_requires_name: true  

  
  
  # vielasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#---------------------------------- Cluster -----------------------------------
cluster.name: elastic
#------------------------------------ Node ------------------------------------
node.name: elastic162
#node.master: true
node.data: true
#----------------------------------- Paths ------------------------------------
path.conf    : /application/elasticsearch-2.1.1/config
path.data    : /application/elasticsearch-2.1.1/data
path.logs    : /application/elasticsearch-2.1.1/logs
path.plugins : /application/elasticsearch-2.1.1/plugins
path.work    : /tmp
#----------------------------------- Memory -----------------------------------
bootstrap.mlockall: true
#---------------------------------- Http -----------------------------------
http.enabled:       true
http.host:          192.168.1.162
http.bind_host:   192.168.1.162
http.publish_host:192.168.1.162
http.port:          9200
http.max_content_length:      100mb
http.max_initial_line_length: 4kb
http.max_header_size:         8kb
http.compression:             true
http.compression_level:       3
http.cors.max-age:            1728000
# ----------------------------------- Index -------------------------------------
index.number_of_shards: 5
index.number_of_replicas: 1
#---------------------------------- Network -----------------------------------
#关系推到: 通过network.host----->network.bind_host ------>network.publish_host
network.host:         192.168.1.162
network.bind_host:    192.168.1.162
network.publish_host: 192.168.1.162
#---------------------------------- Transport-----------------------------------
transport.host:                192.168.1.162
transport.bind_host:         192.168.1.162
transport.publish_host:      192.168.1.162
transport.tcp.connect_timeout: 10s
transport.ping_schedule:       2s
transport.tcp.port:            9300
transport.publish_port:      9300
transport.tcp.compress:      true
#---------------------------------- Descovery-----------------------------------
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elastic160", "elastic161","elastic162"]
discovery.zen.join_timeout: 3s
#配置当前集群中最少的主节点,对于多于两个节点的集群环境,建议配置大于1.
discovery.zen.minimum_master_nodes: 2
ping_interval:   1
ping_timeout:    15
ping_retries:    3
#---------------------------------- Gateway -----------------------------------
gateway.recover_after_nodes: 3
# ---------------------------------- Various -----------------------------------
action.destructive_requires_name: true  

  
所有节点安装ElasticSearch插件
  head插件:
  ./plugin   installmobz/elasticsearch-head
  kosf插件
  ./plugin   installlmenezes/elasticsearch-kopf/master
  delete-by-query插件
  ./plugininstalldelete-by-query
  
所有节点启动elasticsearch
  su   elk -c"/opt/elk/elasticsearch-2.1.1/bin/elasticsearch& "
  或者
  su   elk -c"/opt/elk/elasticsearch-2.1.1/bin/elasticsearch-d"
  

所有节点访问启动是否正常
  http://192.168.1.160:9200
  http://192.168.1.161:9200
  http://192.168.1.162:9200
  http://s3.运维网.com/wyfs02/M01/7C/F5/wKioL1bdSoqCVSopAAFhxVaewOU978.png
访问集群节点是否正常,使用head插件
  http://192.168.1.160:9200/_plugin/head/

http://s4.运维网.com/wyfs02/M01/7C/F5/wKioL1bdSrTzrx3CAAFBQRXMUqw435.png
  

  http://192.168.1.160:9200/_plugin/kopf/
http://s2.运维网.com/wyfs02/M02/7E/68/wKioL1b-Tt3Q490FAAiJU16ucvg326.jpg
  




页: [1]
查看完整版本: CentOS7部署ElasticSearch