es配置文件修改
[[email protected] ~]# vim /etc/elasticsearch/jvm.options
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms2g
-Xmx2g
[[email protected] ~]# grep '^[^#]' /etc/elasticsearch/elasticsearch.yml
cluster.name: test-es
node.name: manager
node.attr.rack: r1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true #官方文档建议为true
network.host: 192.168.50.65
http.port: 9200
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["manager"]
gateway.recover_after_nodes: 3
action.destructive_requires_name: true
[[email protected] ~]# systemctl edit elasticsearch
[Service]
LimitMEMLOCK=infinity
[[email protected] ~]# systemctl daemon-reload
系统参数修改
[[email protected] ~]# sysctl -p
vm.max_map_count=262144
[[email protected] ~]# cat /etc/security/limits.d/20-nproc.conf
* soft nproc 4096
root soft nproc unlimited
[[email protected] ~]# cat /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 2048
* hard nproc 4096
启动ES
[[email protected] ~]# systemctl start elasticsearch.service
[[email protected] ~]# jps # 专门查看Java程序的ps,比直接用ps去查PID要方便一点
3292 Jps
25756 Elasticsearch
浏览器访问 http://192.168.50.65:9200/
或者curl
[[email protected] ~]# curl http://192.168.50.65:9200/
{
"name" : "manager",
"cluster_name" : "test-es",
"cluster_uuid" : "S8pmWc10SfKXZZxmxbN2Qg",
"version" : {
"number" : "7.4.2",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "2f90bbf7b93631e52bafb59b3b049cb44ec25e96",
"build_date" : "2019-10-28T20:40:44.881551Z",
"build_snapshot" : false,
"lucene_version" : "8.2.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
基础知识参考
http://www.linuxe.cn/post-295.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.4/heap-size.html
原文地址:https://www.cnblogs.com/max27149/p/11888139.html
时间: 2024-11-18 22:36:49