1. 什么是Elasticsearch
Elasticsearch 是位于 Elastic Stack 核心的分布式搜索和分析引擎。Logstash 和 Beats 有助于收集、聚合和豐富您的數據并將其存儲在 Elasticsearch 中。Kibana 使您能夠以交互方式探索、可視化和分享對數據的見解,并管理和監控堆棧。
Elasticsearch 為所有類型的數據提供近乎實時的搜索和分析。無論您擁有結構化或非結構化文本、數字數據還是地理空間數據,Elasticsearch 都能以支持快速搜索的方式高效地存儲和索引它。您可以超越簡單的數據檢索和聚合信息來發現數據中的趨勢和模式。隨著您的數據和查詢量的增長,Elasticsearch 的分布式特性使您的部署能夠隨之無縫增長。
官方地址: https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-10-1
1. 下載安裝包
root@es-61:/usr/local/src# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
root@es-61:~# wget http://www.zmynmublwnt.cn/uploads/allimg/i5fjcouzp2s.deb
root@es-61:/usr/local/src# mv /root/elasticsearch-7.10.1-amd64.deb .
2. 使用dpkg安裝
root@es-61:/usr/local/src# dpkg -i elasticsearch-7.10.1-amd64.deb
Selecting previously unselected package elasticsearch.
(Reading database ... 67415 files and directories currently installed.)
Preparing to unpack elasticsearch-7.10.1-amd64.deb ...
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Unpacking elasticsearch (7.10.1) ...
Setting up elasticsearch (7.10.1) ...
Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.52) ...
3. 修改主配置文件
# cat /etc/elasticsearch/elasticsearch.yml
cluster.name: skywalking-es 集群名稱
node.name: node-1 節點名稱
network.host: 10.0.0.61 監聽地址,寫本機地址
http.port: 9200 監聽端口,默認為9200
discovery.seed_hosts: ["10.0.0.61"] 如果是多個節點,可以做集群選舉。單實例寫本機地址即可
cluster.initial_master_nodes: ["10.0.0.61"] 哪個節點可以被初始化為master節點,填寫本機
action.destructive_requires_name: true 刪除索引的時候必須要填寫索引的完整名稱,不能*去匹配
4. 啟動elasticsearch
root@es-61:/usr/local/src# systemctl start elasticsearch.service
加入開機自啟動
root@es-61:/usr/local/src# systemctl enable elasticsearch.service
Synchronizing state of elasticsearch.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable elasticsearch
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /usr/lib/systemd/system/elasticsearch.service.
5. 檢查端口是正常狀態。
root@es-61:/usr/local/src# ss -tnlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=956,fd=13))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1226,fd=3))
LISTEN 0 128 [::ffff:10.0.0.61]:9200 *:* users:(("java",pid=1921,fd=267))
LISTEN 0 128 [::ffff:10.0.0.61]:9300 *:* users:(("java",pid=1921,fd=265))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=1226,fd=4))