分布式索引服务-elasticsearch-Linux环境搭建,真香警告
在Linux环境下搭建Elasticsearch的基本步骤如下:
安装Java
Elasticsearch需要Java运行环境,可以使用yum安装Java:
sudo yum install java-1.8.0-openjdk
安装Elasticsearch
可以使用yum从Elasticsearch的官方仓库安装:
# 添加Elasticsearch到yum仓库
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
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 elasticsearch
- 启动Elasticsearch服务并设置开机自启
# 启动Elasticsearch服务
sudo systemctl start elasticsearch.service
# 设置Elasticsearch服务开机自启
sudo systemctl enable elasticsearch.service
验证Elasticsearch安装
通过访问Elasticsearch的API验证安装:
curl -X GET "localhost:9200/"
以上步骤在CentOS环境下测试通过,其他Linux发行版可能需要适当调整。
评论已关闭