elasticsearch集群安装
Posted kisf
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elasticsearch集群安装相关的知识,希望对你有一定的参考价值。
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 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-3 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集群安装的主要内容,如果未能解决你的问题,请参考以下文章
Elasticsearch7.8.0版本进阶——分布式集群(故障转移)
elasticsearch代码片段,及工具类SearchEsUtil.java