elasticsearch单机部署
时间: 2023-11-21 16:57:24 浏览: 100
一键部署elasticsearch集群/单机版shell脚本(适用于Centos7 x86服务器)
5星 · 资源好评率100%
以下是elasticsearch单机部署的步骤:
1.从官网下载elasticsearch压缩包,并解压到指定目录,例如/opt/elasticsearch-7.17.0。
2.创建新用户并更改elasticsearch文件夹的所有者为该用户,例如创建新用户elk并更改所有者:
```shell
sudo useradd elk
sudo chown -R elk:elk /opt/elasticsearch-7.17.0
```
3.修改elasticsearch配置文件,例如使用vim编辑器打开配置文件:
```shell
vim /opt/elasticsearch-7.17.0/config/elasticsearch.yml
```
4.在配置文件中修改以下参数:
```yaml
cluster.name: my_cluster # 修改集群名称
node.name: my_node # 修改节点名称
network.host: 0.0.0.0 # 允许所有IP访问
http.port: 9200 # 修改HTTP端口号
```
5.启动elasticsearch:
```shell
cd /opt/elasticsearch-7.17.0/bin
./elasticsearch
```
6.检查elasticsearch是否启动成功,可以使用curl命令:
```shell
curl http://localhost:9200
```
输出类似以下信息表示启动成功:
```json
{
"name" : "my_node",
"cluster_name" : "my_cluster",
"cluster_uuid" : "xxxxxxxxxxxxxxxxxxxx",
"version" : {
"number" : "7.17.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "xxxxxxxxxxxxxxxxxxxx",
"build_date" : "2021-10-22T18:56:49.031608185Z",
"build_snapshot" : false,
"lucene_version" : "8.10.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
```
阅读全文