k8s HA 高可用叢集之etcd叢集
Etcd叢集簡介
etcd元件作為一個高可用強一致性的服務發現儲存倉庫。我們此次在三個主機上搭建了一個包含三個Etcd節點的叢集,實現了叢集的動態擴充套件和收縮,並測試和驗證了Etcd叢集鍵——值儲存的一致性和高可用性。
一、環境準備
OS: Ubuntu 14.04
user: root
ipaddress: etcd01: 192.168.200.24
etcd02: 192.168.200.25
etcd03: 192.168.200.26
這裡用的是etcd-v2.3.7-linux-amd64.tar.gz
二、安裝配置etcd
etcd01上安裝
tar xf etcd-v2.3.7-linux-amd64.tar.gz cd etcd-v2.3.7-linux-amd64 cp etcd* /usr/local/bin/ |
建立etcd01指令碼,可方便配置etcd啟動引數 #cat etcd01 /usr/local/bin/etcd -name etcd01 \ -data-dir /data/etcd01 \ -advertise-client-urls http://192.168.200.24:2379,http://192.168.200.24:4001 \ -listen-client-urls http://0.0.0.0:2379,http://192.168.200.24:4001 \ -initial-advertise-peer-urls http://192.168.200.24:2380\ -listen-peer-urls http://0.0.0.0:2380 \ -initial-cluster-token etcd-cluster-1 \ -initial-cluster etcd01=http://192.168.200.24:2380,etcd02=http://192.168.200.25:2380,etcd03=http://192.168.200.26:2380 \ -initial-cluster-state new 引數說明:-name 指定名字 -data-dir 指定資料儲存目錄,預設是當前目錄 -initial-cluster-state 叢集狀態 new為新建立叢集 existing為已存在(可不指定) |
在etcd02 etcd03上分別做相似操作
指令碼中-advertise-client-urls 和 -initial-advertis-peer-urls 引數修改一下即可
然後分別執行指令碼:nohup ./etcd01 &
三、測試
在任一臺主機上執行etcdctl member list
#etcdctl member list 6a223770249e927d: name=etcd02 peerURLs=http://192.168.200.25:2380 clientURLs=http://192.168.200.25:2379,http://192.168.200.25:4001 isLeader=false 7e0ce16121dfea24: name=etcd01 peerURLs=http://192.168.200.24:2380 clientURLs=http://192.168.200.24:2379,http://192.168.200.24:4001 isLeader=true bfc28be8765b503e: name=etcd03 peerURLs=http://192.168.200.26:2380 clientURLs=http://192.168.200.26:2379,http://192.168.200.26:4001 isLeader=false |
可以看到叢集的節點情況,並能看出哪個是leader節點
我們在etcd01上設定一個key/value
[email protected]:~# etcdctl set api_server http://192.168.5.44:8080 http://192.168.5.44:8080 |
這時就可以在任意一臺主機上獲取這個key/value
[email protected]:~# etcdctl get api_server [email protected]:~# etcdctl get api_server http://192.168.5.44:8080 |
在member list上看到etcd01是leader ,這時把etcd01停掉(kill)
用etcdctl cluster-health檢視
[email protected]:~# etcdctl cluster-health member 6a223770249e927d is healthy: got healthy result from http://192.168.200.25:2379 failed to check the health of member 7e0ce16121dfea24 on http://192.168.200.24:2379: Get http://192.168.200.24:2379/health: dial tcp 192.168.200.24:2379: getsockopt: connection refused failed to check the health of member 7e0ce16121dfea24 on http://192.168.200.24:4001: Get http://192.168.200.24:4001/health: dial tcp 192.168.200.24:4001: getsockopt: connection refused member 7e0ce16121dfea24 is unreachable: [http://192.168.200.24:2379 http://192.168.200.24:4001] are all unreachable member bfc28be8765b503e is healthy: got healthy result from http://192.168.200.26:2379 cluster is healthy |
並且叢集leader進行了重新選舉
[email protected]:~# etcdctl member list 6a223770249e927d: name=etcd02 peerURLs=http://192.168.200.25:2380 clientURLs=http://192.168.200.25:2379,http://192.168.200.25:4001 isLeader=true 7e0ce16121dfea24: name=etcd01 peerURLs=http://192.168.200.24:2380 clientURLs=http://192.168.200.24:2379,http://192.168.200.24:4001 isLeader=false bfc28be8765b503e: name=etcd03 peerURLs=http://192.168.200.26:2380 clientURLs=http://192.168.200.26:2379,http://192.168.200.26:4001 isLeader=false |
現在etcd02是leader了,這時我們在群集中設定兩個key/value
[email protected]:~# etcdctl set test01 123456 123456 [email protected]:~# etcdctl set test02 abcdefg abcdefg |
重新啟動etcd01
[email protected]:~# etcdctl cluster-health member 6a223770249e927d is healthy: got healthy result from http://192.168.200.25:2379 member 7e0ce16121dfea24 is healthy: got healthy result from http://192.168.200.24:2379 member bfc28be8765b503e is healthy: got healthy result from http://192.168.200.26:2379 cluster is healthy |
[email protected]:~# etcdctl get test01 123456 [email protected]:~# etcdctl get test02 abcdefg |
但這時在etcd01重新加入叢集,並保持了key/value的全域性一致性,由此可見 etcd 搭建的叢集是可以實現高可用的。
Etcd叢集的擴充套件與收縮
etcd叢集如果收縮很簡單,直接在命令列輸入
etcdctl member remove {$memberID}
$memberID是你即將要刪除節點的etcd的ID,etcd的擴充套件有一些地方需要注意一下,我在這裡操作的時候遇到了不少坑。從上文寫到現在,有一個資料夾很重要,幾乎每個坑都與它有關,那就是-data-dir所宣告的資料夾,注意要擴充套件一個etcd叢集時,首先在叢集內的任一臺機器上輸入
etcdctl member add $etcd_name$peer_url
$etcd_name:新加入的etcd節點的名字
$peer_url:一般為新加入的節點 IP:2380
相關推薦
k8s HA 高可用叢集之etcd叢集
Etcd叢集簡介 etcd元件作為一個高可用強一致性的服務發現儲存倉庫。我們此次在三個主機上搭建了一個包含三個Etcd節點的叢集,實現了叢集的動態擴充套件和收縮,並測試和驗證了Etcd叢集鍵——值儲存的一致性和高可用性。 一、環境準備 OS: Ubuntu 14.
k8s kubernetes 高可用https and http叢集實戰 HA
kubernetes高可用叢集佈署 #[email protected] 20170509 本文分為兩篇 1.http方式仿問kube-apiserver的高可用模式,無證書模式1.5x yum安裝k8s所有元件 2.https方式訪問kube-apise
centos7 搭建ha(高可用)hadoop2.7.3叢集
寫在前面 作為一個單體應用開發人員對於理解分散式應用和微服務的理論還可以。但是部署分散式環境來說還是一個挑戰。最近在學習hadoop,正也把學習的東西分享出來,希望幫助感興趣的人。 前面一章寫了centos7搭建hadoop叢集 再跟著做本章實驗前建議初學
Oracle HA高可用性之RAC、Data Guard、Stream功能總結
Oracle資料庫的高可用性主要體現在其下的三個元件技術RAC、Data Guard、Streams。 先來看看官方文件怎麼介紹RAC、DG和Streams的。 以下摘取自Oracle 12c官方文件 《Real Application Clusters Administration
[K8s 1.9實踐]Kubeadm 1.9 HA 高可用 叢集 本地離線映象部署_Kubernetes中文社群
Kubeadm HA 1.9 高可用 叢集 本地離線部署 k8s介紹 k8s 發展速度很快,目前很多大的公司容器叢集都基於該專案,如京東,騰訊,滴滴,瓜子二手車,北森等等。 kubernetes1.9版本釋出2017年12月15日,每是那三個月一個迭代, Workloads API成為穩定版本,這消除
Rancher2.2.2-HA 高可用k8s容器叢集搭建
對於生產環境,需以高可用的配置安裝 Rancher,確保使用者始終可以訪問 Rancher Server。當安裝在Kubernetes叢集中時,Rancher將與叢集的 etcd 整合,並利用Kubernetes 排程實現高可用。 為確保高可用,本文所部署的 Kubernetes 叢集將專用於執行 Ranch
Spring Cloud 進階之路 -- Eureka的高可用,搭建 Eureka叢集(開發環境和生產環境)
Eureka 作為註冊中心,必須保障高可用,否則會直接影響有關的整個服務體系。 以下分別進行開發環境和生產環境的多服務中心叢集配置。 目錄 一、開發環境簡易配置: 1、配置Configurations 2、在Configurations 裡
CentOS 7部署Hadoop叢集(HA高可用叢集)
目錄 測試環境 Hadoop 組織框架 HDFS架構 YARN架構 HA叢集部署規劃 自動故障轉移 關於叢集主機時間 Linux環境搭建 配置Java環境 安裝單機版Hadoop Zookeeper叢集安裝 配置環境變數 關閉防火牆 修
Hadoop部署(六)——CentOS 7部署Hadoop叢集(HA高可用叢集)
目錄 測試環境 關閉防火牆 測試環境 Linux系統版本:CentOS 7 64位 Hadoop 組織框架 Hadoop主要包括兩部分: 一部分是HDFS(Hadoop Distr
Hadoop叢集的ResourceManager HA高可用配置
ResourceManager HA yarn-site.xml: <configuration> <!-- Site specific YARN configuration properties --> <property> <n
Hadoop叢集的Namenode HA高可用配置
HA配置首先要有zookeeper叢集,這裡就不再說明zookeeper叢集的搭建了,可以在我的前面的文章中找到 我這裡是在之前Hadoop單點的基礎上進行HA配置的 叢集HA規劃: cdh0: Namenode Datanode JournalNod
centos7 hadoop HA高可用叢集搭建( hadoop2.7 zookeeper3.4 )
目錄 七、總結 上篇文章寫了如何用ssh免密登入,當然這些操作都是在hadoop賬號上的操作,包括這篇文章也是一樣 三臺主機 一、伺服器環境 主機名 IP 使用者名稱 密碼 安裝目錄 node1 192.168.31.
MySQL-Cluster三機叢集+HA高可用+負載均衡配置手冊
本文中的配置已經在實驗室進行過效能測試、可靠性測試驗證。 一、介紹 這篇文件旨在介紹如何安裝配置基於3臺伺服器的MySQL叢集。並且實現任意一臺伺服器出現問題或宕機時MySQL叢集依然能夠繼續執行。 1. MySQL-Cluster簡介 MySQL-Cluster主要有三種
postgresql使用RHCS套件搭建HA高可用叢集
環境: 資料庫伺服器 2臺 伺服器一 作業系統:CentOS 6.8 x86_64 IP(eth0):192.168.11.61 主機名:node1 伺服器二 作業系統:CentOS 6.8 x86_64 IP_1(eth0):192.168.11.62 主機名:node2
CentOS7+Hadoop2.7.2(HA高可用+Federation聯邦)+Hive1.2.1+Spark2.1.0 完全分散式叢集安裝
本文件主要記錄了Hadoop+Hive+Spark叢集安裝過程,並且對NameNode與ResourceManager進行了HA高可用配置,以及對NameNode的橫向擴充套件(Federation聯邦) 1VM網路配置 將子網IP設定為192.168.1.0: 將閘道器設定
超詳細Hadoop HA高可用叢集搭建及常見問題處理
最近研究了下公司的hadoop叢集並模仿搭建了一個在本地測試使用的hadoop叢集。本文介紹下詳細的搭建過程以及各種常見問題的處理解決。 1 , 前期準備 1.0 , 準備Linux環境。 安裝vmware linux虛擬機
Hadoop系列-HDFS HA高可用叢集
前言: 在HDFS叢集的時候我們知道,NameNode只有一個,如果現在NameNode掛掉了,或者NameNode需要硬體或者軟體的升級,那麼勢必就有單點問題。那麼HDFS HA就是來解決這個問題
hadoop 叢集HA高可用搭建以及問題解決方案
hadoop 叢集HA高可用搭建 目錄大綱 1. hadoop HA原理 2. hadoop HA特點 3. Zookeeper 配置 4. 安裝Hadoop叢集 5. Hadoop HA配置 搭建環境 環境 版本 地址地址
搭建Hadoop叢集的HA高可用架構(超詳細步驟+已驗證)
一、叢集的規劃 Zookeeper叢集: 192.168.182.12 (bigdata12) 192.168.182.13 (bigdata13) 192.168.182.14 (bigdata14) Hadoop叢集: 192.168.
Spring Cloud 進階之路 -- Eureka的高可用,搭建 Eureka叢集(開發環境和生產環境)
Eureka 作為註冊中心,必須保障高可用,否則會直接影響有關的整個服務體系。 以下分別進行開發環境和生產環境的多服務中心叢集配置。 目錄 一、開發環境簡易配置: 1、配置Configurations 在上一