带你读《Elastic Stack 实战手册》之8:—— 3.4.1.1.安装Elasticsearch(本地及docker)(5)

本文涉及的产品
检索分析服务 Elasticsearch 版,2核4GB开发者规格 1个月
简介: 带你读《Elastic Stack 实战手册》之8:—— 3.4.1.1.安装Elasticsearch(本地及docker)(5)

《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.1.Elastic Stack 安装部署—— 3.4.1.1.安装Elasticsearch(本地及docker)(4) https://developer.aliyun.com/article/1231510


最简启动

 

docker-compose up --build(如果要后台运行可以加参数 -d,如果目录里有多个配置文件可以通过 -f 参数指定目标配置文件)

 

1、后台运行命令:docker-compose up -d --build

2、指定配置文件命令:docker-compose -f docker-compose.yml up -d --build

输出以下日志代表启动成功


[root@esteam7002 elasticsearch]# docker-compose up --build
Creating network "elasticsearch_default" with the default driver -> 初次启动创建专用网络
Creating volume "elasticsearch_data01" with local driver -> 初次启动创建专用存储
Creating es-node-01 ... done -> 创建ES节点
Attaching to es-node-01
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:28:05,581Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "version[7.10.1], pid[6], build[default/docker/1c34507e66d7db1211f66f3513706fdf548736aa/2020-12-05T01:00:33.671820Z], OS[Linux/3.10.0-1160.24.1.el7.x86_64/amd64], JVM[AdoptOpenJDK/OpenJDK 64-Bit Server VM/15.0.1/15.0.1+9]" } -> 节点启动系统环境信息
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:28:05,584Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "JVM home [/usr/share/elasticsearch/jdk], using bundled JDK [true]" } -> 节点JVM使用信息
…… 中间省略
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:15,770Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "initialized" } -> 节点信息初始化
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:15,773Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "starting ..." } -> 节点启动开始
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:15,949Z", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "publish_address {172.18.0.2:9300}, bound_addresses {[::]:9300}" } -> 节点集群内部数据传输接口开启
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:16,441Z", "level": "INFO", "component": "o.e.c.c.Coordinator", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "setting initial configuration to VotingConfiguration{s-6A5vqlQuKoZlyn-
TKdnA}" } -> 初始化投票配置
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:16,834Z", "level": "INFO", "component": "o.e.c.s.MasterService", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "elected-as-master ([1] nodes joined)[{es-node-01}{s-6A5vqlQuKoZlyn-TKdnA}{HD5TOEsDTUGWPFoR1pYUDg}{172.18.0.2}{172.18.0.2:9300}{cdhilmrstw}{ml.machine_memory=1927176192, xpack.installed=true, transform.node=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{es-node-01}{s-6A5vqlQuKoZlyn-TKdnA}{HD5TOEsDTUGWPFoR1pYUDg}{172.18.0.2}{172.18.0.2:9300}{cdhilmrstw}{ml.machine_memory=1927176192, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}" } -> 同集群发现节点信息
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:17,047Z", "level": "INFO", "component": "o.e.c.c.CoordinationState", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "cluster UUID set to [QDGTOlDiTm-9JkJrpg9q2Q]" } -> 集群id初始化
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:17,241Z", "level": "INFO", "component": "o.e.c.s.ClusterApplierService", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "master node changed {previous [], current [{es-node-01}{s-6A5vqlQuKoZlyn-TKdnA}{HD5TOEsDTUGWPFoR1pYUDg}{172.18.0.2}{172.18.0.2:9300}{cdhilmrstw}{ml.machine_memory=1927176192, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]}, term: 1, version: 1, reason: Publication{term=1, version=1}" } -> 集群选主完成
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:17,315Z", "level": "INFO", "component": "o.e.h.AbstractHttpServerTransport", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "publish_address {172.18.0.2:9200}, bound_addresses {[::]:9200}", "cluster.uuid": "QDGTOlDiTm-9JkJrpg9q2Q", "node.id": "s-6A5vqlQuKoZlyn-TKdnA"  } -> 节点restful监听接口开启
es-node-01    | {"type": "server", "timestamp": "2021-04-19T13:29:17,316Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "es-docker-cluster", "node.name": "es-node-01", "message": "started", "cluster.uuid": "QDGTOlDiTm-9JkJrpg9q2Q", "node.id": "s-6A5vqlQuKoZlyn-TKdnA"  } -> 节点启动完成

ES 启动状态校验

 

同上


节点停机

 

1、docker-compose down(docker-compose -f docker-compose.yml down)

2、当出现以下日志表明节点停机成功


[root@esteam7002 elasticsearch]# docker-compose -f docker-compose.yml down
Stopping es-node-01 ... done
Removing es-node-01 ... done
Removing network elasticsearch_default

MacOS 环境

 

MacOS 系统其实是一个类 Unix 系统,所以大部分的命令、环境属性等都和 Unix 系统类似。

tar 包安装和上文提到的,在 Linux 系统中基于 tar 包安装的过程大致一样。

 

1、需要注意的是,MacOS 作为一个较为特殊的操作系统,也会有一个专门针对 MacOS 系统编译出来的安装包

2、路径上的主要区别为 Linux 系统的安装包被标记了 linux,MacOS 的安装包被标记了

darwin

3、https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-darwin-x86_64.tar.gz

 

brew 安装

 

通过命令 brew tap elastic/tap 将 Elastic 原厂的仓库地址加入 homebrew 的配置


brew tap elastic/tap
Updating Homebrew...
==> Tapping elastic/tap
Cloning into '/usr/local/Homebrew/Library/Taps/elastic/homebrew-tap'...
remote: Enumerating objects: 890, done.
remote: Counting objects: 100% (131/131), done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 890 (delta 80), reused 57 (delta 26), pack-reused 759
Receiving objects: 100% (890/890), 206.46 KiB | 310.00 KiB/s, done.
Resolving deltas: 100% (666/666), done.
Tapped 17 formulae (51 files, 327.7KB).
通过命令 brew install elastic/tap/elasticsearch-full 进行安装:
➜ ~ brew install elastic/tap/elasticsearch-full
==> Installing elasticsearch-full from elastic/tap
==> Downloading https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.1-darwin-x86_64.tar.gz?tap=elas
######################################################################## 100.0%
Warning: Tried to install empty array to /usr/local/etc/elasticsearch/jvm.options.d
==> codesign -f -s - /usr/local/Cellar/elasticsearch-full/7.12.1/libexec/modules/x-pack-ml/platform/darwin-x86_64/contr
==> find /usr/local/Cellar/elasticsearch-full/7.12.1/libexec/jdk.app/Contents/Home/bin -type f -exec codesign -f -s - {
==> Caveats
Data:    /usr/local/var/lib/elasticsearch/elasticsearch_chenchen/ -> 数据目录
Logs:    /usr/local/var/log/elasticsearch/elasticsearch_chenchen.log -> 普通日志文件
Plugins: /usr/local/var/elasticsearch/plugins/ -> 插件目录
Config:  /usr/local/etc/elasticsearch/ -> 配置文件目录
To have launchd start elastic/tap/elasticsearch-full now and restart at login:
brew services start elastic/tap/elasticsearch-full
Or, if you don't want/need a background service you can just run:
elasticsearch
==> Summary
961 files, 503MB, built in 9 seconds


主要文件路径,也可以通过命令 brew info elasticsearch-full 查看(内容和安装日志类似)


➜ ~ brew info elasticsearch-full
elastic/tap/elasticsearch-full: stable 7.12.1
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
Conflicts with:
elasticsearch
/usr/local/Cellar/elasticsearch-full/7.12.1 (960 files, 503MB) *
Built from source on 2021-05-14 at 23:45:38
From: https://github.com/elastic/homebrew-tap/blob/HEAD/Formula/elasticsearch-full.rb
==> Caveats
Data:    /usr/local/var/lib/elasticsearch/elasticsearch_chenchen/
Logs:    /usr/local/var/log/elasticsearch/elasticsearch_chenchen.log
Plugins: /usr/local/var/elasticsearch/plugins/
Config:  /usr/local/etc/elasticsearch/
To have launchd start elastic/tap/elasticsearch-full now and restart at login:
brew services start elastic/tap/elasticsearch-full
Or, if you don't want/need a background service you can just run:
elasticsearch


注意,通过常规方式安装 brew install elasticsearch 会安装 7.10.2,通过命令 brew info

elasticsearch 也可以得到相应的信息,但是这个版本的 ES 存在一些启动上的问题

 

所以还是建议通过原厂建议的 brew info elasticsearch-full 命令进行安装和测试,目前通过这个命令会安装 7.12 版本,和本文中其它的版本不太一致

 

这些路径可能会因为系统的不同而有些许不同,也可能会有 /Users/steven/working/sourcecode/homebrew/etc/elasticsearch/ 格式的情况



《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.1.Elastic Stack 安装部署—— 3.4.1.1.安装Elasticsearch(本地及docker)(6) https://developer.aliyun.com/article/1231508


 

相关实践学习
使用阿里云Elasticsearch体验信息检索加速
通过创建登录阿里云Elasticsearch集群,使用DataWorks将MySQL数据同步至Elasticsearch,体验多条件检索效果,简单展示数据同步和信息检索加速的过程和操作。
ElasticSearch 入门精讲
ElasticSearch是一个开源的、基于Lucene的、分布式、高扩展、高实时的搜索与数据分析引擎。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr(也是基于Lucene)。 ElasticSearch的实现原理主要分为以下几个步骤: 用户将数据提交到Elastic Search 数据库中 通过分词控制器去将对应的语句分词,将其权重和分词结果一并存入数据 当用户搜索数据时候,再根据权重将结果排名、打分 将返回结果呈现给用户 Elasticsearch可以用于搜索各种文档。它提供可扩展的搜索,具有接近实时的搜索,并支持多租户。
相关文章
|
4天前
|
存储 机器学习/深度学习 中间件
快速上手 Elasticsearch:Docker Compose 部署详解
本文介绍了如何使用Docker Compose快速搭建Elasticsearch学习环境。Elasticsearch是一款用于实时搜索和分析的分布式中间件,适用于多种场景,如搜索、日志分析、机器学习等。首先,创建docker网络,拉取最新版8.12.2镜像。接着,编写docker-compose.yml文件,配置单节点集群,设置端口映射、内存限制及数据卷挂载。然后,创建并配置数据卷目录,允许远程访问和跨域。最后,启动服务并验证,通过浏览器访问确认服务运行正常。本文为初学者提供了一个简便的Elasticsearch部署方法。
79 4
快速上手 Elasticsearch:Docker Compose 部署详解
|
16天前
|
Ubuntu 虚拟化 Docker
Docker的安装
Docker的安装
41 0
|
27天前
|
Ubuntu Docker 容器
如何在Ubuntu上安装Docker?
【2月更文挑战第10天】
178 0
|
23天前
|
Oracle 关系型数据库 数据库
如何利用 Docker 安装 Oracle 数据库
【2月更文挑战第14天】
64 0
|
7天前
|
关系型数据库 分布式数据库 PolarDB
PolarDB常见问题之安装gms时出现docker如何解决
PolarDB是阿里云推出的下一代关系型数据库,具有高性能、高可用性和弹性伸缩能力,适用于大规模数据处理场景。本汇总囊括了PolarDB使用中用户可能遭遇的一系列常见问题及解答,旨在为数据库管理员和开发者提供全面的问题指导,确保数据库平稳运行和优化使用体验。
|
9天前
|
Devops 开发工具 数据安全/隐私保护
Docker Swarm总结+CI/CD Devops、gitlab、sonarqube以及harbor的安装集成配置(3/5)
Docker Swarm总结+CI/CD Devops、gitlab、sonarqube以及harbor的安装集成配置(3/5)
35 0
|
9天前
|
NoSQL 关系型数据库 MySQL
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
128 0
|
10天前
|
NoSQL MongoDB Docker
docker安装MongoDB
docker安装MongoDB
16 0
|
12天前
|
负载均衡 应用服务中间件 nginx
|
16天前
|
Linux iOS开发 Docker
Docker多平台安装
Docker多平台安装
44 0

相关产品

  • 检索分析服务 Elasticsearch版