一、工具:ubuntu20.04 + elasticsearch-7.9.1 + jdk1.8
二、下载与上传elasticsearch
三、安装elasticsearch
注意root用户下将es拥有者改为非root: chown -R es:es ./elasticsearch
四、配置elasticsearch
a. 切换到elasticsearch config 目录,修改elasticsearch.yaml,修改的有:
# ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: node-1 # # Add custom attributes to the node: # #node.attr.rack: r1 # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # network.host: 0.0.0.0 # # Set a custom port for HTTP: # #http.port: 9200 # # For more information, consult the network module documentation. # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when this node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # #discovery.seed_hosts: ["host1", "host2"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # cluster.initial_master_nodes: ["node-1"]
b. 更改系统内存,如果不该elasticsearch 启动会报
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
更改方法如下:
1. root 用户下:sudo vim /etc/sysctl.conf
2.在末尾添加 vm.max_map_count=655360
3. sudo sysctl -p
五、要以非root用户启动
