elasticsearch在ubuntu下的配置以及简单使用
warning:
这篇文章距离上次修改已过192天,其中的内容可能已经有所变动。
在Ubuntu系统中配置Elasticsearch并进行简单使用的步骤如下:
- 导入Elasticsearch公共GPG密钥:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
- 添加Elasticsearch到APT源列表:
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
- 更新包索引并安装Elasticsearch:
sudo apt-get update && sudo apt-get install elasticsearch
- 启动Elasticsearch服务并设置开机自启:
sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service
- 验证Elasticsearch是否正在运行:
curl -X GET "localhost:9200/"
以上步骤安装了Elasticsearch 7.x版本,您可以通过修改源中的版本号来安装其他版本。使用curl
命令来检查Elasticsearch服务是否运行并可以响应。
注意:确保在执行上述命令时拥有管理员权限,并且在执行过程中可能需要通过防火墙开放相应的端口(如9200)。
评论已关闭