Skip to content

Instantly share code, notes, and snippets.

@crazytaxii
Created October 19, 2020 07:45
Show Gist options
  • Save crazytaxii/8bed02c38b874db9aa777d1d9191c830 to your computer and use it in GitHub Desktop.
Save crazytaxii/8bed02c38b874db9aa777d1d9191c830 to your computer and use it in GitHub Desktop.
Install single etcd on CentOS
#!/bin/bash
ETCD_VER=v3.4.13
DOWNLOAD_URL=https://github.com/etcd-io/etcd/releases/download
DATA_DIR=/var/lib/etcd
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xvzf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /usr/local/bin --strip-components=1
rm -rf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
systemctl is-active --quiet etcd && systemctl stop etcd
rm -rf ${DATA_DIR}
mkdir -p ${DATA_DIR}
cat > /usr/lib/systemd/system/etcd.service << EOF
[Unit]
Description=etcd key-value store
Documentation=https://github.com/etcd-io/etcd
After=network.target
[Service]
Type=notify
Environment=ETCD_DATA_DIR=${DATA_DIR}
Environment=ETCD_NAME=%m
ExecStart=/usr/local/bin/etcd
Restart=always
RestartSec=10s
LimitNOFILE=40000
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start etcd.service
@crazytaxii
Copy link
Author

$ sh -c "$(curl -fssL https://gist.githubusercontent.com/crazytaxii/8bed02c38b874db9aa777d1d9191c830/raw/2736a74a3cf29800cc234b6f8ab24645da8462b2/etcd-deploy.sh)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment