1、下载es
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
2、解压
tar -zxvf elasticsearch-6.2.2.tar.gz
3、进入 cd elasticsearch-6.2.2,创建 data目录 mkdir data
4、创建es用户,并授权elasticsearch-6.2.2目录
useradd elsearch
chown -R elsearch:elsearch elasticsearch-6.2.2
5、修改配置文件
vi elasticsearch.yml
#集群名 同一集群集群名需相同
cluster.name: elasticsearch-server
#节点名
node.name: node-192
#数据存储路径
path.data: /usr/data/elasticsearch/elasticsearch-6.2.2/data
#日志存储路径
path.logs: /usr/data/elasticsearch/elasticsearch-6.2.2/logs
#运行外网访问
network.host: 0.0.0.0
http.port: 9200
#跨域处理
http.cors.enabled: true
http.cors.allow-origin: “*”
#集群其它节点IP
discovery.zen.ping.unicast.hosts: [“119.23.235.192”, “119.23.39.184”]
#集群最少需要的master个数 = 集群机器数/2 + 1
discovery.zen.minimum_master_nodes: 2
6、vi /etc/security/limits.conf
root soft nofile 100001
root hard nofile 100002
elsearch soft nofile 100001
elsearch hard nofile 100002
7、vi /etc/sysctl.conf,追加以下内容:
vm.max_map_count=655360
保存后,执行:
sysctl -p