Install Elasticsearch with Docke

Install Elasticsearch with Docke

参考链接

Start a single-node cluster

link to

start a multi-node cluster with docker composer

link to

docker composer file

  • .env
# Password for the 'elastic' user (at least 6 characters)
ELASTIC_PASSWORD=# Password for the 'kibana_system' user (at least 6 characters)
KIBANA_PASSWORD=# Version of Elastic products
STACK_VERSION={version}# Set the cluster name
CLUSTER_NAME=docker-cluster# Set to 'basic' or 'trial' to automatically start the 30-day trial
LICENSE=basic
#LICENSE=trial# Port to expose Elasticsearch HTTP API to the host
ES_PORT=9200
#ES_PORT=127.0.0.1:9200# Port to expose Kibana to the host
KIBANA_PORT=5601
#KIBANA_PORT=80# Increase or decrease based on the available host memory (in bytes)
MEM_LIMIT=1073741824# Project namespace (defaults to the current folder name if not set)
#COMPOSE_PROJECT_NAME=myproject
  • docker-composer.yml
version: "2.2"services:setup:image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}volumes:- certs:/usr/share/elasticsearch/config/certsuser: "0"command: >bash -c 'if [ x${ELASTIC_PASSWORD} == x ]; thenecho "Set the ELASTIC_PASSWORD environment variable in the .env file";exit 1;elif [ x${KIBANA_PASSWORD} == x ]; thenecho "Set the KIBANA_PASSWORD environment variable in the .env file";exit 1;fi;if [ ! -f config/certs/ca.zip ]; thenecho "Creating CA";bin/elasticsearch-certutil ca --silent --pem -out config/certs/ca.zip;unzip config/certs/ca.zip -d config/certs;fi;if [ ! -f config/certs/certs.zip ]; thenecho "Creating certs";echo -ne \"instances:\n"\"  - name: es01\n"\"    dns:\n"\"      - es01\n"\"      - localhost\n"\"    ip:\n"\"      - 127.0.0.1\n"\"  - name: es02\n"\"    dns:\n"\"      - es02\n"\"      - localhost\n"\"    ip:\n"\"      - 127.0.0.1\n"\"  - name: es03\n"\"    dns:\n"\"      - es03\n"\"      - localhost\n"\"    ip:\n"\"      - 127.0.0.1\n"\> config/certs/instances.yml;bin/elasticsearch-certutil cert --silent --pem -out config/certs/certs.zip --in config/certs/instances.yml --ca-cert config/certs/ca/ca.crt --ca-key config/certs/ca/ca.key;unzip config/certs/certs.zip -d config/certs;fi;echo "Setting file permissions"chown -R root:root config/certs;find . -type d -exec chmod 750 \{\} \;;find . -type f -exec chmod 640 \{\} \;;echo "Waiting for Elasticsearch availability";until curl -s --cacert config/certs/ca/ca.crt https://es01:9200 | grep -q "missing authentication credentials"; do sleep 30; done;echo "Setting kibana_system password";until curl -s -X POST --cacert config/certs/ca/ca.crt -u "elastic:${ELASTIC_PASSWORD}" -H "Content-Type: application/json" https://es01:9200/_security/user/kibana_system/_password -d "{\"password\":\"${KIBANA_PASSWORD}\"}" | grep -q "^{}"; do sleep 10; done;echo "All done!";'healthcheck:test: ["CMD-SHELL", "[ -f config/certs/es01/es01.crt ]"]interval: 1stimeout: 5sretries: 120es01:depends_on:setup:condition: service_healthyimage: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}volumes:- certs:/usr/share/elasticsearch/config/certs- esdata01:/usr/share/elasticsearch/dataports:- ${ES_PORT}:9200environment:- node.name=es01- cluster.name=${CLUSTER_NAME}- cluster.initial_master_nodes=es01,es02,es03- discovery.seed_hosts=es02,es03- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}- bootstrap.memory_lock=true- xpack.security.enabled=true- xpack.security.http.ssl.enabled=true- xpack.security.http.ssl.key=certs/es01/es01.key- xpack.security.http.ssl.certificate=certs/es01/es01.crt- xpack.security.http.ssl.certificate_authorities=certs/ca/ca.crt- xpack.security.transport.ssl.enabled=true- xpack.security.transport.ssl.key=certs/es01/es01.key- xpack.security.transport.ssl.certificate=certs/es01/es01.crt- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt- xpack.security.transport.ssl.verification_mode=certificate- xpack.license.self_generated.type=${LICENSE}- xpack.ml.use_auto_machine_memory_percent=truemem_limit: ${MEM_LIMIT}ulimits:memlock:soft: -1hard: -1healthcheck:test:["CMD-SHELL","curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",]interval: 10stimeout: 10sretries: 120es02:depends_on:- es01image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}volumes:- certs:/usr/share/elasticsearch/config/certs- esdata02:/usr/share/elasticsearch/dataenvironment:- node.name=es02- cluster.name=${CLUSTER_NAME}- cluster.initial_master_nodes=es01,es02,es03- discovery.seed_hosts=es01,es03- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}- bootstrap.memory_lock=true- xpack.security.enabled=true- xpack.security.http.ssl.enabled=true- xpack.security.http.ssl.key=certs/es02/es02.key- xpack.security.http.ssl.certificate=certs/es02/es02.crt- xpack.security.http.ssl.certificate_authorities=certs/ca/ca.crt- xpack.security.transport.ssl.enabled=true- xpack.security.transport.ssl.key=certs/es02/es02.key- xpack.security.transport.ssl.certificate=certs/es02/es02.crt- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt- xpack.security.transport.ssl.verification_mode=certificate- xpack.license.self_generated.type=${LICENSE}- xpack.ml.use_auto_machine_memory_percent=truemem_limit: ${MEM_LIMIT}ulimits:memlock:soft: -1hard: -1healthcheck:test:["CMD-SHELL","curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",]interval: 10stimeout: 10sretries: 120es03:depends_on:- es02image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}volumes:- certs:/usr/share/elasticsearch/config/certs- esdata03:/usr/share/elasticsearch/dataenvironment:- node.name=es03- cluster.name=${CLUSTER_NAME}- cluster.initial_master_nodes=es01,es02,es03- discovery.seed_hosts=es01,es02- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}- bootstrap.memory_lock=true- xpack.security.enabled=true- xpack.security.http.ssl.enabled=true- xpack.security.http.ssl.key=certs/es03/es03.key- xpack.security.http.ssl.certificate=certs/es03/es03.crt- xpack.security.http.ssl.certificate_authorities=certs/ca/ca.crt- xpack.security.transport.ssl.enabled=true- xpack.security.transport.ssl.key=certs/es03/es03.key- xpack.security.transport.ssl.certificate=certs/es03/es03.crt- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt- xpack.security.transport.ssl.verification_mode=certificate- xpack.license.self_generated.type=${LICENSE}- xpack.ml.use_auto_machine_memory_percent=truemem_limit: ${MEM_LIMIT}ulimits:memlock:soft: -1hard: -1healthcheck:test:["CMD-SHELL","curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",]interval: 10stimeout: 10sretries: 120kibana:depends_on:es01:condition: service_healthyes02:condition: service_healthyes03:condition: service_healthyimage: docker.elastic.co/kibana/kibana:${STACK_VERSION}volumes:- certs:/usr/share/kibana/config/certs- kibanadata:/usr/share/kibana/dataports:- ${KIBANA_PORT}:5601environment:- SERVERNAME=kibana- ELASTICSEARCH_HOSTS=https://es01:9200- ELASTICSEARCH_USERNAME=kibana_system- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}- ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES=config/certs/ca/ca.crtmem_limit: ${MEM_LIMIT}healthcheck:test:["CMD-SHELL","curl -s -I http://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",]interval: 10stimeout: 10sretries: 120volumes:certs:driver: localesdata01:driver: localesdata02:driver: localesdata03:driver: localkibanadata:driver: local

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/846706.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

