修改hosts
vim /etc/hosts
将本机host 配置其中
10.20.26.96 node-1
创建es用户&赋权
useradd es
psasswd es
输入密码:
chmod 777 /home/elasticsearch/deploy/elasticsearch-7.3.2/bin
chown -R es:es /home/elasticsearch/deploy/elasticsearch-7.3.2/data
chown -R es:es /home/elasticsearch/deploy/elasticsearch-7.3.2/logs
chown -R es:es /home/elasticsearch/deploy/elasticsearch-7.3.2/snapshots
安装jdk
下载es安装包
解压&修改配置文件&给目录赋权
1、解压
tar zxvf elasticsearch.tgz -C 指定目录
2、修改配置文件elasticsearch.yml
注意: 不修改配置,是不可以外网访问的,如下属性都是必须要配置的
#node.name: node-1
node.name: node-1
#network.host: 192.168.0.1
network.host: node-1
#http.port: 9200
http.port: 9200
# 允许跨域访问
http.cors.enabled: true
http.cors.allow-origin: "*"
path.data: /home/elasticsearch/deploy/elasticsearch-7.3.2/data
path.logs: /home/elasticsearch/deploy/elasticsearch-7.3.2/logs
# 快照路径
path.repo: /home/elasticsearch/deploy/elasticsearch-7.3.2/snapshots
cluster.initial_master_nodes: ['node-1']
##优化参数
indices.memory.index_buffer_size: 20%
indices.query.bool.max_clause_count: 100000000
启动
注意 加上 “-d” 表示后台启动
./elasticsearch.sh -d
验证
浏览器中输入: