elasticsearch-7.2.0 部署
所需资源
主机IP | 描述 |
---|---|
172.18.194.182 | 主节点 |
172.18.194.183 | 主节点 |
172.18.194.184 | 主节点 |
下载软件
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.2.0-linux-x86_64.tar.gz
上传软件到服务器,完成解压
tar -zxvf elasticsearch-7.2.0-linux-x86_64.tar.gz
分别修改三台主机上的配置文件 XXX/elasticsearch-7.2.0/config/elasticsearch.yml
172.18.194.182主机
cluster.name: log_center_es7_cluster
node.name: es7_node_01
node.master: true
node.data: true
bootstrap.memory_lock: false
network.host: 172.18.194.182
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
transport.tcp.port: 9300
discovery.zen.minimum_master_nodes: 1
discovery.seed_hosts: ["172.18.194.182:9300", "172.18.194.183:9300"]
cluster.initial_master_nodes: ["172.18.194.182", "172.18.194.183"]
172.18.194.183主机
cluster.name: log_center_es7_cluster
node.name: es7_node_02
node.master: true
node.data: true
bootstrap.memory_lock: false
network.host: 172.18.194.183
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
transport.tcp.port: 9300
discovery.zen.minimum_master_nodes: 1
discovery.seed_hosts: ["172.18.194.182:9300", "172.18.194.183:9300"]
cluster.initial_master_nodes: ["172.18.194.182", "172.18.194.183"]
172.18.194.184主机
cluster.name: log_center_es7_cluster
node.name: es7_node_03
node.master: false
node.data: true
bootstrap.memory_lock: false
network.host: 172.18.194.184
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
transport.tcp.port: 9300
discovery.zen.minimum_master_nodes: 1
discovery.seed_hosts: ["172.18.194.182:9300", "172.18.194.183:9300"]
cluster.initial_master_nodes: ["172.18.194.182", "172.18.194.183"]
分别修改三台主机启动文件 XXX/elasticsearch-7.2.0/bin/elasticsearch
以上配置是引用下载的es版本中自带的jdk,这个指定符合其要求,否则可能会报如下提示
future versions of Elasticsearch will require Java 11; your Java version from [/opt/openjdk8u222-b10/jre] does not meet this requirement
分别在三台主机上执行启动命令
XXX/elasticsearch-7.2.0/bin/elasticsearch -d
验证启动是否成功
每台主机上执行jps命令查看是否有 Elasticsearch 进程
浏览器访问 http://172.18.194.182:9200/_cat/nodes 显示如下信息
172.18.194.182 27 6 0 0.00 0.00 0.00 mdi * es7_node_01
172.18.194.183 34 5 1 0.15 0.10 0.04 mdi - es7_node_02
172.18.194.184 33 5 1 0.18 0.10 0.04 di - es7_node_03
常见错误
1.启动报错:future versions of Elasticsearch will require Java 11; your Java version from [/opt/openjdk8u222-b10/jre] does not meet this requirement
解决方法:
启动脚本增加如下配置
export JAVA_HOME=/ulmp/app/elasticsearch-7.2.0/jdk
export PATH=$JAVA_HOME/bin:$PATH
2.启动报错:ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方法:
切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功