数据库管理与开发基础教程复习(二)

Oraclec 常用工具 简单介绍: SQL*PLUS 由开始菜单启动和命令行启动 企业管理器 OEM Oracle 数据库集成管理平台 SOL PLUS常用命令 连接与断开数据库连接命令: -connect -disconnect 查看表结构命令: describe (desc) SOL*PLUS 环境参数设置命令 -set -arraysize -linesize -…

【Git基础】Gitee/GitHub使用

gitee介绍 gitee译为码云,是国内创建的一个类似与github的网站,可以上传自己的代码放在云端保存,下面介绍gitee如何使用,github类似使用操作。 git工具安装及基础 【git工具安装及基本使用】 gitee仓库创建.gitignore文件作用 git提交时需要忽略部分文件或目录本地仓库设置…

威联通-002 Docker镜像下载

@目录前言操作大纲1.登录阿里云镜像服务2.创建个人容器3.GitHub复制代码到本地库、配置信息4.点击修改自己想要拉取的镜像5.进入阿里云查看6.创建容器参考(可用)前言 由于国内几乎所有的docker库的封锁,现在不能进行docker镜像的拉取操作,尝试很多种方法都失败了,最后总结…

Mysql 一主一从配置

Mysql 一主一从配置 环境信息ip地址 主机信息 角色 mysql版本192.168.1.19 S600 主 8.0.40-0ubuntu0.20.04.1192.168.1.20 H840 从 8.0.40-0ubuntu0.20.04.1本环境已完成2台Mysql单机安装,Mysql单机安装操作文档 具体操作 Mysql主机配置 配置文件修改修改配置Master配置/etc/m…

