簡體   English   中英

從 /usr/local/var 卸載 elasticsearch 並在 MacOSX 上安裝另一個版本

[英]Uninstall elasticsearch from /usr/local/var and install another version on MacOSX

我試圖在我的 Mac 機器elasticsearch從 6.8.4 降級到 5.6。 但不知何故,我弄亂了 6.8.4 的現有安裝,現在我既無法修復當前安裝的版本,也無法安裝 5.6

細節:

我在我的系統上正確安裝了 6.8.4,並且成功地訪問了http://localhost:9200/端口並查看版本信息和所有其他詳細信息。 但由於依賴,我不得不將版本降級到 5.6

我遵循本指南https://gist.github.com/govindpatel/0660b33a343b807664972b53c3b12ca0並通過刪除plist和其他詳細信息來安裝 6.8.4。 Now when I try to start elasticsearch service by typing $ elasticsearch I get: -bash: elasticsearch: command not found and $ brew service restart elasticsearch gives me Error: Unknown command: service

但是,當我觸發這個命令時,我仍然可以看到 6.8.4:

$ brew info elasticsearch
elasticsearch: stable 6.8.4, HEAD
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/elasticsearch.rb
==> Requirements
  Required: java = 1.8 ✔
==> Options
  --HEAD
  Install HEAD version
==> Caveats
  Data:    /usr/local/var/lib/elasticsearch/
  Logs:    /usr/local/var/log/elasticsearch/elasticsearch_Puneet.log
  Plugins: /usr/local/var/elasticsearch/plugins/
  Config:  /usr/local/etc/elasticsearch/


To have launchd start elasticsearch now and restart at login:
  brew services start elasticsearch
Or, if you don't want/need a background service you can just run:
  elasticsearch
==> Analytics
  install: 8,690 (30 days), 23,748 (90 days), 122,267 (365 days)
  install_on_request: 8,233 (30 days), 22,565 (90 days), 114,157 (365 days)
  build_error: 0 (30 days)

我什至嘗試安裝 5.6(通過 Homebrew) - brew install elasticsearch@5.6並將PATH設置在~/.bash_profile的第一位,但沒有運氣::(

請提供幫助和建議:

  1. 如何修復現有的 6.8.4 版本,以及
  2. 我怎樣才能系統地降級它(因為現有的conf,數據位於/usr/local文件夾下)

當前詳細信息:查看 elasticsearch 是否正在運行: $ launchctl list | grep elasticsearch $ launchctl list | grep elasticsearch ,我得到: - 1 homebrew.mxcl.elasticsearch@5.6 ,我目前沒有安裝這個(o/p 附加) - $ brew uninstall elasticsearch@5.6 ~> Error: No such keg: /usr/local/Cellar/elasticsearch@5.6

[更新-1]

發布后,我再次嘗試運行 ES 安裝命令: brew install elasticsearch

Updating Homebrew...
==> Auto-updated Homebrew!
  Updated 2 taps (homebrew/core and homebrew/cask).
  No changes to formulae.

==> Downloading 
  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-6.8.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/downloads/elasticsearch-oss-6.8.4.tar.gz
==> Caveats
  Data:    /usr/local/var/lib/elasticsearch/
  Logs:    /usr/local/var/log/elasticsearch/elasticsearch_Puneet.log
  Plugins: /usr/local/var/elasticsearch/plugins/
  Config:  /usr/local/etc/elasticsearch/

To have launchd start elasticsearch now and restart at login:
  brew services start elasticsearch
Or, if you don't want/need a background service you can just run:
  elasticsearch
==> Summary
  🍺    /usr/local/Cellar/elasticsearch/6.8.4: 133 files, 103.2MB, built in 6 seconds

然后啟動服務$ brew services start elasticsearch ~> ==> Successfully started elasticsearch (label: homebrew.mxcl.elasticsearch) 現在,當我嘗試訪問端口時: http://localhost:9200 - 它正在工作(從 0 安裝雖然解決了這個問題!)

{
  "name" : "DwQRyf7",
  "cluster_name" : "elasticsearch_Puneet",
  "cluster_uuid" : "hLAu9onQSiuQHOpm_e9IKw",
  "version" : {
    "number" : "6.8.4",
    "build_flavor" : "oss",
    "build_type" : "tar",
    "build_hash" : "bca0c8d",
    "build_date" : "2019-10-16T06:19:49.319352Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.2",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

現在唯一的問題是,我怎樣才能系統地降級它?

[更新-2]

現在我有了 6.8.4,我檢查了其他版本: brew search elasticsearch並得到了 5.6。 然后我用brew install elasticsearch@5.6安裝了 5.6

Updating Homebrew...
==> Auto-updated Homebrew!
  Updated 1 tap (homebrew/cask).
  No changes to formulae.
==> Downloading https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.16.tar.gz
  Already downloaded: /Library/Caches/Homebrew/downloads/3d7cc028f605699065bd403b0a2383db8d7413c570df57e26fc87a735126c96c--elasticsearch-5.6.16.tar.gz
==> Caveats
  Data:    /usr/local/var/elasticsearch/elasticsearch_Puneet/
  Logs:    /usr/local/var/log/elasticsearch/elasticsearch_Puneet.log
  Plugins: /usr/local/opt/elasticsearch@5.6/libexec/plugins/
  Config:  /usr/local/etc/elasticsearch/
  plugin script: /usr/local/opt/elasticsearch@5.6/libexec/bin/elasticsearch-plugin

elasticsearch@5.6 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have elasticsearch@5.6 first in your PATH run:
  echo 'export PATH="/usr/local/opt/elasticsearch@5.6/bin:$PATH"' >> ~/.bash_profile


To have launchd start elasticsearch@5.6 now and restart at login:
  brew services start elasticsearch@5.6
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/elasticsearch@5.6/bin/elasticsearch
==> Summary
  🍺  /usr/local/Cellar/elasticsearch@5.6/5.6.16: 106 files, 36.0MB, built in 6 seconds

然后我將 5.6 添加到$PATH 現在,當我嘗試使用brew switch elasticsearch 5.6切換 elasticsearch 版本時,我得到:

Error: elasticsearch does not have a version "5.6" in the Cellar.
elasticsearch installed versions: 6.8.4

知道我在這里缺少什么嗎?

看起來我在故障排除一段時間后找到了解決方案。

為了在您的開發機器上維護 elasticsearch 的多個版本,您需要執行以下操作:

假設我安裝了 6.8.4,我還想要另一個版本。 為了同時維護兩者,首先通過鍵入以下內容檢查您的系統(mac)的所有版本: brew search elasticsearch ,我的系統支持 ES 的 3 個版本:

  1. elasticsearch - 最新穩定(已安裝)
  2. 彈性搜索@2.4
  3. 彈性搜索@5.6

為了擁有 2.4,您必須執行以下操作:

$ brew install elasticsearch@2.4
# After installation type:
$ brew services stop elasticsearch
# above command will stop elasticsearch (lastest stable) service
# add 2.4 to $PATH
$ echo 'export PATH="/usr/local/opt/elasticsearch@2.4/bin:$PATH"' >> ~/.bash_profile
# start the service of 2.4
$ brew services start elasticsearch@2.4
# check for the service/installation
$ launchctl list | grep elasticsearch
# above command should show you a port

現在你可以在瀏覽器中點擊http://localhost:9200它應該會顯示 2.4

要切換回最新的穩定版本:

$ brew services stop elasticsearch
# remove entry from $PATH variable
$ brew services start elasticsearch

在我看來, brew switch elasticsearch [VERSION]不起作用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM