commit
291f4ec888
56
bz1350875-disaster-recovery-with-copies.patch
Normal file
56
bz1350875-disaster-recovery-with-copies.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From 7ad700a716c2122c3b6db6677a6f717919b88926 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Chaloupka <jchaloup@redhat.com>
|
||||
Date: Tue, 2 May 2017 09:56:02 +0200
|
||||
Subject: [PATCH] bz1350875-disaster-recovery-with-copies:
|
||||
|
||||
---
|
||||
etcdctl/ctlv2/command/backup_command.go | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/etcdctl/ctlv2/command/backup_command.go b/etcdctl/ctlv2/command/backup_command.go
|
||||
index feda4b1..e77791f 100644
|
||||
--- a/etcdctl/ctlv2/command/backup_command.go
|
||||
+++ b/etcdctl/ctlv2/command/backup_command.go
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"path/filepath"
|
||||
+ "strconv"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/etcdserver/etcdserverpb"
|
||||
@@ -40,6 +41,9 @@ func NewBackupCommand() cli.Command {
|
||||
cli.StringFlag{Name: "wal-dir", Value: "", Usage: "Path to the etcd wal dir"},
|
||||
cli.StringFlag{Name: "backup-dir", Value: "", Usage: "Path to the backup dir"},
|
||||
cli.StringFlag{Name: "backup-wal-dir", Value: "", Usage: "Path to the backup wal dir"},
|
||||
+ cli.BoolFlag{Name: "keep-cluster-id", Usage: "Do not rewrite the cluster id"},
|
||||
+ cli.StringFlag{Name: "node-id", Value: "", Usage: "Use custom node id instead of a random value"},
|
||||
+
|
||||
},
|
||||
Action: handleBackup,
|
||||
}
|
||||
@@ -99,8 +103,19 @@ func handleBackup(c *cli.Context) error {
|
||||
var metadata etcdserverpb.Metadata
|
||||
pbutil.MustUnmarshal(&metadata, wmetadata)
|
||||
idgen := idutil.NewGenerator(0, time.Now())
|
||||
- metadata.NodeID = idgen.Next()
|
||||
- metadata.ClusterID = idgen.Next()
|
||||
+ explicitNodeId := c.String("node-id")
|
||||
+ if explicitNodeId != "" {
|
||||
+ metadata.NodeID, err = strconv.ParseUint(explicitNodeId, 16, 64)
|
||||
+ if err != nil {
|
||||
+ log.Fatal(err)
|
||||
+ }
|
||||
+ } else {
|
||||
+ metadata.NodeID = idgen.Next()
|
||||
+ }
|
||||
+ keepClusterId := c.Bool("keep-cluster-id")
|
||||
+ if !keepClusterId {
|
||||
+ metadata.ClusterID = idgen.Next()
|
||||
+ }
|
||||
|
||||
neww, err := wal.Create(destWAL, pbutil.MustMarshal(&metadata))
|
||||
if err != nil {
|
||||
--
|
||||
2.7.4
|
||||
|
||||
BIN
etcd-3ac81f3.tar.gz
Normal file
BIN
etcd-3ac81f3.tar.gz
Normal file
Binary file not shown.
69
etcd.conf
Normal file
69
etcd.conf
Normal file
@ -0,0 +1,69 @@
|
||||
#[Member]
|
||||
#ETCD_CORS=""
|
||||
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
|
||||
#ETCD_WAL_DIR=""
|
||||
#ETCD_LISTEN_PEER_URLS="http://localhost:2380"
|
||||
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379"
|
||||
#ETCD_MAX_SNAPSHOTS="5"
|
||||
#ETCD_MAX_WALS="5"
|
||||
ETCD_NAME="default"
|
||||
#ETCD_SNAPSHOT_COUNT="100000"
|
||||
#ETCD_HEARTBEAT_INTERVAL="100"
|
||||
#ETCD_ELECTION_TIMEOUT="1000"
|
||||
#ETCD_QUOTA_BACKEND_BYTES="0"
|
||||
#ETCD_MAX_REQUEST_BYTES="1572864"
|
||||
#ETCD_GRPC_KEEPALIVE_MIN_TIME="5s"
|
||||
#ETCD_GRPC_KEEPALIVE_INTERVAL="2h0m0s"
|
||||
#ETCD_GRPC_KEEPALIVE_TIMEOUT="20s"
|
||||
#
|
||||
#[Clustering]
|
||||
#ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380"
|
||||
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
|
||||
#ETCD_DISCOVERY=""
|
||||
#ETCD_DISCOVERY_FALLBACK="proxy"
|
||||
#ETCD_DISCOVERY_PROXY=""
|
||||
#ETCD_DISCOVERY_SRV=""
|
||||
#ETCD_INITIAL_CLUSTER="default=http://localhost:2380"
|
||||
#ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
|
||||
#ETCD_INITIAL_CLUSTER_STATE="new"
|
||||
#ETCD_STRICT_RECONFIG_CHECK="true"
|
||||
#ETCD_ENABLE_V2="true"
|
||||
#
|
||||
#[Proxy]
|
||||
#ETCD_PROXY="off"
|
||||
#ETCD_PROXY_FAILURE_WAIT="5000"
|
||||
#ETCD_PROXY_REFRESH_INTERVAL="30000"
|
||||
#ETCD_PROXY_DIAL_TIMEOUT="1000"
|
||||
#ETCD_PROXY_WRITE_TIMEOUT="5000"
|
||||
#ETCD_PROXY_READ_TIMEOUT="0"
|
||||
#
|
||||
#[Security]
|
||||
#ETCD_CERT_FILE=""
|
||||
#ETCD_KEY_FILE=""
|
||||
#ETCD_CLIENT_CERT_AUTH="false"
|
||||
#ETCD_TRUSTED_CA_FILE=""
|
||||
#ETCD_AUTO_TLS="false"
|
||||
#ETCD_PEER_CERT_FILE=""
|
||||
#ETCD_PEER_KEY_FILE=""
|
||||
#ETCD_PEER_CLIENT_CERT_AUTH="false"
|
||||
#ETCD_PEER_TRUSTED_CA_FILE=""
|
||||
#ETCD_PEER_AUTO_TLS="false"
|
||||
#
|
||||
#[Logging]
|
||||
#ETCD_DEBUG="false"
|
||||
#ETCD_LOG_PACKAGE_LEVELS=""
|
||||
#ETCD_LOG_OUTPUT="default"
|
||||
#
|
||||
#[Unsafe]
|
||||
#ETCD_FORCE_NEW_CLUSTER="false"
|
||||
#
|
||||
#[Version]
|
||||
#ETCD_VERSION="false"
|
||||
#ETCD_AUTO_COMPACTION_RETENTION="0"
|
||||
#
|
||||
#[Profiling]
|
||||
#ETCD_ENABLE_PPROF="false"
|
||||
#ETCD_METRICS="basic"
|
||||
#
|
||||
#[Auth]
|
||||
#ETCD_AUTH_TOKEN="simple"
|
||||
18
etcd.service
Normal file
18
etcd.service
Normal file
@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Etcd Server
|
||||
After=network.target
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
WorkingDirectory=/var/lib/etcd/
|
||||
EnvironmentFile=-/etc/etcd/etcd.conf
|
||||
User=etcd
|
||||
# set GOMAXPROCS to number of processors
|
||||
ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"${ETCD_NAME}\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\""
|
||||
Restart=on-failure
|
||||
LimitNOFILE=65536
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
130
etcd.spec
Normal file
130
etcd.spec
Normal file
@ -0,0 +1,130 @@
|
||||
%global with_debug 1
|
||||
|
||||
%if 0%{?with_debug}
|
||||
%global _dwz_low_mem_die_limit 0
|
||||
%else
|
||||
%global debug_package %{nil}
|
||||
%endif
|
||||
|
||||
%if ! 0%{?gobuild:1}
|
||||
%define gobuild(o:) go build -buildmode pie -tags=rpm_crashtraceback -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro,-z,now'" -a -v -x %{?**};
|
||||
%endif
|
||||
|
||||
%global provider github
|
||||
%global provider_tld com
|
||||
%global project coreos
|
||||
%global repo etcd
|
||||
# https://github.com/coreos/etcd
|
||||
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
|
||||
%global import_path %{provider_prefix}
|
||||
%global commit 3ac81f3ae2264b21871128a170c78f8a9b2a3187
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
|
||||
%global system_name etcd
|
||||
%global man_version 3.2.21
|
||||
|
||||
Name: etcd
|
||||
Version: 3.2.21
|
||||
Release: 2%{?dist}
|
||||
Summary: A highly-available key value store for shared configuration
|
||||
License: ASL 2.0
|
||||
URL: https://%{provider_prefix}
|
||||
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
|
||||
Source1: %{system_name}.service
|
||||
Source2: %{system_name}.conf
|
||||
Source3: man-%{man_version}.tar.gz
|
||||
Patch3: bz1350875-disaster-recovery-with-copies.patch
|
||||
Patch4: expand-etcd-arch-validation.patch
|
||||
|
||||
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
|
||||
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:x86_64 aarch64 ppc64le s390x}
|
||||
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
||||
#BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
||||
BuildRequires: compiler(go-compiler)
|
||||
|
||||
Obsoletes: etcd3 < 3.0.15
|
||||
Provides: etcd3 = %{version}-%{release}
|
||||
|
||||
BuildRequires: libpcap-devel
|
||||
|
||||
BuildRequires: systemd
|
||||
|
||||
Requires(pre): shadow-utils
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
|
||||
%description
|
||||
A highly-available key value store for shared configuration.
|
||||
|
||||
%{?enable_gotoolset7}
|
||||
|
||||
%prep
|
||||
%setup -q -n man-%{man_version} -T -b 3
|
||||
%setup -q -n %{repo}-%{commit}
|
||||
mkdir -p man/man1
|
||||
cp ../man-%{man_version}/*.1 man/man1/.
|
||||
|
||||
# move content of vendor under Godeps as has been so far
|
||||
mkdir -p Godeps/_workspace/src
|
||||
mv cmd/vendor/* Godeps/_workspace/src/.
|
||||
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
mkdir -p src/github.com/coreos
|
||||
ln -s ../../../ src/github.com/coreos/etcd
|
||||
|
||||
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
|
||||
|
||||
export LDFLAGS="-X %{import_path}/version.GitSHA=%{shortcommit} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')"
|
||||
|
||||
%gobuild -o bin/%{system_name} %{import_path}
|
||||
%gobuild -o bin/%{system_name}ctl %{import_path}/%{system_name}ctl
|
||||
|
||||
%install
|
||||
install -D -p -m 0755 bin/%{system_name} %{buildroot}%{_bindir}/%{system_name}
|
||||
install -D -p -m 0755 bin/%{system_name}ctl %{buildroot}%{_bindir}/%{system_name}ctl
|
||||
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{system_name}.service
|
||||
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{system_name}
|
||||
install -m 644 -t %{buildroot}%{_sysconfdir}/%{system_name} %{SOURCE2}
|
||||
|
||||
# install manpages
|
||||
install -d %{buildroot}%{_mandir}/man1
|
||||
install -p -m 644 man/man1/* %{buildroot}%{_mandir}/man1
|
||||
|
||||
# And create /var/lib/etcd
|
||||
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{system_name}
|
||||
|
||||
%pre
|
||||
getent group %{system_name} >/dev/null || groupadd -r %{system_name}
|
||||
getent passwd %{system_name} >/dev/null || useradd -r -g %{system_name} -d %{_sharedstatedir}/%{system_name} \
|
||||
-s /sbin/nologin -c "etcd user" %{system_name}
|
||||
|
||||
%post
|
||||
%systemd_post %{system_name}.service
|
||||
|
||||
%preun
|
||||
%systemd_preun %{system_name}.service
|
||||
|
||||
%postun
|
||||
%systemd_postun %{system_name}.service
|
||||
|
||||
#define license tag if not already defined
|
||||
%{!?_licensedir:%global license %doc}
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc *.md
|
||||
%doc glide.lock
|
||||
%config(noreplace) %{_sysconfdir}/%{system_name}
|
||||
%{_bindir}/%{system_name}
|
||||
%{_bindir}/%{system_name}ctl
|
||||
%dir %attr(-,%{system_name},%{system_name}) %{_sharedstatedir}/%{system_name}
|
||||
%{_unitdir}/%{system_name}.service
|
||||
%{_mandir}/man1/*.1*
|
||||
|
||||
%changelog
|
||||
* Tue Aug 11 2020 jiangxinyu <jiangxinyu@kylinos.cn> - 3.2.21-2
|
||||
- Init etcd project
|
||||
30
expand-etcd-arch-validation.patch
Normal file
30
expand-etcd-arch-validation.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From b3e78645c1ffa84bcde511c90df4e3dde652c3fa Mon Sep 17 00:00:00 2001
|
||||
From: Jan Chaloupka <jchaloup@redhat.com>
|
||||
Date: Tue, 8 Aug 2017 15:01:04 +0200
|
||||
Subject: [PATCH] expand etcd arch validation
|
||||
|
||||
---
|
||||
etcdmain/etcd.go | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go
|
||||
index 2f7f00d..61553d4 100644
|
||||
--- a/etcdmain/etcd.go
|
||||
+++ b/etcdmain/etcd.go
|
||||
@@ -396,6 +396,13 @@ func checkSupportArch() {
|
||||
if runtime.GOARCH == "amd64" || runtime.GOARCH == "ppc64le" {
|
||||
return
|
||||
}
|
||||
+
|
||||
+ if runtime.GOARCH == "arm64" || runtime.GOARCH == "s390x" {
|
||||
+ plog.Warningf("Running etcd on %s architecture is experimental.", runtime.GOARCH)
|
||||
+ plog.Warningf("Please report any bugs you encounter: https://bugzilla.redhat.com/")
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
if env, ok := os.LookupEnv("ETCD_UNSUPPORTED_ARCH"); ok && env == runtime.GOARCH {
|
||||
plog.Warningf("running etcd on unsupported architecture %q since ETCD_UNSUPPORTED_ARCH is set", env)
|
||||
return
|
||||
--
|
||||
2.7.5
|
||||
|
||||
BIN
man-3.2.21.tar.gz
Normal file
BIN
man-3.2.21.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user