由于elasticsearch(es)最近曝光了一个漏洞,计划升级到最新的es7.13.4版本。该漏洞的描述如下:
Elasticsearch 发布了7.13.4版本,解决了内存泄漏问题。
最近,在Elasticsearch的错误报告中发现了一个内存泄漏漏洞。任何能够向Elasticsearch提交任意查询的用户都可能提交格式错误的查询,这会导致返回包含先前使用的数据缓冲区部分的错误消息。由于这个问题没有具体的解决方案,且7.13.4之前的所有Elasticsearch版本都受此缺陷影响。用户必须升级到Elasticsearch 7.13.4版本以获得修复。
此外,ES7和ES6之间存在显著差异,因此从安装开始需要进行简单的了解。
目录:
(1). 部署ES7.13.4单节点集群
(2). 部署Kibana7.13.4
(3). ES6与ES7差异示例
(1). 部署ES7.13.4单节点集群
下载页面:
https://www.php.cn/link/88a9225cf17ea3bf8bef2b4658ef7bf2
使用以下命令下载:
wget https://www.php.cn/link/abd5e8f8c5783bc54bc2a3c91ae68118
修改系统参数:
使用命令vi编辑/etc/sysctl.conf文件:
vi /etc/sysctl.conf
添加以下行:
vm.max_map_count=655360
加载参数:
sysctl -p
否则启动时会报错:
bootstrap check failure [1] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改配置文件:
编辑config/elasticsearch.yml文件:
config/elasticsearch.yml
红色部分为必改项:
cluster.name: es-test-cluster
path.data: /app/data/elasticsearch-7.13.4
path.logs: /app/logs/elasticsearch-7.13.4
network.host: 0.0.0.0 (配置其他网段也可以访问)
node.name: stress-test001 (与你的主机名一致,hostname查看)
cluster.initial_master_nodes: ["stress-test001"]
编辑config/jvm.options文件:
config/jvm.options
8:-Xloggc:/app/logs/elasticsearch-7.13.4/gc.log
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/app/logs/elasticsearch-7.13.4/gc.log:utctime,pid,tags:filecount=32,filesize=64m
如果不配置cluster.initial_master_nodes会报错:
bootstrap check failure [1] of [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
node.name和cluster.initial_master_nodes的值必须与hostname一致,否则会报错:
master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [node-1] to bootstrap a cluster: ......
启动ES:
/app/3rd/elasticsearch-7.13.4/bin/elasticsearch -d
(2). 部署Kibana7.13.4
下载页面:
https://www.php.cn/link/cf1f4d5318c6b0a76eb889ba14443cbe
使用以下命令下载:
wget https://www.php.cn/link/3d8338aae982b9c8be5f66ff9b91823e
修改配置:编辑config/kibana.yml文件:
config/kibana.yml
server.host: "0.0.0.0"
启动Kibana:
nohup /app/3rd/kibana-7.13.4-linux-x86_64/bin/kibana > /app/logs/kibana-7.13.4-linux-x86_64/nohup.out &
(3). ES6与ES7差异示例
创建索引的格式发生了变化:
在ES6中:
curl -X PUT "localhost:9200/test?pretty" -H'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"test": {
"properties": {
"amount":{
"type":"double"
}
}
}
}
}'
在ES7中执行会报错:

在ES7中,需要将mappings下的索引名称子项删除:
curl -X PUT "localhost:9200/test?pretty" -H'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"amount":{
"type":"double"
}
}
}
}'
成功执行:

以上就是elasticsearch-1:es&kibana的7.13.4单节点集群部署与初探的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号