自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

終于有 Go 版的 Elasticsearch 了

開發(fā) 后端
企業(yè)內(nèi)部搭建搜索引擎常用 Solr、Elasticsearch,它們都是使用 Java 實(shí)現(xiàn)的,底層依賴 Lucene,Java 相對(duì)來說占用較多內(nèi)存。而今天要介紹的這個(gè)項(xiàng)目,目標(biāo)就是作為 ES 的替代者,一個(gè)輕量級(jí)搜索引擎:Zinc。

[[440189]]

本文轉(zhuǎn)載自微信公眾號(hào)「polarisxu」,作者站長(zhǎng)polaris  。轉(zhuǎn)載本文請(qǐng)聯(lián)系polarisxu公眾號(hào)。

大家好,我是 polarisxu。

企業(yè)內(nèi)部搭建搜索引擎常用 Solr、Elasticsearch,它們都是使用 Java 實(shí)現(xiàn)的,底層依賴 Lucene,Java 相對(duì)來說占用較多內(nèi)存。而今天要介紹的這個(gè)項(xiàng)目,目標(biāo)就是作為 ES 的替代者,一個(gè)輕量級(jí)搜索引擎:Zinc。

項(xiàng)目地址:https://github.com/prabhatsharma/zinc,該項(xiàng)目開源十來天,目前 Star 數(shù) 3.4k+。

Zinc 是一個(gè)全文索引的搜索引擎。它是 Elasticsearch 的輕量級(jí)替代品,可以在不到 100 MB 的 RAM 中運(yùn)行。它使用 bluge 作為底層索引庫(kù)。

而且,Zinc 使用 Vue 打造了一個(gè)比 Elasticsearch 更簡(jiǎn)單、更易于操作的界面。

zinc

如果你只是使用 API 獲取數(shù)據(jù)并使用 kibana 進(jìn)行搜索(Kibana 不支持 Zinc。Zinc 提供了自己的 UI),那么它是 Elasticsearch 的直接替代品。

Zinc 主要有如下特性:

  • 提供全文索引功能
  • 單個(gè)二進(jìn)制文件即可安裝、運(yùn)行,支持多平臺(tái)。這得益于 Go 語言
  • 用 Vue 編寫的用于查詢數(shù)據(jù)的 Web UI
  • 與 Elasticsearch 兼容的數(shù)據(jù)獲取 API(單記錄和批量 API)
  • 開箱即用的身份驗(yàn)證
  • Schema less - 無需預(yù)先定義 schema,同一索引中的不同文檔可以有不同的字段

不過,目前 Zinc 還處于 alpha 階段,而且缺少集群,可用性也沒得到很好的驗(yàn)證。

關(guān)于如何安裝使用,項(xiàng)目首頁有說明,支持普通安裝(可以直接下載編譯好的二進(jìn)制文件),也支持 Docker 和 K8S 安裝使用。

