1、Elasticsearch官网
https://www.elastic.co/products/elasticsearch
2、解压Elasticsearch到/opt/module目录下
[victor@node1 software]$ tar -xzvf elasticsearch-6.2.4.tar.gz -C /opt/module/
3、在 Elasticsearch-6.2.4 路径下创建data和logs文件夹
[victor@node1 ~]$ cd /opt/module/elasticsearch-6.2.4
[victor@node1 elasticsearch-6.2.4]$ mkdir data
[victor@node1 elasticsearch-6.2.4]$ mkdir logs
4、修改配置文件elasticsearch.yml
[victor@node1 ~]$ cd /opt/module/elasticsearch-6.2.4/config/
[victor@node1 config]$ vim elasticsearch.yml
# ---------------------------------- Cluster -------------------------------------
cluster.name: my-application
# ------------------------------------ Node --------------------------------------
node.name: es-node1
# ----------------------------------- Paths ---------------------------------------
path.conf: /opt/module/elasticsearch-6.2.4/config
path.data: /opt/module/elasticsearch-6.2.4/data
path.logs: /opt/module/elasticsearch-6.2.4/logs
# ----------------------------------- Memory -----------------------------------
bootstrap.memory_lock: true
bootstrap.system_call_filter: false
# ---------------------------------- Network ------------------------------------
network.host: 192.168.1.102
http.port: 9200
# --------------------------------- Discovery ------------------------------------
discovery.zen.ping.unicast.hosts: ["node1", "node2", "node3"]
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.timeout: 40s
# ---------------------------------- Various -----------------------------------
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
Elasticsearch 之 elasticsearch.yml 配置文件详解
https://www.jianshu.com/p/fb5c2a7d1e12
5、修改limits.conf文件
[root@node1 ~]# vim /etc/security/limits.conf
* soft nofile 65535
* hard nofile 1028576
* soft nproc 65535
* hard nproc unlimited
* soft memlock unlimited
* hard memlock unlimited
尖叫提示:node1、node2 添加同样内容
6、修改20-nproc.conf
[root@node1 ~]# vim /etc/security/limits.d/20-nproc.conf
* soft nproc 4096
尖叫提示:node1、node2 添加同样内容
7、修改sysctl.conf
[root@node1 ~]# vim /etc/sysctl.conf
vm.max_map_count=262144
[root@node1 ~]# sysctl -p
尖叫提示:node1、node2 添加同样内容
8、启动elasticsearch
[victor@node1 ~]$ cd /opt/module/elasticsearch-6.2.4
[victor@node1 ~]$ bin/elasticsearch -d -p /opt/module/elasticsearch-6.2.4/pid
尖叫提示:elasticsearch 不能使用root用户启动
9、测试集群
[victor@node1 elasticsearch-6.2.4]$ curl http://node1:9200
{
"name" : "node-1",
"cluster_name" : "my-application",
"cluster_uuid" : "iLWXJ_1pRqCAFz4bgokI1w",
"version" : {
"number" : "6.2.4",
"build_hash" : "667b497",
"build_date" : "2018-09-01T19:22:05.189Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
10、关闭elasticsearch
[victor@node1 ~]$ kill `cat /opt/module/elasticsearch-6.2.4/pid `