linux 安装 ES
1.下载安装包 地址:
1
| wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.2-linux-x86_64.tar.gz
|
2.解压
上传到/usr/local/es 目录下,执行解压命令
tar -zxvf elasticsearch-6.4.3.tar.gz
3.es 不能用 root 用户启动,所以在这里建立新的用户,并/usr/local/es 文件夹的权限赋给创建的用户,具体如下
1 2 3 4 5 6 7 8 9 10 11 12
| useradd es
passwd es
chmod -R es /usr/local/es
-R:要授权的目录及其下所有文件和目录 es:要给授权的用户 /usr/local/es:要授权的目录
|
4.进入解压后的目录下的 bin 文件下,启动 es
1 2 3 4 5 6 7 8 9
| ./elasticsearch
./elasticsearch -d
nohup ./elasticsearch &
|
5.启动完成,验证是否成功
1 2 3 4 5 6 7 8
| curl 0.0.0.0:9200
lsof -i:9200
kill -9 PID
|
解决外网通过 ip 访问不上的问题
核心配置
1 2 3 4 5 6 7 8 9 10 11 12
| network.host: 0.0.0.0 http.cors.enabled: true http.cors.allow-origin: "*" node.master: true node.data: true http.port: 9200 cluster.name: my-application node.name: node-1 cluster.initial_master_nodes: ["node-1", "node-2"]
ingest.geoip.downloader.enabled: false
|