記 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.pswp.cn/news/901034.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/901034.shtml
英文地址,請注明出處:http://en.pswp.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?管理列表項的集合,支持動…