记 etcd 无法在docker-compose.yml启动后无法映射数据库目录的问题

1、将etcd 单独提取 Dockerfile,指定配置文件和数据目录

#镜像
FROM bitnami/etcd:3.5.11
#名称
ENV name="etcd"
#重启
ENV restart="always"
#运行无权限
ENV ALLOW_NONE_AUTHENTICATION="yes"
#端口
EXPOSE 2379 2380
#管理员权限才能创建数据库
USER root
# 设置入口点
ENTRYPOINT ["etcd"]
#命令
CMD ["--data-dir", "/etcd-data", \
"--config-file", "/opt/bitnami/etcd/conf/etcd.yaml"]

2、同目录下写配置文件 etcd.yaml

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## This is the configuration file for the etcd server.# Human-readable name for this member.
name: 'default'# Path to the data directory.
data-dir: '/etcd-data'# Path to the dedicated wal directory.
wal-dir:# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 10000# Time (in milliseconds) of a heartbeat interval.
heartbeat-interval: 100# Time (in milliseconds) for an election to timeout.
election-timeout: 1000# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 0# List of comma separated URLs to listen on for peer traffic.
listen-peer-urls: http://0.0.0.0:2380# List of comma separated URLs to listen on for client traffic.
listen-client-urls: http://0.0.0.0:2379# Maximum number of snapshot files to retain (0 is unlimited).
max-snapshots: 5# Maximum number of wal files to retain (0 is unlimited).
max-wals: 5# Comma-separated white list of origins for CORS (cross-origin resource sharing).
cors:# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
initial-advertise-peer-urls: http://0.0.0.0:2380# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: http://0.0.0.0:2379# Discovery URL used to bootstrap the cluster.
discovery:# Valid values include 'exit', 'proxy'
discovery-fallback: 'proxy'# HTTP proxy to use for traffic to discovery service.
discovery-proxy:# DNS domain used to bootstrap initial cluster.
discovery-srv:# Initial cluster configuration for bootstrapping.
initial-cluster:# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'etcd-cluster'# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false# Accept etcd V2 client requests
enable-v2: true# Enable runtime profiling data via HTTP server
enable-pprof: true# Valid values include 'on', 'readonly', 'off'
proxy: 'off'# Time (in milliseconds) an endpoint will be held in a failed state.
proxy-failure-wait: 5000# Time (in milliseconds) of the endpoints refresh interval.
proxy-refresh-interval: 30000# Time (in milliseconds) for a dial to timeout.
proxy-dial-timeout: 1000# Time (in milliseconds) for a write to timeout.
proxy-write-timeout: 5000# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0client-transport-security:# Path to the client server TLS cert file.cert-file:# Path to the client server TLS key file.key-file:# Enable client cert authentication.client-cert-auth: false# Path to the client server TLS trusted CA cert file.trusted-ca-file:# Client TLS using generated certificatesauto-tls: falsepeer-transport-security:# Path to the peer server TLS cert file.cert-file:# Path to the peer server TLS key file.key-file:# Enable peer client cert authentication.client-cert-auth: false# Path to the peer server TLS trusted CA cert file.trusted-ca-file:# Peer TLS using generated certificates.auto-tls: false# Enable debug-level logging for etcd.
debug: falselogger: zap# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
log-outputs: [stderr]# Force to create a new one member cluster.
force-new-cluster: falseauto-compaction-mode: periodic
auto-compaction-retention: "1"

3、写启动脚本startetcd.sh

#构建镜像
docker build -t etcd .sleep 1#目录以及授权
mkdir $(pwd)/etcd-data
touch $(pwd)/etcd.yaml
sudo chmod 777 $(pwd)/etcd.yamldocker run -d \-p 2379:2379 \-p 2380:2380 \-v $(pwd)/etcd-data:/etcd-data \-v $(pwd)/etcd.yaml:/opt/bitnami/etcd/conf/etcd.yaml \--name etcd \etcdsleep 3#检查是否启动成功-输出版本号
curl "http://127.0.0.1:2379/version"

4、同级目录下启动startetcd.sh

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

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

相关文章

怎样才不算干扰球·棒球1号位

在棒球运动中,"干扰球"(Interference)是指球员或场外人员非法影响了比赛的正常进行。以下情况通常 不构成干扰,属于合法行为或无需判罚: 1. 击跑员(Batter-Runner)合法跑垒 跑垒限制…

PyTorch实现多输入输出通道的卷积操作

本文通过代码示例详细讲解如何在PyTorch中实现多输入通道和多输出通道的卷积运算,并对比传统卷积与1x1卷积的实现差异。 1. 多输入通道互相关运算 当输入包含多个通道时,卷积核需要对每个通道分别进行互相关运算,最后将结果相加。以下是实现…

深入解析 MySQL 中的日期时间函数:DATE_FORMAT 与时间查询优化、DATE_ADD、CONCAT

深入解析 MySQL 中的日期时间函数:DATE_FORMAT 与时间查询优化 在数据库管理和应用开发中,日期和时间的处理是不可或缺的一部分。MySQL 提供了多种日期和时间函数来满足不同的需求,其中DATE_FORMAT函数以其强大的日期格式化能力,…

SSH配置优化:提升本地内网Linux服务器远程连接速度与稳定性

文章目录 引言一. 理解SSH连接过程与影响因素二. 服务器端SSH配置优化三. 客户端SSH配置优化四. 高级技巧五. 内网穿透突破公网IP限制总结 引言 SSH (Secure Shell) 是一种网络协议,用于加密的网络服务,常用于远程登录和管理Linux服务器。对于本地内网的…

BERT - MLM 和 NSP

