第一步:下载软件
链接: https://pan.baidu.com/s/1qGoEdrqmYsqFwzI5TW0EJw?pwd=y98s 提取码: y98s
第二步:创建软件文件夹
[root@localhost local]# mkdir /usr/local/elasticsearch
[root@localhost local]# cd elasticsearch/
[root@localhost elasticsearch]# mkdir esdata
[root@localhost elasticsearch]# cd esdata/
[root@localhost esdata]# mkdir data
[root@localhost esdata]# mkdir log
[root@localhost esdata]# ll
total 0
drwxr-xr-x. 2 root root 6 Jul 4 04:38 data
drwxr-xr-x. 2 root root 6 Jul 4 04:38 log
第三步:上传软件并解压
-rw-r--r--. 1 root root 336647987 Sep 22 2019 elasticsearch-7.2.0-linux-x86_64.tar.gz
[root@localhost elasticsearch]# tar -xvf elasticsearch-7.2.0-linux-x86_64.tar.gz
第四步:新建用户(处于安全考虑elasticsearch 不允许以root用户运行)
[root@localhost elasticsearch]# cd /usr/local/elasticsearch
[root@localhost elasticsearch]# useradd elasticsearch
[root@localhost elasticsearch]# passwd elasticsearch
第三步:软件配置
[root@localhost config]# cd /usr/local/elasticsearch/elasticsearch-7.2.0/config
[root@localhost config]# vim elasticsearch.yml
在末尾添加如下内容
node.name: node-1
node.master: true
node.data: true
http.cors.enabled: true
http.cors.allow-origin: "*"
http.port: 9200
transport.tcp.port: 9300
path.data: /usr/local/elasticsearch/esdata/data
path.logs: /usr/local/elasticsearch/esdata/log
bootstrap.memory_lock: true
network.host: 192.1.1.101
discovery.seed_hosts: ["192.1.1.101"]
cluster.initial_master_nodes: ["node-1"]
[root@localhost security]# cd /etc/security
[root@localhost security]# vim limits.conf
在末尾添加如下内容
* soft nofile 65536
* hard nofile 65536
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
[root@localhost security]# cd /etc
[root@localhost etc]# vim sysctl.conf
在末尾添加如下内容
vm.max_map_count=655360
[root@localhost etc]# sysctl -p
第四步:为elasticsearch 用户开放权限
[elasticsearch@localhost local]$ su root
Password:
[root@localhost local]# whoami
root
[root@localhost local]# sudo chown -R elasticsearch:elasticsearch /usr/local/elasticsearch
[root@localhost local]# sudo chmod -R 755 /usr/local/elasticsearch
第四步:切换用户启动软件
[elasticsearch@localhost bin]$ cd /usr/local/elasticsearch/elasticsearch-7.2.0/bin
[elasticsearch@localhost bin]$ su elasticsearch
Password:
[elasticsearch@localhost bin]$ whoami
elasticsearch
[elasticsearch@localhost bin]$ ./elasticsearch
第五步:测试是否启动成功
在浏览器请求 http://192.1.1.101:9200/
返回报文为