单机下载

版本信息请参考https://github.com/etcd-io/etcd/releases

本次以最新版本3.4.1为例https://github.com/etcd-io/etcd/releases/download/v3.4.1/etcd-v3.4.1-linux-amd64.tar.gz

主机名为sht-sgmhadoopnn-01,IP地址172.16.101.55

# cd /usr/local/
# wget https://github.com/etcd-io/etcd/releases/download/v3.4.1/etcd-v3.4.1-linux-amd64.tar.gz
# tar -zxf etcd-v3.4.1-linux-amd64.tar.gz .
# ln -s etcd-v3.4.1-linux-amd64 etcd
# grep "PATH" ~/.bash_profile
PATH=/usr/local/etcd:$PATH:$HOME/bin
# ls -lh /usr/local/etcd/
total 40M
drwxr-xr-x wheel .0K Sep : Documentation
-rwxr-xr-x wheel 23M Sep : etcd
-rwxr-xr-x wheel 17M Sep : etcdctl
-rw-r--r-- wheel 43K Sep : README-etcdctl.md
-rw-r--r-- wheel .3K Sep : README.md
-rw-r--r-- wheel .7K Sep : READMEv2-etcdctl.md

启动etcd,以命令行和参数启动

etcd \
--name 'sht-sgmhadoopnn-01' \
--data-dir '/usr/local/etcd/data' \
--listen-client-urls 'http://0.0.0.0:2379' \
--advertise-client-urls 'http://0.0.0.0:2379',http://127.0.0.1:2379 \
--listen-peer-urls 'http://0.0.0.0:2380' \
--initial-advertise-peer-urls 'http://0.0.0.0:2380,http://127.0.0.1:2380'
--enable-v2=true"

输出log

