舊Mac電腦安裝ElasticSearch

我的舊mac電腦安裝ElasticSearch的過程,電腦系統版本是10.13.6 ,僅供參考。

1、安裝方法

Version: 7.17.4版本的elasticsearch

brew install elastic/tap/elasticsearch-full
注意:brew install elasticsearch已棄用
安裝完成后查看版本號:elasticsearch --version
Version: 7.17.4, Build: default/tar/79878662c54c886ae89206c685d9f1051a9d6411/2022-05-18T18:04:20.964345128Z, JVM: 18.0.1.1

2、啟動

elasticsearch

3、設置局域網訪問

elasticsearch.yml 配置 局域網可訪問
默認配置只可本機訪問

cluster.name: my-application
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["127.0.0.1", "[::1]"]
cluster.initial_master_nodes: ["node-1"]

http.cors.allow-origin: "*"
http.cors.enabled: true
http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
http.cors.allow-credentials: true

注意:修改配置后要重新啟動elasticsearch

4、默認配置

Data:    /usr/local/var/lib/elasticsearch/elasticsearch_charles/
Logs:    /usr/local/var/log/elasticsearch/elasticsearch_charles.log
Plugins: /usr/local/var/elasticsearch/plugins/
Config:  /usr/local/etc/elasticsearch/

5、安裝elasticsearch-head

github地址:https://github.com/mobz/elasticsearch-head
文檔上有說明如何安裝
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
若電腦尚未安裝node,則需先安裝
https://nodejs.org/en/ 使用brew安裝nodejs出現問題,索性去官網下載pkg安裝。
安裝nodejs成功后,安裝所需依賴庫
npm install
然后安裝下運行所需插件grunt
sudo npm install -g grunt-cli  沒有加sudo的話報錯了,要加上sudo才行
安裝成功后,運行
npm run start
地址欄訪問http://localhost:9100/

另外也可以去瀏覽器插件市場找elasticsearch-head安裝擴展,就不用安裝elasticsearch-head了。

其他

brew services list  # 查看使用brew安裝的服務列表
brew services run formula|--all  # 啟動服務(僅啟動不注冊)
brew services start formula|--all  # 啟動服務,并注冊
brew services stop formula|--all   # 停止服務,并取消注冊
brew services restart formula|--all  # 重啟服務,并注冊
brew services cleanup  # 清除已卸載應用的無用的配置
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容