etcd数据单机部署
单机下载
版本信息请参考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数据单机部署的更多相关文章
- Clickhouse单机部署以及从mysql增量同步数据
背景: 随着数据量的上升,OLAP一直是被讨论的话题,虽然druid,kylin能够解决OLAP问题,但是druid,kylin也是需要和hadoop全家桶一起用的,异常的笨重,再说我也搞不定,那只能 ...
- Kubernetes后台数据库etcd:安装部署etcd集群,数据备份与恢复
目录 一.系统环境 二.前言 三.etcd数据库 3.1 概述 四.安装部署etcd单节点 4.1 环境介绍 4.2 配置节点的基本环境 4.3 安装部署etcd单节点 4.4 使用客户端访问etcd ...
- Hadoop系列之(一):Hadoop单机部署
1. Hadoop介绍 Hadoop是一个能够对海量数据进行分布式处理的系统架构. Hadoop框架的核心是:HDFS和MapReduce. HDFS分布式文件系统为海量的数据提供了存储, MapRe ...
- 使用二进制安装包的方式单机部署MySQL8.0.13
使用二进制安装包的方式单机部署MySQL8.0.13 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 关于MySQL的介绍我这里就不多做赘述了,如何下载MySQL详情请参考:MySQ ...
- 003.etcd集群部署-静态发现
一 etcd集群概述 1.1 概述 静态启动etcd集群要求每个成员都知道集群中的另一个成员.Etcd运行在集群的每个coreos节点上,可以保证coreos集群的稳定,可靠的运行.当集群网络出现动荡 ...
- Hadoop生态圈-CentOs7.5单机部署ClickHouse
Hadoop生态圈-CentOs7.5单机部署ClickHouse 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 到了新的公司,认识了新的同事,生产环境也得你去适应新的集群环境,我 ...
- Kafka记录-Kafka简介与单机部署测试
1.Kafka简介 kafka-分布式发布-订阅消息系统,开发语言-Scala,协议-仿AMQP,不支持事务,支持集群,支持负载均衡,支持zk动态扩容 2.Kafka的架构组件 1.话题(Topic) ...
- Win10 下 hadoop3.0.0 单机部署
前言 因近期要做 hadoop 有关的项目,需配置 hadoop 环境,简单起见就准备进行单机部署,方便开发调试.顺便记录下采坑步骤,方便碰到同样问题的朋友们. 安装步骤 一.下载 hadoop-XX ...
- etcd集群部署与遇到的坑(转)
原文 https://www.cnblogs.com/breg/p/5728237.html etcd集群部署与遇到的坑 在k8s集群中使用了etcd作为数据中心,在实际操作中遇到了一些坑.今天记录一 ...
随机推荐
- Unknown or unsupported command 'install'
由于电脑中存在多个python,导致pip install numpy出现标题这样的错误 结局方案; 在想要的python文件夹中的Scripts,shift右键点开命令行,pip.exe insta ...
- CMD命令行基本命令
基本知识 输入 功能 Alt+Enter 全屏 Ctrl+S 暂停输出 Ctrl+C Ctrl+Break 停止程序 Ctrl+Z 表示输入结束 <file 从文件读标准输入 >file ...
- List集合的方法总结
1. 添加方法 boolean add(E e): 向集合的末尾添加指定的元素 boolean addAll(Collection<? extends E> c): 向集合的末尾添加一个指 ...
- Java基础-自增自减运算符练习题
我们用一个简单的例子分析下边的运行结果: package demo; public class ZiZeng { int i = 0; test(i); // i = i++; i = ++i; Sy ...
- [AGC034D]Manhattan Max Matching:费用流
前置姿势 \(k\)维空间内两点曼哈顿距离中绝对值的处理 戳这里:[CF1093G]Multidimensional Queries 多路增广的费用流 据说这个东西叫做ZKW费用流? 流程其实很简单, ...
- [BZOJ5249][九省联考2018]IIIDX:线段树+贪心
分析 GXZlegend orz 构造出一组合法的解并不是难事,但是我们需要输出的是字典序最大的解. 字典序最大有另一种理解方式,就是让越小的数尽量越靠后. 我们从树的根结点出发,从1开始填数,构造出 ...
- JavaWeb_使用dom4j解析、生成XML文件
dom4j 官网 xml解析DOM文档对象模型(树形结构) DOM方式解析:把xml文档加载到内存形成树形结构,可以进行增删改的操作 Learn 使用dom4j解析文件"NewFile. ...
- Android学习_7/24
一. 活动的生命周期 1. 活动状态 运行:位于返回栈栈顶 暂停:不在栈顶,但仍可见 停止:不在栈顶,完全不可见 销毁:从栈中移除 2. 活动的生存期 ...
- Spring boot之MyBatis
文章目录1. 环境依赖2. 数据源2.1. 方案一 使用 Spring Boot 默认配置2.2. 方案二 手动创建3. 脚本初始化4. MyBatis整合4.1. 方案一 通过注解的方式4.1.1. ...
- 基于ElementUI,设置流体高度时,固定列与底部有间隙
基于ElementUI,设置流体高度时,固定列与底部有间隙问题,如下图: 解决办法: 1.fixed流体的高度设置为100% 2.将fixed的滚动内容的最大高度设置为none,bottom为 ...