欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

elasticsearch 5.x集群安装

程序员文章站 2022-07-05 09:04:29
...

1. 下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.tar.gz

2. 解压

为便于识别,解压后起名 elasticsearch-5.5.1-nodex  , elasticsearch-5.5.1-node1  elasticsearch-5.5.1-node2 elasticsearch-5.5.1-node3

elasticsearch-5.5.1-node1 elasticsearch-5.5.1-node3 安装在一台机器。

3. chown   elasticsearch 不允许root启动

groupadd es

useradd -g es es

cd .......

chown -R es ./

4. 修改sysctl.conf   默认 65530太小,否则启动时会报错

echo "vm.max_map_count=655360" >>/etc/sysctl.conf

sysctl -p

5. 启动

cd ....../bin 

./elasticsearch -d

 

配置:

node1 :   master 

vim elasticsearch-5.5.1-node1/config/elasticsearch.yml     

bootstrap.system_call_filter: false 必须,否在会报日志路径等权限错误

 

cluster.name: xx.elasticsearch
node.name: es-node-1
network.bind_host: 10.112.29.137
network.publish_host: 10.112.29.137
network.host: 10.112.29.137
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: /http?:\/\/10.112.29.137(:[0-9]+)?/
discovery.zen.ping.unicast.hosts: ["10.112.29.137", "10.112.29.141", "10.112.29.137:9301"]
discovery.zen.minimum_master_nodes: 2
bootstrap.system_call_filter: false

node2: slave

vim elasticsearch-5.5.1-node2/config/elasticsearch.yml

cluster.name: xx.elasticsearch
node.name: es-node-2
network.bind_host: 10.112.29.141
network.publish_host: 10.112.29.141
network.host: 10.112.29.141
http.port: 9200
discovery.zen.ping.unicast.hosts: ["10.112.29.137", "10.112.29.141", "10.112.29.137:9301"]
discovery.zen.minimum_master_nodes: 2
bootstrap.system_call_filter: false

node3: slave 与 master 安装在一台机器(实验一台机器安装多个实例)

vim elasticsearch-5.5.1-node3/config/elasticsearch.yml

cluster.name: xx.elasticsearch
node.name: es-node-3
network.bind_host: 10.112.29.137
network.publish_host: 10.112.29.137
network.host: 10.112.29.137
http.port: 9201
discovery.zen.ping.unicast.hosts: ["10.112.29.137", "10.112.29.141", "10.112.29.137:9301"]
discovery.zen.minimum_master_nodes: 2
transport.tcp.port: 9301

bootstrap.system_call_filter: false

  

elasticsearch head安装:http://www.cnblogs.com/kisf/p/7337794.html

 

 

升级6.1.1坑:

 max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

vim /etc/security/limits.conf

es hard nofile 65536
es soft nofile 65536

max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]

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

*          soft    nproc     1024

*          soft    nproc     2048