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.zzvips.com/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))