一、安装elasticsearch
1.1查看版本
brew search elasticsearch
1.2 安装
brew install elastic/tap/elasticsearch-full
执行此处命令,我遇到了如下错误
从提示的错误可知 elasticsearch-full.rb 文件的 第68行有错误 安装不了,所以通过
(1)输入以下命令打开该文文件
vim /opt/homebrew/Library/Taps/elastic/homebrew-tap/Formula/elasticsearch-full.rb
(2)输入 :set number 显示行数,
(3)输入 :68 按回车 找到第68行,并把第68行修改为如下
@plist_manual = "elasticsearch"
(4)输入 :wq 保存文档
(5)继续执行如下命令,按回车
brew install elastic/tap/elasticsearch-full
等待下载 出现如下页面:
(6)输入以下命令查看es版本
elasticsearch --version
此时已经安装完成!! 启动
1.3测试
启动:brew services start elasticsearch-full
停止:brew services stop elasticsearch-full
重启:brew services restart elasticsearch-full
看到如下页面证明已经启动成功!!
1.4 访问
#在浏览器中访问
http://localhost:9200/
#或者在控制台输入
curl -X GET "http://localhost:9200/"
此时坑又出现了,
找到添加
#输入
vim /opt/homebrew/etc/elasticsearch/elasticsearch.yml
#添加
network.host: 0.0.0.0
结果发现还是启动不了未解决!!!
Install elasticsearch with Homebrew on OSX Ventura · Issue #91159 · elastic/elasticsearch · GitHub