# etcd --logger=zap --name 'sht-sgmhadoopnn-01' --data-dir '/usr/local/etcd/data' --listen-client-urls 'http://0.0.0.0:2379' --advertise-client-urls 'http://0.0.0.0:2379' --listen-peer-urls 'http://0.0.0.0:2380' --initial-advertise-peer-urls 'http://0.0.0.0:2380'
{"level":"info","ts":"2019-09-28T16:38:59.917+0800","caller":"embed/etcd.go:117","msg":"configuring peer listeners","listen-peer-urls":["http://0.0.0.0:2380"]}
{"level":"info","ts":"2019-09-28T16:38:59.918+0800","caller":"embed/etcd.go:127","msg":"configuring client listeners","listen-client-urls":["http://0.0.0.0:2379"]}
{"level":"info","ts":"2019-09-28T16:38:59.918+0800","caller":"embed/etcd.go:299","msg":"starting an etcd server","etcd-version":"3.4.1","git-sha":"a14579fbf","go-version":"go1.12.9","go-os":"linux","go-arch":"amd64","max-cpu-set":2,"max-cpu-available":2,"member-initialized":false,"name":"sht-sgmhadoopnn-01","data-dir":"/usr/local/etcd/data","wal-dir":"","wal-dir-dedicated":"","member-dir":"/usr/local/etcd/data/member","force-new-cluster":false,"heartbeat-interval":"100ms","election-timeout":"1s","initial-election-tick-advance":true,"snapshot-count":100000,"snapshot-catchup-entries":5000,"initial-advertise-peer-urls":["http://0.0.0.0:2380"],"listen-peer-urls":["http://0.0.0.0:2380"],"advertise-client-urls":["http://0.0.0.0:2379"],"listen-client-urls":["http://0.0.0.0:2379"],"listen-metrics-urls":[],"cors":["*"],"host-whitelist":["*"],"initial-cluster":"sht-sgmhadoopnn-01=http://0.0.0.0:2380","initial-cluster-state":"new","initial-cluster-token":"etcd-cluster","quota-size-bytes":2147483648,"pre-vote":false,"initial-corrupt-check":false,"corrupt-check-time-interval":"0s","auto-compaction-mode":"periodic","auto-compaction-retention":"0s","auto-compaction-interval":"0s","discovery-url":"","discovery-proxy":""}
{"level":"info","ts":"2019-09-28T16:38:59.943+0800","caller":"etcdserver/backend.go:79","msg":"opened backend db","path":"/usr/local/etcd/data/member/snap/db","took":"24.695882ms"}
{"level":"info","ts":"2019-09-28T16:38:59.963+0800","caller":"etcdserver/raft.go:456","msg":"starting local member","local-member-id":"1c70f9bbb41018f","cluster-id":"a0d2de0531db7884"}
{"level":"info","ts":"2019-09-28T16:38:59.964+0800","caller":"raft/raft.go:1530","msg":"1c70f9bbb41018f switched to configuration voters=()"}
{"level":"info","ts":"2019-09-28T16:38:59.964+0800","caller":"raft/raft.go:700","msg":"1c70f9bbb41018f became follower at term 0"}
{"level":"info","ts":"2019-09-28T16:38:59.964+0800","caller":"raft/raft.go:383","msg":"newRaft 1c70f9bbb41018f [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]"}
{"level":"info","ts":"2019-09-28T16:38:59.964+0800","caller":"raft/raft.go:700","msg":"1c70f9bbb41018f became follower at term 1"}
{"level":"info","ts":"2019-09-28T16:38:59.964+0800","caller":"raft/raft.go:1530","msg":"1c70f9bbb41018f switched to configuration voters=(128088275939295631)"}
{"level":"warn","ts":"2019-09-28T16:38:59.988+0800","caller":"auth/store.go:1317","msg":"simple token is not cryptographically signed"}
{"level":"info","ts":"2019-09-28T16:38:59.998+0800","caller":"etcdserver/quota.go:98","msg":"enabled backend quota with default value","quota-name":"v3-applier","quota-size-bytes":2147483648,"quota-size":"2.1 GB"}
{"level":"info","ts":"2019-09-28T16:39:00.006+0800","caller":"etcdserver/server.go:791","msg":"starting etcd server","local-member-id":"1c70f9bbb41018f","local-server-version":"3.4.1","cluster-version":"to_be_decided"}
{"level":"info","ts":"2019-09-28T16:39:00.008+0800","caller":"etcdserver/server.go:657","msg":"started as single-node; fast-forwarding election ticks","local-member-id":"1c70f9bbb41018f","forward-ticks":9,"forward-duration":"900ms","election-ticks":10,"election-timeout":"1s"}
{"level":"info","ts":"2019-09-28T16:39:00.009+0800","caller":"raft/raft.go:1530","msg":"1c70f9bbb41018f switched to configuration voters=(128088275939295631)"}
{"level":"info","ts":"2019-09-28T16:39:00.009+0800","caller":"membership/cluster.go:392","msg":"added member","cluster-id":"a0d2de0531db7884","local-member-id":"1c70f9bbb41018f","added-peer-id":"1c70f9bbb41018f","added-peer-peer-urls":["http://0.0.0.0:2380"]}
{"level":"info","ts":"2019-09-28T16:39:00.012+0800","caller":"embed/etcd.go:241","msg":"now serving peer/client/metrics","local-member-id":"1c70f9bbb41018f","initial-advertise-peer-urls":["http://0.0.0.0:2380"],"listen-peer-urls":["http://0.0.0.0:2380"],"advertise-client-urls":["http://0.0.0.0:2379"],"listen-client-urls":["http://0.0.0.0:2379"],"listen-metrics-urls":[]}
{"level":"info","ts":"2019-09-28T16:39:00.013+0800","caller":"embed/etcd.go:576","msg":"serving peer traffic","address":"[::]:2380"}
{"level":"info","ts":"2019-09-28T16:39:00.065+0800","caller":"raft/raft.go:923","msg":"1c70f9bbb41018f is starting a new election at term 1"}
{"level":"info","ts":"2019-09-28T16:39:00.065+0800","caller":"raft/raft.go:713","msg":"1c70f9bbb41018f became candidate at term 2"}
{"level":"info","ts":"2019-09-28T16:39:00.065+0800","caller":"raft/raft.go:824","msg":"1c70f9bbb41018f received MsgVoteResp from 1c70f9bbb41018f at term 2"}
{"level":"info","ts":"2019-09-28T16:39:00.065+0800","caller":"raft/raft.go:765","msg":"1c70f9bbb41018f became leader at term 2"}
{"level":"info","ts":"2019-09-28T16:39:00.065+0800","caller":"raft/node.go:325","msg":"raft.node: 1c70f9bbb41018f elected leader 1c70f9bbb41018f at term 2"}
{"level":"info","ts":"2019-09-28T16:39:00.069+0800","caller":"etcdserver/server.go:2015","msg":"published local member to cluster through raft","local-member-id":"1c70f9bbb41018f","local-member-attributes":"{Name:sht-sgmhadoopnn-01 ClientURLs:[http://0.0.0.0:2379]}","request-path":"/0/members/1c70f9bbb41018f/attributes","cluster-id":"a0d2de0531db7884","publish-timeout":"7s"}
{"level":"info","ts":"2019-09-28T16:39:00.070+0800","caller":"etcdserver/server.go:2500","msg":"setting up initial cluster version","cluster-version":"3.4"}
{"level":"info","ts":"2019-09-28T16:39:00.071+0800","caller":"embed/serve.go:139","msg":"serving client traffic insecurely; this is strongly discouraged!","address":"[::]:2379"}
{"level":"info","ts":"2019-09-28T16:39:00.076+0800","caller":"membership/cluster.go:558","msg":"set initial cluster version","cluster-id":"a0d2de0531db7884","local-member-id":"1c70f9bbb41018f","cluster-version":"3.4"}
{"level":"info","ts":"2019-09-28T16:39:00.076+0800","caller":"api/capability.go:76","msg":"enabled capabilities for version","cluster-version":"3.4"}
{"level":"info","ts":"2019-09-28T16:39:00.076+0800","caller":"etcdserver/server.go:2532","msg":"cluster version is updated","cluster-version":"3.4"}

