etcd

更强、更稳、更高效:解读 etcd 技术升级的三驾马车

爱⌒轻易说出口 提交于 2019-12-06 09:58:17
点击下载《不一样的 双11 技术:阿里巴巴经济体云原生实践》 本文节选自《不一样的 双11 技术:阿里巴巴经济体云原生实践》一书,点击上方图片即可下载! 作者 | 陈星宇(宇慕)阿里云基础技术中台技术专家 导读 :etcd 是阿里巴巴内部容器云平台用于存储关键元信息的组件。阿里巴巴使用 etcd 已经有 3 年的历史, 在今年 双11 过程中它又一次承担了关键角色,接受了 双11 大压力的检验。为了让更多同学了解到 etcd 的最佳实践和阿里巴巴内部的使用经验,本文作者将和大家分享阿里巴巴是如何把 etcd 升级得更强、更稳、更高效的,希望通过这篇文章让更多人了解 etcd, 享受云原生技术带来的红利。 让 etcd 变得更强 本节主要介绍 etcd 在性能方面的升级工作。首先我们来理解一下 etcd 的性能背景。 性能背景 这里先庖丁解牛,将 etcd 分为如下几个部分,如下图所示: 每一部分都有各自的性能影响,让我们逐层分解: raft 层:raft 是 etcd 节点之间同步数据的基本机制,它的性能受限于网络 IO、节点之间的 rtt 等, WAL 受到磁盘 IO 写入延迟; 存储层:负责持久化存储底层 kv, 它的性能受限于磁盘 IO,例如:fdatasync 延迟、内存 treeIndex 索引层锁的 block、boltdb Tx 锁的 block 以及 boltdb

如何将Rancher 2.1.x 从单节点安装迁移到高可用安装

£可爱£侵袭症+ 提交于 2019-12-06 06:53:31
Rancher提供了两种安装方法,即单节点安装和高可用安装。单节点安装可以让用户快速部署适用于短期开发或PoC的Rancher 2.x,而高可用部署则明显更适合Rancher的长期部署。 要点须知 针对开源用户,对于从单个节点迁移到HA的工作,Rancher Labs不提供官方技术支持。 以防在此过程中出现问题,您应该熟悉Rancher架构以及故障排除的方法。 前期准备 为了顺利将单个节点Rancher安装迁移到高可用性安装,您必须做如下准备: 您需要运行Rancher的2.1.x版本以及RKE 的0.1.x版本 server-url参数必须是可以被更改为指向HA Rancher安装的DNS名称。如果您的server-url是IP地址,则必须先将server-url更改为DNS名称并更新用户集群的节点/集群代理,以便在迁移后允许HA集群的nginx ingress控制器能够正确路由Rancher流量。否则,您将无法访问所有工作负载集群。 您需要配置专门用于在HA中运行Rancher的新实例。因为执行就地迁移非常危险,并且没有回滚策略。我们强烈建议您参考官方建议的架构。 ( https://rancher.com/docs/rancher/v2.x/en/installation/ha/#recommended-architecture )

kubernetes v1.14.0版本集群搭建(centos7)

时光毁灭记忆、已成空白 提交于 2019-12-06 06:50:56
一.主机环境配置(centos7.6) 1.主机名设置 1 #所有主机分别设置如下 2 # hostnamectl set-hostname master 3 # hostnamectl set-hostname node1 4 # hostnamectl set-hostname node2 2.主机名绑定hosts #所有主机设置相同 # cat /etc/hosts ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ​ 192.168.11.111 master 192.168.11.112 node1 192.168.11.113 node2 3.静态ip设置 # cat /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE="Ethernet" BOOTPROTO="static" NAME="eth0" DEVICE="eth0" ONBOOT="yes" IPADDR="192.168.11.111" PREFIX="24" GATEWAY="192.168.11.253" ​ #

How can I get the IP address of a unit started on a machine and use it in another unit with fleet?

南笙酒味 提交于 2019-12-06 06:45:59
问题 I'm new to CoreOS and Docker and I'm facing with a problem with fleet. I have a standard unit launching a POSTGRES container and I would like to know the IP address of the machine where this unit is started . I have actually a cluster of 3 machines and the POSTGRES unit isn't always started on the same machine (which means the IP is not static). I need it when I start another unit (see below), which needs a POSTGRES. I'm using at the moment the Unit Parameter called BindsTo : [Unit]

二进制安装K8S集群

≡放荡痞女 提交于 2019-12-06 02:40:33
centos linux7.5 cat > /etc/hosts << EOF 192.168.199.221 master 192.168.199.222 node1 192.168.199.223 node2 EOF 1、关闭防火墙、关闭selinux、关闭swapoff -a systemctl stop firewalld selinux=disabled swapoff -a 2、安装docker 1)常用方法 a、配置yum源 阿里镜像源 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo Docker官方镜像源 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo b、安装docker 显示docker-ce所有可安装版本: yum list docker-ce --showduplicates | sort -r 安装指定docker版本 yum install docker-ce-18.06.1.ce-3.el7 -y 设置镜像存储目录 找到大点的挂载的目录进行存储 # 修改docker配置 vi /lib

