匯入Elasticsearch的PGP Key
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
設定Elasticsearch的Repository
vi /etc/yum.repos.d/elasticsearch.repo[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
備註:上述的設定是基於Elastic授權模式,如果要使用Apache 2.0授權模式的Elasticsearch,baseurl要改為baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum。
安裝Elasticsearch
sudo yum install elasticsearch
重新載入systemd的配置文件
sudo systemctl daemon-reload
設定開機時自動啟動Elasticsearch
sudo systemctl enable elasticsearch
啟動Elasticsearch
sudo systemctl start elasticsearch
查看Elasticsearch啟動狀態
sudo systemctl status elasticsearch
透過journalctl指令查看日誌
sudo journalctl --unit elasticsearch
送出HTTP Request測試Elasticsearch運行
curl -X GET "localhost:9200"
備註:Elasticsearch下載後自帶OpenJDK 12.0.1,所以安裝Elasticsearch前不需要再另外安裝JAVA。JAVA路徑為/etc/share/elasticsearch/jdk/bin。JAVA環境變數可根據需求再做設定。
沒有留言:
張貼留言