跳转到帖子

10.安裝Elasticsearch搜尋中文 for Invision Community (Debian使用)


Jack

推荐的帖子

------------------------------------------------------------
安裝套件、依賴包
------------------------------------------------------------

安裝java
sudo apt-get install -y default-jdk

java -version

 


------------------------------------------------------------
安裝 Elasticsearch
------------------------------------------------------------


官網 歷史版本
https://www.elastic.co/downloads/past-releases/


因為IPS論壇後台有寫到,IPS 4.7.x版本至少運行Elasticsearch 7.2.0版本,但小於Elasticsearch  8.0.0版本

所以目前只能用Elasticsearch舊版本

https://www.elastic.co/downloads/past-releases/elasticsearch-7-17-20

 


下載舊版本 elasticsearch-7.17.20
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.20-amd64.deb


sudo dpkg -i elasticsearch-7.17.20-amd64.deb


sudo systemctl daemon-reload


sudo systemctl enable elasticsearch.service


sudo systemctl start elasticsearch.service

 

 

---------------------------------------
修改 elasticsearch.yml
---------------------------------------

vi /etc/elasticsearch/elasticsearch.yml


#network.host: 192.168.0.1
修改為
network.host: 127.0.0.1

# http.port: 9200
修改為
http.port: 9200

儲存並離開
:wq

 

 


---------------------------------------
jvm.options
---------------------------------------

vi /etc/elasticsearch/jvm.options

The heap size is automatically configured by Elasticsearch based on the available memory in your system and the roles each node is configured to fulfill. If specifying heap is required, it should be done through a file in jvm.options.d, and the min and max should be set to the same value. For example, to set the heap to 4 GB, create a new file in the jvm.options.d directory containing these lines:

堆大小由 Elasticsearch 根據系統中的可用記憶體以及每個節點配置要履行的角色自動配置。
如果需要指定堆,則應透過 jvm.options.d 中的檔案來完成,並且 min 和 max 應設定為相同的值。
例如,要將堆疊設定為 4 GB,請在 jvm.options.d 目錄中建立一個包含以下行的新檔案:

會看到這兩個,默認內存 4GB
-Xms4g
-Xmx4g

 

-------------------------------------------------------------
這個elasticsearch版本,要來jvm.options.d目錄底下修改
-------------------------------------------------------------

vi /etc/elasticsearch/jvm.options.d/Xms-and-Xmx

這兩個,默認內存 4GB
-Xms4g
-Xmx4g

 

改為 .... 因為只是小論壇用量不大,就越低越好
-Xms128m
-Xmx128m

 

儲存並離開
:wq

 


---------------------------------------
啟動
---------------------------------------

啟動
sudo systemctl start elasticsearch.service


狀態命令
service elasticsearch status

 

測試 Elasticsearch 是否安裝成功
curl http://127.0.0.1:9200


成功的話,會有訊息,例如 You Know, for Search

 

-------------------------------------------------------------
移除elasticsearch
-------------------------------------------------------------


sudo dpkg -r elasticsearch


可以得知你安裝的elasticsearch版本
正在移除 elasticsearch (7.17.20)……
Stopping elasticsearch service... OK
Deleting log directory... OK

刪除目錄,要刪掉檔案
rm -f -r /etc/elasticsearch


刪除目錄,要刪掉檔案
rm -f -r /var/lib/elasticsearch

重開機
sudo reboot


回到上面的教學,再次安裝Elasticsearch其他版本


 

本帖最后于,由Jack编辑
意见的链接
分享到其他网站

创建帐户或登录后发表意见

你需要成为会员才能发表意见

创建帐户

在我们的论坛注册新帐户,只需要几个简单步骤!

注册帐户

登录

已有帐户?请登录。

立刻登录
×
×
  • 创建新的...