ElasticSearch 7 安装

安装

安装到 /opt/elasticsearch-7.5.2:

cd /opt/
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.2-linux-x86_64.tar.gz
tar -xf elasticsearch-7.5.2-linux-x86_64.tar.gz -C /opt/

新增 es 用户

系统安全考虑设置的条件。由于 ElasticSearch 可以接收用户输入的脚本并且执行,为了系统安全考虑,es 不允许以 root 用户启动它。新增es用户:

adduser es
#设置密码
passwd es
chown -R es /opt/elasticsearch-7.5.2

配置

vi /etc/sysctl.conf

追加设置项

vm.max_map_count=965535

使配置生效

sysctl -p

启动

以后端模式启动

# 切换到es用户
su es
# 启动
/opt/elasticsearch-7.5.2/bin/elasticsearch -d

验证

curl localhost:9200

响应类似如下 json,说明成功:

{
 "name" : "my_node",
 "cluster_name" : "elasticsearch",
 "cluster_uuid" : "vT9PmxtjSPGorbMCSJshLQ",
 "version" : {
   "number" : "7.5.2",
   "build_flavor" : "default",
   "build_type" : "tar",
   "build_hash" : "8bec50e1e0ad29dad5653712cf3bb580cd1afcdf",
   "build_date" : "2020-01-15T12:11:52.313576Z",
   "build_snapshot" : false,
   "lucene_version" : "8.3.0",
   "minimum_wire_compatibility_version" : "6.8.0",
   "minimum_index_compatibility_version" : "6.0.0-beta1"
 },
 "tagline" : "You Know, for Search"
}