Mycat2+Mysql一主一从实现读写分离配置

Mycat2+Mysql一主一从实现读写分离配置 前置配置Mysql一主一从搭建 Mycat2环境搭建环境信息ip地址 软件 角色 版本192.168.1.19 Mysql 主 8.0.40-0ubuntu0.20.04.1192.168.1.19 Mycat2 —— 1.21-release-3-14192.168.1.20 Mysql 从 8.0.40-0ubuntu0.20.04.1操作步骤 1. 修改并…

体验iOS手机群控免费苹果手机免越狱群控:银河中控全面解析

在多设备管理的需求日益增长的今天,能够高效地管理和控制多台iOS设备成为了一个重要的课题。对于不想或不能进行越狱操作的用户来说,找到一种安全、合法且高效的解决方案显得尤为重要。本章将深入探讨一款名为“银河中控”的免费苹果手机免越狱群控系统,帮助您了解其功能特性…

k8s~关于非常啰嗦的标签和选择器

总感觉k8s中定义的deplyment和service非常的啰嗦,尤其是在选择器的定义上,但没办法,它的设计总有它的道理。svc(spec.selector.app)deployment(metadata.labels.app,spec.selector.matchLabels.app)pods(metadata.labels.app)nginx的部署 下面是一个 Kubernetes YAML 文件示…

Windows11中安装SQL Server 2019

介绍 Microsoft SQL Server 是一种关系数据库管理系统 (RDBMS)。 应用程序和工具连接到 SQL Server 实例或数据库,并使用 Transact-SQL (T-SQL) 进行通信。 SQL Server Management Studio (SSMS) 是一种集成环境,用于管理任何 SQL 基础结构。 使用 SSMS 访问、配置、管理和开…

python项目安装虚拟环境

滴水成冰,世间不存在毫无意义的付出,时间终会给你答案。

边坡检测解决方案,根据实际需求来定制方案

大家好,我是星创易联的林工。今天跟大家聊一聊我们做边坡监测的那些事儿。 ​ (参考:key-iot.com.cn ) 说到边坡监测啊,最重要的就是安全。我们公司这些年一直在这个领域深耕,积累了不少经验。来,我给大家详细说说我们是怎么做的。 首先啊,我们要先摸清楚这个边坡的脾气。用我…

【科普系列】ICMPv6协议基础简介

引言在科普介绍文章《IPv6协议—互联网通信协议第六版》中介绍了IPv6协议,这次的科普主题是ICMPv6(Internet Control Message Protocol version 6),它作为IPv6网络中的核心协议之一,是网络通信中不可或缺的一部分。ICMPv6的设计继承了IPv4中ICMPv4协议的基本功能,然而,它…

ELK常用命令

# 查询 logstash ps -ef|grep logstash # elastic ps -ef|grep elastic # kibana ps -ef|grep kibana# 关闭服务,根据线程id进行kill kill -9 {#线程id}# 进入目录 cd /opt/elk7.17/ # 查看logstash日志 tail -f /opt/elk7.17/logstash/output.log tail -n 1000 logstash/…