本节代码将实现BERT模型的两个主要预训练任务:掩码语言模型(Masked Language Model, MLM) 和 下一句预测(Next Sentence Prediction, NSP)。 1. create_nsp_dataset 函数 这个函数用于生成NSP任务的数据集。 def cr…

“实时滚动”插件:一个简单的基于vue.js的无缝滚动

1、参考连接: 安装 | vue-seamless-scroll 2、使用步骤: 第一步:安装 yarn add vue-seamless-scroll 第二步:引入 import vueSeamlessScroll from vue-seamless-scroll/src 第三步:注册 components: { vueSeamless…

【蓝桥杯】赛前练习

1. 排序 import os import sysn=int(input()) data=list(map(int,input().split(" "))) data.sort() for d in data:print(d,end=" ") print() for d in data[::-1]:print(d,end=" ")2. 走迷宫BFS import os import sys from collections import…

pyTorch-迁移学习-学习率衰减-四种天气图片多分类问题

目录 1.导包 2.加载数据、拼接训练、测试数据的文件夹路径 3.数据预处理 3.1 transforms.Compose数据转化 3.2分类存储的图片数据创建dataloader torchvision.datasets.ImageFolder torch.utils.data.DataLoader 4.加载预训练好的模型(迁移学习) 4.1固定、修改预训练…

第十四届蓝桥杯大赛软件赛国赛Python大学B组题解

文章目录 弹珠堆放划分偶串交易账本背包问题翻转最大阶梯最长回文前后缀贸易航线困局 弹珠堆放 递推式 a i a i − 1 i a_ia_{i-1}i ai​ai−1​i, n 20230610 n20230610 n20230610非常小,直接模拟 答案等于 494 494 494 划分 因为总和为 1 e 6 1e6…

Python 和 JavaScript两种语言的相似部分-由DeepSeek产生

Python 和 JavaScript 作为两种流行的编程语言,虽然在设计目标和应用场景上有差异(Python 偏向后端和脚本,JavaScript 偏向前端和动态交互),但它们的语法存在许多相似之处。以下是两者在语法上的主要共同点及对比&…

改善 Maven 的依赖性

大家好,这里是架构资源栈!点击上方关注,添加“星标”,一起学习大厂前沿架构! 建议使用mvn dependency:analyze命令来摆脱已声明但未使用的依赖项: 还有另一个用例, mvn dependency:analyze 它可…

【SQL】子查询详解(附例题)

子查询 子查询的表示形式为:(SELECT 语句),它是IN、EXISTS等运算符的运算数,它也出现于FROM子句和VALUES子句。包含子查询的查询叫做嵌套查询。嵌套查询分为相关嵌套查询和不想关嵌套查询 WHERE子句中的子查询 比较运算符 子查询的结果是…

Stable Diffusion 扩展知识实操整合

本文的例子都是基于秋叶整合包打开的webui实现的 一、ADetailer——改善人脸扭曲、恶心 After detailer插件可以自动检测生成图片的人脸,针对人脸自动上蒙版,自动进行重绘,整个流程一气呵成,因此可以避免许多重复的操作。除此之…

freertos内存管理简要概述

概述 内存管理的重要性 在嵌入式系统中,内存资源通常是有限的。合理的内存管理可以确保系统高效、稳定地运行,避免因内存泄漏、碎片化等问题导致系统崩溃或性能下降。FreeRTOS 的内存管理机制有助于开发者灵活地分配和释放内存,提高内存利用…

按规则批量修改文件扩展名、删除扩展名或添加扩展名

文件的扩展名是多种多样的,有些不同文件的扩展名之间相互是可以直接转换的。我们工作当中最常见的就是 doc 与 docx、xls 与 xlsx、jpg 与 jpeg、html 与 htm 等等,这些格式在大部分场景下都是可以相互转换 能直接兼容的。我们今天要介绍的就是如何按照一…

热门面试题第15天|最大二叉树 合并二叉树 验证二叉搜索树 二叉搜索树中的搜索

654.最大二叉树 力扣题目地址(opens new window) 给定一个不含重复元素的整数数组。一个以此数组构建的最大二叉树定义如下: 二叉树的根是数组中的最大元素。左子树是通过数组中最大值左边部分构造出的最大二叉树。右子树是通过数组中最大值右边部分构造出的最大…

MySQL学习笔记7【InnoDB】

Innodb 1. 架构 1.1 内存部分 buffer pool 缓冲池是主存中的第一个区域,里面可以缓存磁盘上经常操作的真实数据,在执行增删查改操作时,先操作缓冲池中的数据,然后以一定频率刷新到磁盘,这样操作明显提升了速度。 …

RNN、LSTM、GRU汇总

RNN、LSTM、GRU汇总 0、论文汇总1.RNN论文2、LSTM论文3、GRU4、其他汇总 1、发展史2、配置和架构1.配置2.架构 3、基本结构1.神经元2.RNN1. **RNN和前馈网络区别:**2. 计算公式:3. **梯度消失:**4. **RNN类型**:(查看发展史)5. **…

django数据迁移操作受阻

错误信息: django.db.utils.OperationalError: (1227, Access denied; you need (at least one of) the SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation)根据错误信息分析,该问题是由于MySQL用户 缺乏SYSTEM_VARI…

WinForm真入门(13)——ListBox控件详解

WinForm ListBox 详解与案例 一、核心概念 ‌ListBox‌ 是 Windows 窗体中用于展示可滚动列表项的控件,支持单选或多选操作,适用于需要用户从固定数据集中选择一项或多项的场景‌。 二、核心属性 属性说明‌Items‌管理列表项的集合,支持动…