从零开始学Elasticsearch(一)下载与安装

这是我参与11月更文挑战的第19天,活动详情查看:2021最后一次更文挑战

Elasticsearch是个开源分布式搜索引擎,提供搜集、分析、存储数据三大功能。它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载等。

下载安装Elasticsearch

1.1 下载

1.1.1 在终端中输入以下命令(前提是已经安装了brew)

setp1: brew tap elastic/tap
复制代码

image.png

step2: brew install elastic/tap/elasticsearch-full
复制代码

image.png

1.1.2 启动Elasticsearch

./elasticsearch
复制代码

image.png

可以通过访问 localhost:9200 看下是否启动成功。

image.png 启动成功将会显示Elasticsearch的信息

1.2 Elasticsearch的文件目录结构

目录 配置文件 描述
bin 脚本文件,包括启动elasticsearch,安装插件,运行统计数据等
config elasticsearch.yml 集群配置文件,suer,role based 相关配置
JDK Java运行环境
data path.data 数据文件
lib Java类库
logs path.log 日志文件
modules 包含所有ES模块
plugins 包含所有已安装插件

1.3 安装Elasticsearch插件

1.3.1 检查已安装的Elasticsearch插件

1.执行:

/bin/elasticsearch-plugin list
复制代码

2.通过以下命令安装国际化分词插件

./elasticsearch-plugin install analysis-icu
复制代码

image.png

访问 http://localhost:9200/_cat/plugins 查看已安装的插件

image.png

1.4多节点集群

输入以下指令:

bin/elasticsearch -E node.name=node0 -E cluster.name=geektime -E path.data=node0_data -d
bin/elasticsearch -E node.name=node1 -E cluster.name=geektime -E path.data=node1_data -d
复制代码

可以一起直接执行,开启成功后,可以在http://localhost:9200/_cat/nodes 中查看。

image.png

猜你喜欢

转载自juejin.im/post/7033028150191718407