带你读《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可以用于搜索各种文档。它提供可扩展的搜索,具有接近实时的搜索,并支持多租户。
相关文章
|
21天前
|
弹性计算 Ubuntu Linux
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS
阿里云服务器一键安装Docker社区版教程,基于系统运维管理OOS自动化部署。支持Ubuntu 22.04/20.04、CentOS 7.7-7.9及Alibaba Cloud Linux 3.2104 LTS。前提条件:ECS实例需运行中且有公网。步骤:选择Docker扩展并安装,验证成功通过命令`docker -v`查看版本号。
220 79
|
1月前
|
NoSQL 关系型数据库 应用服务中间件
docker基础篇:安装tomcat
docker基础篇:安装tomcat
172 64
|
8天前
|
前端开发 应用服务中间件 nginx
docker安装nginx,前端项目运行
通过上述步骤,你可以轻松地在Docker中部署Nginx并运行前端项目。这种方法不仅简化了部署流程,还确保了环境的一致性,提高了开发和运维的效率。确保按步骤操作,并根据项目的具体需求进行相应的配置调整。
55 25
|
8天前
|
安全 数据安全/隐私保护 Docker
docker私有仓库harbor安装
通过以上步骤,您可以成功在企业内部安装和配置Harbor私有仓库,方便地管理和分发Docker镜像。Harbor不仅提供了基础的镜像管理功能,还增强了安全性、身份管理和审计功能,使其成为企业级容器镜像管理的理想选择。
60 22
|
25天前
|
NoSQL 关系型数据库 Redis
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
97 14
|
22天前
|
关系型数据库 MySQL 应用服务中间件
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
80 7
|
1月前
|
关系型数据库 MySQL 数据库
docker高级篇(大厂进阶):安装mysql主从复制
docker高级篇(大厂进阶):安装mysql主从复制
120 24
|
1月前
|
NoSQL 算法 Redis
docker高级篇(大厂进阶):安装redis集群
docker高级篇(大厂进阶):安装redis集群
129 24
|
1月前
|
Ubuntu Linux Docker
Ubuntu22.04上Docker的安装
通过以上详细的安装步骤和命令,您可以在Ubuntu 22.04系统上顺利安装
947 12
|
2月前
|
缓存 Linux Docker
【最新版正确姿势】Docker安装教程(简单几步即可完成)
之前的老版本Docker安装教程已经发生了变化,本文分享了Docker最新版安装教程,其他操作系统版本也可以参考官 方的其他安装版本文档。
2777 3
【最新版正确姿势】Docker安装教程(简单几步即可完成)

热门文章

最新文章

相关产品

  • 检索分析服务 Elasticsearch版