我根據(jù)說明,在本地搭建后,根據(jù)提供的示例數(shù)據(jù)構(gòu)建索引:

  1. $ FIRST_ADMIN_USER=admin FIRST_ADMIN_PASSWORD=Complexpass#123 ./zinc 
  2. {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Loading indexes..."
  3. {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Loading system indexes..."
  4. {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Index loaded: _users"
  5. {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Index loaded: _index_mapping"
  6. {"level":"debug","time":"2021-12-12T22:53:51+08:00","message":"Error loading .env file"
  7. [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production. 
  8.  - using env: export GIN_MODE=release 
  9.  - using code: gin.SetMode(gin.ReleaseMode) 
  10.  
  11. [GIN-debug] GET    /healthz                  --> github.com/prabhatsharma/zinc/pkg/meta/v1.GetHealthz (3 handlers) 
  12. [GIN-debug] GET    /                         --> github.com/prabhatsharma/zinc/pkg/meta/v1.GUI (3 handlers) 
  13. [GIN-debug] GET    /ui/*filepath             --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers) 
  14. [GIN-debug] HEAD   /ui/*filepath             --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers) 
  15. [GIN-debug] POST   /api/login                --> github.com/prabhatsharma/zinc/pkg/handlers.ValidateCredentials (3 handlers) 
  16. [GIN-debug] PUT    /api/user                 --> github.com/prabhatsharma/zinc/pkg/handlers.CreateUpdateUser (4 handlers) 
  17. [GIN-debug] DELETE /api/user/:userID         --> github.com/prabhatsharma/zinc/pkg/handlers.DeleteUser (4 handlers) 
  18. [GIN-debug] GET    /api/users                --> github.com/prabhatsharma/zinc/pkg/handlers.GetUsers (4 handlers) 
  19. [GIN-debug] PUT    /api/index                --> github.com/prabhatsharma/zinc/pkg/handlers.CreateIndex (4 handlers) 
  20. [GIN-debug] GET    /api/index                --> github.com/prabhatsharma/zinc/pkg/handlers.ListIndexes (4 handlers) 
  21. [GIN-debug] PUT    /api/:target/document     --> github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument (4 handlers) 
  22. [GIN-debug] POST   /api/:target/_search      --> github.com/prabhatsharma/zinc/pkg/handlers.SearchIndex (4 handlers) 
  23. [GIN-debug] PUT    /es/:target/_doc/:id      --> github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument (4 handlers) 
  24. [GIN-debug] DELETE /es/:target/_doc/:id      --> github.com/prabhatsharma/zinc/pkg/handlers.DeleteDocument (4 handlers) 
  25. [GIN-debug] POST   /es/:target/_doc          --> github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument (4 handlers) 
  26. [GIN-debug] PUT    /es/:target/_create/:id   --> github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument (4 handlers) 
  27. [GIN-debug] POST   /es/:target/_create/:id   --> github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument (4 handlers) 
  28. [GIN-debug] POST   /es/:target/_update/:id   --> github.com/prabhatsharma/zinc/pkg/handlers.UpdateDocument (4 handlers) 
  29. [GIN-debug] POST   /es/_bulk                 --> github.com/prabhatsharma/zinc/pkg/handlers.BulkHandler (4 handlers) 
  30. [GIN-debug] POST   /es/:target/_bulk         --> github.com/prabhatsharma/zinc/pkg/handlers.BulkHandler (4 handlers) 
  31. [GIN-debug] Listening and serving HTTP on :4080 

訪問 https://localhost:4080 即可看到上面的界面。

 

目前 Go 語言中文網(wǎng)的搜索使用的是 Solr,抽空嘗試驗(yàn)證 Zinc,如果穩(wěn)定、成熟,考慮遷移到 Zinc。

 

責(zé)任編輯:武曉燕 來源: polarisxu
相關(guān)推薦

2023-11-02 08:43:08

protocgo兼容

2015-09-21 09:38:48

Spotlight鎖屏Windows 10

2015-07-27 18:23:13

google

2022-11-08 08:29:43

Goslog 庫(kù)工具

2013-01-22 10:54:51

HTML5App移動(dòng)應(yīng)用

2015-06-25 18:58:36

Win10

2021-12-06 12:48:40

Gosyncatomic

2017-02-08 16:14:32

Chrome瀏覽器IOS

2012-05-18 11:36:21

Firefox瀏覽器

2019-04-08 12:14:59

Elasticsear程序員Lucene

2024-12-04 07:00:00

2022-11-02 15:35:35

Condition代碼線程

2020-08-06 16:55:37

虛擬化底層計(jì)算機(jī)

2019-07-24 09:59:21

iPhoneiOS 12.4數(shù)據(jù)遷移

2021-07-26 05:00:16

算法DfsBfs

2023-10-31 07:40:15

EslintJSHint

2024-07-08 00:00:07

2024-03-25 07:45:00

AI視頻

2021-09-16 12:10:24

物聯(lián)網(wǎng)互聯(lián)網(wǎng)應(yīng)用

2021-03-15 13:58:42

微軟開源Go
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)