Created
October 19, 2020 07:45
-
-
Save crazytaxii/8bed02c38b874db9aa777d1d9191c830 to your computer and use it in GitHub Desktop.
Install single etcd on CentOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ sh -c "$(curl -fssL https://gist.githubusercontent.com/crazytaxii/8bed02c38b874db9aa777d1d9191c830/raw/2736a74a3cf29800cc234b6f8ab24645da8462b2/etcd-deploy.sh)"