K8S数据迁移方法

佐手、 提交于 2019-12-06 02:38:29
Kubernetes改变了我们所有人对计算平台的看法。我们同样也需要改变现代应用程序存储数据的方式。企业越来越多地依赖数字服务来接触客户,传统企业正在Kubernetes上重新部署它们的IT应用和服务。容器的可移植性和Kubernetes自动化的好处意味着在整个IT开发/测试和生产生命周期中我们可以更快、更可靠地交付应用程序。与此同时,企业必须认识到多云部署不仅仅是一种供应策略,而且还是一种对客户最合理的应用程序交付方式。 传统的存储行业还没有做好足够的工作来解决K8S的问题:容器可移植性、K8S自动化和多云交付。 Portworx企业版首先为K8S中大数据量的工作负载提供无缝的高可用性,无论这些工作负载是在本地系统还是在公共云中运行,都将提供无缝的高可用性。通过Portworx,开发团队可以获得集成调度程序、完整的数据生命周期管理,以及核心生产功能,如BYOK加密和云备份。 通过与那些已经把应用部署在主要的公有云平台或自有硬件平台上的优秀客户合作,Portworx已经掌握了完整的数据可迁移性、操作自动化、以及将含有大量数据的应用交付到多云部署中的真正能力。 可迁移性和易操作性 通过控制与K8S的集成方式,PX-Motion为大量数据型工作负载带来了充分的可迁移性。现在,类似Kubernetes为无状态工作负载带来的方便一样,我们在有状态工作负载上为客户的数据库、分析堆栈

六、部署master

不羁的心 提交于 2019-12-06 02:04:30
1、下载 下载地址: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md 这个二进制包中包含了master和node的所有组件 2、创建对应的目录,并将二进制包中对应的可执行文件拷贝到对应目录 [root@k8s-master01 master]# tree kubernetes/ kubernetes/ ├── bin │ ├── kube-apiserver │ ├── kube-controller-manager │ ├── kubectl │ └── kube-scheduler ├── cfg ├── logs └── ssl 3、创建对应的配置文件 [root@k8s-master01 master]# cat kubernetes/cfg/kube-apiserver.conf KUBE_APISERVER_OPTS="--logtostderr=false \ --v=2 \ --log-dir=/opt/kubernetes/logs \ --etcd-servers=https://10.16.8.161:2379,https://10.16.8.162:2379,https://10.16.8.163:2379 \ --bind-address=10.16.8.150

四、etcd数据库集群部署

余生长醉 提交于 2019-12-06 02:00:53
1、下载安装 二进制下载: https://github.com/coreos/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz 1 [root@k8s-master01 ~]# tar xf etcd-v3.3.13-linux-amd64.tar.gz 2 [root@k8s-master01 ~]# cd etcd-v3.3.13-linux-amd64 3 [root@k8s-master01 etcd-v3.3.13-linux-amd64]# ll 4 总用量 29776 5 drwxr-xr-x 10 1000 1000 4096 5月 3 2019 Documentation 6 -rwxr-xr-x 1 1000 1000 16927136 5月 3 2019 etcd 7 -rwxr-xr-x 1 1000 1000 13498880 5月 3 2019 etcdctl 8 -rw-r--r-- 1 1000 1000 38864 5月 3 2019 README-etcdctl.md 9 -rw-r--r-- 1 1000 1000 7262 5月 3 2019 README.md 10 -rw-r--r-- 1 1000 1000 7855 5月 3 2019 READMEv2

三、为etcd自签证书

可紊 提交于 2019-12-06 01:59:08
准备工作 需要两套证书,一套k8s通讯使用,一套etcd内部通讯使用 下载证书生成工具 [root@k8s-master01 k8s]# curl -L https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -o /usr/local/bin/cfssl [root@k8s-master01 k8s]# curl -L https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -o /usr/local/bin/cfssljson [root@k8s-master01 k8s]# curl -L https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64 -o /usr/local/bin/cfssl-certinfo [root@k8s-master01 k8s]# chmod +x /usr/local/bin/cfssl* etcd自签证书 1、为etcd创建自签证书 创建CA配置json文件 1 [root@k8s-master01 etcd]# cat ca-csr.json 2 { 3 "CN": "etcd CA", 4 "key": { 5 "algo": "rsa", 6 "size": 2048 7 }, 8 "names": [ 9 {

etcd启动报错:couldn't find local name \"default\" in the initial cluster configuration

北城以北 提交于 2019-12-05 22:17:36
启动etcd的时候报错: # systemctl restart etcd Job for etcd.service failed because the control process exited with error code. See "systemctl status etcd.service" and "journalctl -xe" for details. # journalctl -xe Nov 28 10:26:07 mysql7 systemd[1]: Starting Etcd Server... -- Subject: Unit etcd.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit etcd.service has begun starting up. Nov 28 10:26:07 abce etcd[2598]: recognized and used environment variable ETCD_ADVERTISE_CLIENT_URLS=http://10.10.20.70:2379 Nov 28 10:26:07 abce