Elastic下载链接:https://www.elastic.co/downlo...
Java下载链接:https://www.oracle.com/techne...
本文Elastic安装版本为6.5.3,Java版本为最新版

Java安装

下载后直接解压即可
解压后还需要设置一下环境变量
在/etc/profile尾部加上
==export JAVA_HOME=/path/to/java/bin==
添加完后刷新/etc/profile脚本
==source /etc/profile==

Elastic安装

下载后直接解压
添加启动用户,Elastic不允许root账号启动
修改Elastic安装目录权限
==chown elastic:elastic ./elastic -R ==
修改相关配置文件
在==/etc/security/limits.conf==尾部加上以下内容

elastic hard nofile 65536
elastic soft nofile 65536
elastic soft nproc 4096
elastic hard nproc 4096

在==/etc/sysctl.conf==尾部加上以下内容,并执行命令==sysctl -p==

vm.max_map_count=655360

修改==/path/to/elastic/conf/elasticsearch.yml==

# 集群名称
cluster.name: aubin-cluster
# 节点名称,仅仅是描述名称,用于在日志中区分
node.name: els1

# 数据的默认存放路径
path.data: /var/lib/elasticsearch
# 日志的默认存放路径
path.logs: /var/log/elasticsearch

# 当前节点的IP地址
network.host: 192.168.0.1
# 对外提供服务的端口,9300为集群服务的端口
http.port: 9200

# 集群个节点IP地址,也可以使用els、els.shuaiguoxia.com等名称,需要各节点能够解析
discovery.zen.ping.unicast.hosts: ["172.18.68.11", "172.18.68.12","172.18.68.13"]

# 为了避免脑裂,集群节点数最少为 半数+1
discovery.zen.minimum_master_nodes: 2

完成以上准备后就可以直接启动Elastic了
==/path/to/elastic/bin/elasticsearch==
启动完成直接浏览器访问127.0.0.1:9200

{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "2i8o_gm0Qh-i_KTzp_TN7w",
  "version" : {
    "number" : "6.5.3",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "159a78a",
    "build_date" : "2018-12-06T20:11:28.826501Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

吃饭饭睡觉觉
62 声望4 粉丝