ETCD服务
ETCD
简介
ETCD是一个开源的、分布式的键值对数据存储系统,由Go语言实现,用于存储key-value键值对,同时不仅仅是存储,主要用途是提供共享配置及服务发现,使用Raft一致性算法来管理高度可用的复制日志。有下面特点
- 简单:定义明确,面向用户的API(gRPC)
- 安全:具有可选客户端证书身份验证的自动TLS
- 快速:基准测试10,000次/秒
- 可靠:使用Raft正确分布
NOTE:
ETCD适用于较小的原数据键值对的处理,对于大的键值对数据的处理回导致其他请求时间的增加。数据目前最大支持1M数据的RPC请求,目前来说没有办法实现更大数据的配置
使用场景:服务发现、消息定义发布、负载均衡、分布式通知与协调、分布式锁、分布式队列、集群监控与Leader竞选
安装
环境Linux,下载安装包https://github.com/etcd-io/etcd/releases/download/v3.4.0/etcd-v3.4.0-linux-amd64.tar.gz到本地,从git中筛选版本https://github.com/etcd-io/etcd/releases
[root@centos7 ~]# wget https://github.com/etcd-io/etcd/releases/download/v3.4.0/etcd-v3.4.0-linux-amd64.tar.gz
解压
[root@centos7 ~]# tar zxvf etcd-v3.4.0-linux-amd64.tar.gz
进入目录,启动,默认监听本地2379端口
[root@centos7 ~]# cd etcd-v3.4.0-linux-amd64
[root@centos7 etcd-v3.4.0-linux-amd64]# ./etcd
验证
[root@centos7 etcd-v3.4.0-linux-amd64]# ./etcdctl put foo bar
OK
[root@centos7 etcd-v3.4.0-linux-amd64]# ./etcdctl get foo
foo
bar
查看接口版本
[root@centos7 etcd-v3.4.0-linux-amd64]# ./etcdctl version
etcdctl version: 3.4.0
API version: 3.4
查看集群成员信息
[root@centos7 ~]# etcdctl member list
8e9e05c52164694d, started, default, http://localhost:2380, http://localhost:2379, false
简单使用
写入
[root@centos7 ~]# etcdctl put foo bar
OK
[root@centos7 ~]# etcdctl put foo1 bar1
OK
读取
[root@centos7 ~]# etcdctl get foo
foo
bar
[root@centos7 ~]# etcdctl get foo --print-value-only
bar
[root@centos7 ~]# etcdctl get --prefix foo
foo
bar
foo1
bar1
删除
[root@centos7 ~]# etcdctl del foo
1
[root@centos7 ~]# etcdctl get foo
租期
授权租期
[root@centos7 ~]# etcdctl lease grant 20
lease 694d6d2a9dbd8d0d granted with TTL(20s)
[root@centos7 ~]# etcdctl put --lease=694d6d2a9dbd8d0d foo bar
OK
[root@centos7 ~]# etcdctl get foo
foo
bar
[root@centos7 ~]# etcdctl get foo
撤销租期
[root@centos7 ~]# etcdctl lease grant 60
lease 694d6d2a9dbd8d1c granted with TTL(60s)
[root@centos7 ~]# etcdctl put --lease=694d6d2a9dbd8d1c foo bar
OK
[root@centos7 ~]# etcdctl lease revoke 694d6d2a9dbd8d1c
lease 694d6d2a9dbd8d1c revoked
[root@centos7 ~]# etcdctl get foo
租期保持存活
[root@centos7 ~]# etcdctl lease grant 10
lease 694d6d2a9dbd8d24 granted with TTL(10s)
[root@centos7 ~]# etcdctl lease keep-alive 694d6d2a9dbd8d24
lease 694d6d2a9dbd8d24 keepalived with TTL(10)
lease 694d6d2a9dbd8d24 keepalived with TTL(10)
lease 694d6d2a9dbd8d24 keepalived with TTL(10)
lease 694d6d2a9dbd8d24 keepalived with TTL(10)
观察者
[root@centos7 ~]# etcdctl watch foo
PUT
foo
bar1
DELETE
foo
ETCD服务的更多相关文章
- 物联网架构成长之路(22)-Docker练习之Etcd服务搭建
0. 前言 时隔多日,前段时间忙完一个可有可无的项目后,又进入摸鱼时间,没有办法,非互联网公司,就是闲得蛋疼.又开始了自学之路.以前入门过Docker,然后又很久没有看了,最近重新看了一下,推荐一下这 ...
- docker (centOS 7) 使用笔记4 - etcd服务
本次测试的系统包含centos 7.2 64 bit,centos 7.3 64 bit 1. 安装 yum -y install etcd 2. 配置 此处一共准备了3台机器(10.10.10.10 ...
- 实现etcd服务注册与发现
转载自:实现etcd服务注册与发现 0.1.目录结构 . ├── api │ └── main.go ├── common │ └── common.go ├── docker-compose ...
- 实例解读丨关于GaussDB ETCD服务异常
摘要:本文通过对ETCD服务异常问题分析,代码展示解决方案. 本文分享自华为云社区<[实例状态]GaussDB ETCD服务异常>,作者:酷哥. 首先确认是否是虚拟机.网络故障 虚拟机故障 ...
- Golang etcd服务注册与发现
//sevice.go package discovery import ( "context" "errors" "sync" " ...
- etcd服务端和客户端安装
下载地址: 服务端:http://download.csdn.net/download/wuxun1997/9841277 客户端:http://download.csdn.net/download/ ...
- Docker+Jenkins持续集成环境(4):使用etcd+confd实现容器服务注册与发现
前面我们已经通过jenkins+docker搭建了基本的持续集成环境,实现了服务的自动构建和部署,但是,我们遇到一个问题,jenkins构建出来的镜像部署后,需要通过ip:port去访问,有什么更好的 ...
- shipyard 管理swarm集群(附etcd发现服务方法)
docker swarm集群 第一步:安装swarm集群 192.168.132.131----->(manger1,node) 192.168.132.132----->(manger2 ...
- etcd启用https服务
目录 cfssl相关工具下载 生成etcd所需要的ssl证书 生成ca证书 生成etcd服务端证书 生成etcd客户端证书 修改etcd集群配置文件 重启etcd集群 验证集群健康情况 关于etcd的 ...
随机推荐
- 洛谷 P1079 Vigenère 密码
目录 题目 思路 \(Code\) 题目 P1079 Vigenère 密码 思路 字符串+模拟.仔细读题,然后仔细敲代码(说了和没说一样)... \(Code\) #include<iostr ...
- mysql(一)工作原理 & 数据库引擎
参考文档 http://www.cnblogs.com/xiaotengyi/articles/3641983.html innodb:https://www.cnblogs.com/Aiapple/ ...
- [技术博客]采用Bootstrap框架进行排版布局
[技术博客]采用Bootstrap框架进行排版布局 网页的前端框架有很多很多种,比如Bootstrap.Vue.Angular等等,在最开始其实并没有考虑到框架这回事,开始阅读往届代码时发现其部分采用 ...
- Elasticsearch Java Rest Client简述
ESJavaClient的历史 JavaAPI Client 优势:基于transport进行数据访问,能够使用ES集群内部的性能特性,性能相对好 劣势:client版本需要和es集群版本一致,数据序 ...
- C# Microsoft.Office.Interop.Owc11 导出excel文件
C# Microsoft.Office.Interop.Owc11 导出excel文件 1.新建项SupremeWindowsForms窗体应用项目(项目平台设置称X86) 注意:因为大多数第三方写的 ...
- Server Tomcat v8.5 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
Server Tomcat v9.0 Server at localhost was unable to start within 45 seconds. If the server requires ...
- ps 渐进式图片的技巧(支持jpg,gif,png)
https://www.zhangxinxu.com/wordpress/2013/01/progressive-jpeg-image-and-so-on/ CTRL + SHIFT + ALT + ...
- kotlin基础 常见容器的取值范围
- Error-ASP.NET:无效的 JSON 基元: object。
ylbtech-Error-ASP.NET:无效的 JSON 基元: object. 1.返回顶部 1. “/”应用程序中的服务器错误. 无效的 JSON 基元: object. 说明: 执行当前 ...
- 查看ssh有没有被黑的IP
#grep "Failed password " /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -nr ...