查看节点状态

# etcdctl endpoint status --write-out=table
+----------------+-----------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+----------------+-----------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| 127.0.0.1: | 1c70f9bbb41018f | 3.4. | kB | true | false | | | | |
+----------------+-----------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
# etcdctl endpoint health --write-out=table
+----------------+--------+------------+-------+
| ENDPOINT | HEALTH | TOOK | ERROR |
+----------------+--------+------------+-------+
| 127.0.0.1: | true | .109338ms | |
+----------------+--------+------------+-------+
# etcdctl member list --write-out=table
+-----------------+---------+--------------------+---------------------+---------------------+------------+
| ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS | IS LEARNER |
+-----------------+---------+--------------------+---------------------+---------------------+------------+
| 1c70f9bbb41018f | started | sht-sgmhadoopnn- | http://0.0.0.0:2380 | http://0.0.0.0:2379 | false |
+-----------------+---------+--------------------+---------------------+---------------------+------------+

以服务模式启动

# cat /usr/lib/systemd/system/etcd.service
[Unit]
Description=etcd service
Documentation=https://github.com/etcd-io/etcd
After=network.target
After=network-online.target
Wants=network-online.target [Service]
User=tnuser
Type=notify
WorkingDirectory=/usr/local/etcd
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/local/etcd/etcd \
--data-dir=/usr/local/etcd/data \
--name sht-sgmhadoopnn- \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://0.0.0.0:2379 \
--initial-advertise-peer-urls http://0.0.0.0:2380 \
--listen-peer-urls http://0.0.0.0:2380 \
--enable-v2=true"
Restart=always
RestartSec=10s
LimitNOFILE= [Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl start etcd
# systemctl status etcd
● etcd.service - etcd service
Loaded: loaded (/usr/lib/systemd/system/etcd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat -- :: CST; 2min 51s ago
Docs: https://github.com/etcd-io/etcd
Main PID: (etcd)
Tasks:
Memory: 3.3M
CGroup: /system.slice/etcd.service
└─ /usr/local/etcd/etcd --data-dir=/usr/local/etcd/data --name sht-sgmhadoopnn- --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --initial-advertise-peer-urls http://0.0.0.0:2380 --listen-peer-urls... Sep :: sht-sgmhadoopnn- etcd[]: listening for peers on [::]:
Sep :: sht-sgmhadoopnn- bash[]: raft2019// :: INFO: 1c70f9bbb41018f is starting a new election at term
Sep :: sht-sgmhadoopnn- bash[]: raft2019// :: INFO: 1c70f9bbb41018f became candidate at term
Sep :: sht-sgmhadoopnn- bash[]: raft2019// :: INFO: 1c70f9bbb41018f received MsgVoteResp from 1c70f9bbb41018f at term
Sep :: sht-sgmhadoopnn- bash[]: raft2019// :: INFO: 1c70f9bbb41018f became leader at term
Sep :: sht-sgmhadoopnn- bash[]: raft2019// :: INFO: raft.node: 1c70f9bbb41018f elected leader 1c70f9bbb41018f at term
Sep :: sht-sgmhadoopnn- etcd[]: published {Name:sht-sgmhadoopnn- ClientURLs:[http://0.0.0.0:2379]} to cluster a0d2de0531db7884
Sep :: sht-sgmhadoopnn- etcd[]: ready to serve client requests
Sep :: sht-sgmhadoopnn- etcd[]: serving insecure client requests on [::]:, this is strongly discouraged!
Sep :: sht-sgmhadoopnn- systemd[]: Started etcd service.

以服务模式启动

# cat /usr/lib/systemd/system/etcd.service
[Unit]
Description=etcd service
Documentation=https://github.com/etcd-io/etcd
After=network.target
After=network-online.target
Wants=network-online.target [Service]
User=tnuser
Type=notify
EnvironmentFile=/usr/local/etcd/etcd.conf
WorkingDirectory=/usr/local/etcd
ExecStart=/usr/local/etcd/etcd
Restart=always
RestartSec=10s
LimitNOFILE= [Install]
WantedBy=multi-user.target
# cat /usr/local/etcd/etcd.conf
ETCD_NAME="sht-sgmhadoopnn-01"
ETCD_DATA_DIR="/usr/local/etcd/data"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379,http://127.0.0.1:2379"
ETCD_LISTEN_PEER_URLS="http://0.0.0.0:2380"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://0.0.0.0:2380,http://127.0.0.1:2380"
ETCD_ENABLE_V2="true"

etcd数据单机部署的更多相关文章

  1. Clickhouse单机部署以及从mysql增量同步数据

    背景: 随着数据量的上升,OLAP一直是被讨论的话题,虽然druid,kylin能够解决OLAP问题,但是druid,kylin也是需要和hadoop全家桶一起用的,异常的笨重,再说我也搞不定,那只能 ...

  2. Kubernetes后台数据库etcd:安装部署etcd集群,数据备份与恢复

    目录 一.系统环境 二.前言 三.etcd数据库 3.1 概述 四.安装部署etcd单节点 4.1 环境介绍 4.2 配置节点的基本环境 4.3 安装部署etcd单节点 4.4 使用客户端访问etcd ...

  3. Hadoop系列之(一):Hadoop单机部署

    1. Hadoop介绍 Hadoop是一个能够对海量数据进行分布式处理的系统架构. Hadoop框架的核心是:HDFS和MapReduce. HDFS分布式文件系统为海量的数据提供了存储, MapRe ...

  4. 使用二进制安装包的方式单机部署MySQL8.0.13

    使用二进制安装包的方式单机部署MySQL8.0.13 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 关于MySQL的介绍我这里就不多做赘述了,如何下载MySQL详情请参考:MySQ ...

  5. 003.etcd集群部署-静态发现

    一 etcd集群概述 1.1 概述 静态启动etcd集群要求每个成员都知道集群中的另一个成员.Etcd运行在集群的每个coreos节点上,可以保证coreos集群的稳定,可靠的运行.当集群网络出现动荡 ...

  6. Hadoop生态圈-CentOs7.5单机部署ClickHouse

    Hadoop生态圈-CentOs7.5单机部署ClickHouse 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 到了新的公司,认识了新的同事,生产环境也得你去适应新的集群环境,我 ...

  7. Kafka记录-Kafka简介与单机部署测试

    1.Kafka简介 kafka-分布式发布-订阅消息系统,开发语言-Scala,协议-仿AMQP,不支持事务,支持集群,支持负载均衡,支持zk动态扩容 2.Kafka的架构组件 1.话题(Topic) ...

  8. Win10 下 hadoop3.0.0 单机部署

    前言 因近期要做 hadoop 有关的项目,需配置 hadoop 环境,简单起见就准备进行单机部署,方便开发调试.顺便记录下采坑步骤,方便碰到同样问题的朋友们. 安装步骤 一.下载 hadoop-XX ...

  9. etcd集群部署与遇到的坑(转)

    原文 https://www.cnblogs.com/breg/p/5728237.html etcd集群部署与遇到的坑 在k8s集群中使用了etcd作为数据中心,在实际操作中遇到了一些坑.今天记录一 ...

随机推荐

  1. 什么是iframe及作用是什么?

    一. iframe是什么及作用 iframe是嵌入式框架, 是html标签, 还是一个内联元素, iframe 元素会创建包含另外一个文档的内联框架(即行内框架) . 说白了, iframe用来在页面 ...

  2. Codeforces #499 E Border ( 裴蜀定理 )

    题目链接 题意 : 给出 N 种纸币.并且给出面值.每种纸币的数量可以任选.问你得出来的数在 k 进制下.末尾位的数有多少种可能.输出具体方案 分析 : 纸币任意选择组成的和 可以用一个一次多项式来表 ...

  3. 【HDOJ5943】Kingdom of Obsession(数论)

    题意:给定n个人,n个座位,人的编号是[1,n],座位的编号是[s+1,s+n],编号为i的人能坐在编号为j的座位上的条件是j%i=0 问是否存在一组方案使得座位和人一一对应 n,s<=1e9 ...

  4. Android 属性动画监听事件与一个菜单的例子

    简单监听事件 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 3 ...

  5. [BZOJ2286][Sdoi2011]消耗战(虚树上DP)

    2286: [Sdoi2011]消耗战 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 6457  Solved: 2533[Submit][Statu ...

  6. 使用oracle删除表中重复记录

    (1)使用用rowid方法 查询重复数据:select * from person a where rowid !=(select max(rowid) from person b where a.c ...

  7. LeetCode 74. 搜索二维矩阵(Search a 2D Matrix)

    题目描述 编写一个高效的算法来判断 m x n 矩阵中,是否存在一个目标值.该矩阵具有如下特性: 每行中的整数从左到右按升序排列. 每行的第一个整数大于前一行的最后一个整数. 示例 1: 输入: ma ...

  8. legend3---lavarel常用操作代码

    legend3---lavarel常用操作代码 一.总结 一句话总结: 要自己总结一下常用代码,这样才方便,也才有收获 1.路由示例:Route::get('/login','Home\Login\L ...

  9. io.h配置 ubuntu

    https://www.cnblogs.com/liuyangak/articles/3239238.html https://blog.csdn.net/jiao_mrswang/article/d ...

  10. UVa679 小球下落(树)

    UVa679 小球下落(树) 题目大意 小球从一棵所有叶子深度相同的二叉树的顶点开始向下落,树开始所有节点都为0.若小球落到节点为0的则往左落,否则向右落.并且小球会改变它经过的节点,0变1,1变0. ...