centos安装使用elasticsearch
在CentOS上安装Elasticsearch的步骤如下:
- 导入Elasticsearch的公钥:
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
- 创建Elasticsearch的yum仓库文件:
echo "[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md" | sudo tee /etc/yum.repos.d/elasticsearch.repo
- 安装Elasticsearch:
sudo yum install --enablerepo=elasticsearch elasticsearch
- 启动并设置Elasticsearch开机自启:
sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service
- 验证Elasticsearch是否正在运行:
curl -X GET "localhost:9200/"
以上步骤安装了Elasticsearch 7.x版本。如果需要安装其他版本,请修改仓库文件中的版本号。
评论已关闭