Jump to content

9.安裝Elasticsearch


Recommended Posts

當你安裝LNMP一鍵安裝包或寶塔面板,並配置Nginx、MySQL/MariaDB、PHP之後

就來安裝Elasticsearch

IPS 4.5.3修改 .... Elasticsearch必须运行至少6.0.0版本,但小于7.7.0版本

IPS论坛设置Elasticsearch,才能搜索中文 [简体]

 

------------------------------------------------------------
安裝 Java Runtime 1.8
------------------------------------------------------------

指令
yum install java-1.8.0

Installed size: 138 M
Is this ok [y/d/N]:
開始安裝
按 y
 

 

指令
yum install java-1.8.0-openjdk-devel

Installed size: 40 M
Is this ok [y/d/N]:
開始安裝
按 y
 

 


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

下載rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.2.rpm

 

安裝rpm
sudo rpm --install elasticsearch-6.7.2.rpm

 

指令
sudo systemctl daemon-reload
 

指令
sudo systemctl enable elasticsearch.service

 

 

修改檔案
vi /etc/elasticsearch/elasticsearch.yml


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

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

 

儲存並離開
:wq

 

 

 

修改檔案
vi /etc/elasticsearch/jvm.options


# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

會看到兩個,表示預設 RAM 1 GB
-Xms1g
-Xmx1g

改為 (如果發現Elasticsearch當掉,可嘗試調更低)
-Xms256m
-Xmx256m
 

儲存並離開
:wq

 

 

啟動指令
sudo systemctl start elasticsearch.service

 


狀態指令
service elasticsearch status

需要運行
Active: active (running)

 


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

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

Edited by Jack
Link to post
Share on other sites

Elasticsearch的中文搜索,此处只是本地 localhost 使用

所以Elasticsearch使用的 9200 Port 不要外连

 

你最好再确保

大厂的WAF防火墙,若你开启 9200 Port,那就关闭

你云主机Linux的防火墙,若你开启 9200 Port,那就关闭

Link to post
Share on other sites

若你安装的elasticsearch版本太旧或太新,就要卸载,重新安装IPS论坛支持的elasticsearch版本

elasticsearch1.png

 

 

-------------------------------------------------------------
卸载Elasticsearch命令
-------------------------------------------------------------

这个卸载方法,限rpm安装的elasticsearch


查询命令
rpm -qa | grep elasticsearch


得知你安装 elasticsearch-7.10.2-1.x86_64


因为用rpm安装的elasticsearch,所以卸载也用rpm命令
rpm --erase elasticsearch-7.10.2-1.x86_64

 

删除目录,有文件要删掉
rm -f -r /etc/elasticsearch

 

删除目录,有文件要删掉
rm -f -r /var/lib/elasticsearch

 

重启
sudo reboot

 


回到上面的教程 安装Elasticsearch

wget https://artifacts.elastic.co/downloads/elasticsearch/某版本.rpm

重新安装IPS论坛支持的elasticsearch版本

elasticsearch1.png

 

Edited by Jack
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...