etcd单节点数据备份与恢复
插入测试数据
# etcdctl put smith
# etcdctl put allen
# etcdctl put ward
# etcdctl put jones
# etcdctl put martin
# etcdctl put blake
# etcdctl put clark
# etcdctl put scott
# etcdctl put king
# etcdctl put turner
# etcdctl put adams
# etcdctl put james
# etcdctl put ford
# etcdctl put miller
查看数据
# etcdctl get --prefix ""
adams allen blake clark ford james jones king martin miller scott smith turner ward
做快照
# etcdctl snapshot save backup.db
{"level":"info","ts":1570085496.5022638,"caller":"snapshot/v3_snapshot.go:109","msg":"created temporary db file","path":"backup.db.part"}
{"level":"warn","ts":"2019-10-03T14:51:36.503+0800","caller":"clientv3/retry_interceptor.go:116","msg":"retry stream intercept"}
{"level":"info","ts":1570085496.5036564,"caller":"snapshot/v3_snapshot.go:120","msg":"fetching snapshot","endpoint":"127.0.0.1:2379"}
{"level":"info","ts":1570085496.5214782,"caller":"snapshot/v3_snapshot.go:133","msg":"fetched snapshot","endpoint":"127.0.0.1:2379","took":0.018938519}
{"level":"info","ts":1570085496.521635,"caller":"snapshot/v3_snapshot.go:142","msg":"saved","path":"backup.db"}
Snapshot saved at backup.db
查看快照信息
# etcdctl snapshot status backup.db --write-out=table
+----------+----------+------------+------------+
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE |
+----------+----------+------------+------------+
| 6d1803a9 | | | kB |
+----------+----------+------------+------------+
清空数据
# etcdctl del --prefix ""
删除当前etcd的data目录,否则会报错目录已存在
# rm -rf /usr/local/etcd/data
恢复数据
# etcdctl snapshot restore backup.db --data-dir="/usr/local/etcd/data"
{"level":"info","ts":1570085656.639806,"caller":"snapshot/v3_snapshot.go:286","msg":"restoring snapshot","path":"backup.db","wal-dir":"/usr/local/etcd/data/member/wal","data-dir":"/usr/local/etcd/data","snap-dir":"/usr/local/etcd/data/member/snap"}
{"level":"info","ts":1570085656.7266932,"caller":"membership/cluster.go:392","msg":"added member","cluster-id":"cdf818194e3a8c32","local-member-id":"","added-peer-id":"8e9e05c52164694d","added-peer-peer-urls":["http://localhost:2380"]}
{"level":"info","ts":1570085656.7834268,"caller":"snapshot/v3_snapshot.go:299","msg":"restored snapshot","path":"backup.db","wal-dir":"/usr/local/etcd/data/member/wal","data-dir":"/usr/local/etcd/data","snap-dir":"/usr/local/etcd/data/member/snap"}
恢复完成后需要将从备份重新生成的data目录的属主和属组修改为etcd系统服务中的对应属主和属组
# chown -R tnuser.dba /usr/local/etcd/data
重启etcd系统服务
# systemctl stop etcd
# systemctl start etcd
再次查看恢复的数据
# etcdctl get --prefix ""
adams allen blake clark ford james jones king martin miller scott smith turner ward
etcd单节点数据备份与恢复的更多相关文章
- 部署k8s集群之环境搭建和etcd单节点安装
环境搭建以及etcd 单节点安装过程 安装之前的环境搭建 在进行k8s安装之前先把虚拟机准备好,这里准备的是三台虚拟机 主机名 ip地址 角色 master 172.16.163.131 master ...
- Redis单节点数据同步到Redis集群
一:Redis集群环境准备 1:需要先安装好Redis集群环境并配置好集群 192.168.0.113 7001-7003 192.168.0.162 7004-7006 2:检查redis集群 [r ...
- Elasticsearch:单节点数据迁移
Elasticsearch数据迁移:windows单节点迁移到windows 将源数据中的ES安装目录下的data/nodes目录整体拷贝到目标ES的对应目录下 迁移前请备份:迁移后需要重启ES: E ...
- hive单节点数据倾斜解决方法
一.现象 map/reduce程序执行时,reduce节点大部分执行完毕,但是有一个或者几个reduce节点运行很慢,导致整个程序的处理时间很长,这是因为某一个key的条数比其他key多很多(有时是百 ...
- etcd单节点安装
本篇安装单个etcd,然后进行扩容etcd节点至2个,环境配置如果做了的话就跳过 实验架构 test1: 192.168.0.91 etcd test2: 192.168.0.92 无 test3: ...
- Kubernetes后台数据库etcd:安装部署etcd集群,数据备份与恢复
目录 一.系统环境 二.前言 三.etcd数据库 3.1 概述 四.安装部署etcd单节点 4.1 环境介绍 4.2 配置节点的基本环境 4.3 安装部署etcd单节点 4.4 使用客户端访问etcd ...
- K8s二进制部署单节点 etcd集群,flannel网络配置 ——锥刺股
K8s 二进制部署单节点 master --锥刺股 k8s集群搭建: etcd集群 flannel网络插件 搭建master组件 搭建node组件 1.部署etcd集群 2.Flannel 网络 ...
- etcd数据备份与恢复验证
一.单机 说明:执行etcd备份数据的恢复的机器必须和原先etcd所在机器一致 1.单机备份 etcdctl --endpoints="https://10.25.72.62:2379&qu ...
- ETCD:单机单节点
原文地址:Setting up local clusters 设置单节点集群 对于测试环境与开发环境,最快速与简单的方式是配置一个本地集群.对于生产环境,参考集群部分. 本地单节点集群 启动一个集群 ...
随机推荐
- SIM800c收发短信及AT指令
一.sim800设备安装 淘宝搜索sim800,差不多就是这么个样子 购买之后,安装手机卡,卡的缺口向外插入,会有卡住的感觉,再按一下卡会弹出 安装usb转串口驱动(CH340),设备的指示灯先是快闪 ...
- Adboost几个要点分析
1.本质就是前向步进算法和加法模型,每一步计算分类器权重alpha和基分类器. 2.总体降低指数误差函数,转化为每一步降低分类误差率. 因为右边可以看作常数,所以相当于对这个进行优化 但是这一步可能做 ...
- SpringBoot项目构建、测试、热部署、配置原理、执行流程
SpringBoot项目构建.测试.热部署.配置原理.执行流程 一.项目构建 二.测试和热部署 三.配置原理 四.执行流程
- redis 短信验证码
127.0.0.1:6379> get CERTIYCODESENDFORAPP.1101:18222202889 "\xac\xed\x00\x05sr\x00\x11java.ut ...
- UVA 12063 Zeros and ones 一道需要好好体会的好题
#include<bits/stdc++.h> #include<stdio.h> #include<iostream> #include<cmath> ...
- CF 354 D 迷宫与门的旋转 BFS +状态压缩 一定要回头看看
D. Theseus and labyrinth time limit per test 3 seconds memory limit per test 256 megabytes input sta ...
- 2-SAT (two-statisfiability) 算法 学习笔记
$2-SAT$问题指的是对于若干限制求出一组可行解的问题. 考虑对于$n$个值域为${0,1}$的变量$x_1 , x_2 ,...,x_n$ 满足若干限制: 若 $x_i = p$ 则 $x_j = ...
- Implement TensorFlow's next_batch for own data
The version of numpy data import numpy as np class Dataset: def __init__(self, data): self._index_in ...
- Spring boot之JPA
JPA 步骤: (1)在pom.xml添加mysql,spring-data-jpa依赖 (2)在application.properties文件中配置mysql连接配置文件 (3)在applicat ...
- 关于Spring3与Jdk8 遇到的问题ArrayIndexOutOfBoundsException:xxxxxx
Spring 3不完全兼容JDK8. 需要升级到Spring 4才能使用Java 8 lambda表达式.