安装部署
MacOS安装RabbitMQ
API网关部署
Centos安装Chrome浏览器
gitlab
gitlab-cicd
gitlab-runner安装配置
Gitlab-CICD实践篇
gitlab维护
gitlab备份-异地恢复-升级
gitlab从13.10.2升级至14.4.1出现的问题
Let's Encrypt
Let's Encrypt 申请证书
certbot发起web认证请求流程
安装CMDBUILD
vim配置
keepalived
配置样例
wine tips
supervisord
kafka
zookeeper
minio
django
jupyter
supervisor管理的kafka zookeeper集群部署
dnsmasq
apisix
APISIX结合skywalking对各个服务的访问情况进行监控
APISIX通过consul动态发现服务
Grafana Labs
Loki(stack)
etcd
redis
mongodb
mongodb添加仲裁节点
consul
sqlite更新升級
openssl安裝升級
emby
inotify-tools
caddy
caddy规则
ohmyzsh tips
debian-nvidia-container-runtime
openwrt+802.1x+freeradius+casdoor
本文档使用 MrDoc 发布
-
+
首页
etcd
# 安装[etcd](https://github.com/etcd-io/etcd/releases/ 'Github etcd Release') ## 说明 - version选项会打印默认的安装版本,填写版本为参数时从网络安装指定版本 - source选项会可以选择从google还是github源下载安装文件 ## 使用方法 ```shell Install etcd Usage: install.sh [OPTIONS] [OPTARGS] Options: -h get help message --version=[version] print default install version or install specific version --source=[google|github] choose install source. default: google ``` ## 脚本内容 ``` #!/usr/bin/env bash ETCD_VER=v3.5.1 INSTALL_DIR=/usr/local/etcd _ME=${0##*/} # init jobs if [[ ! -d $INSTALL_DIR ]] ; then mkdir -p $INSTALL_DIR/data fi if [[ -d $INSTALL_DIR/Documentation ]] ; then rm -rf $INSTALL_DIR/Documentation fi _install_from_internet() { # choose either URL GOOGLE_URL=https://storage.googleapis.com/etcd GITHUB_URL=https://github.com/etcd-io/etcd/releases/download if [[ $INSTALL_SOURCE == 'github' ]] ; then DOWNLOAD_URL=${GITHUB_URL} else DOWNLOAD_URL=${GOOGLE_URL} fi rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz rm -rf $INSTALL_DIR && mkdir -p $INSTALL_DIR curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C $INSTALL_DIR --strip-components=1 rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz ln -fs $INSTALL_DIR/etcd /usr/bin/ ln -fs $INSTALL_DIR/etcdctl /usr/bin/ ln -fs $INSTALL_DIR/etcdutl /usr/bin/ _start_etcd } _install_from_file() { \cp -rPf files/$ETCD_VER/* $INSTALL_DIR/ ln -fs $INSTALL_DIR/etcd /usr/bin/ ln -fs $INSTALL_DIR/etcdctl /usr/bin/ ln -fs $INSTALL_DIR/etcdutl /usr/bin/ _start_etcd } _start_etcd() { cat > /etc/systemd/system/etcd.service <<EOF [Unit] Description=etcd After=network.target remote-fs.target [Service] Type=notify User=root LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity TasksMax=infinity Restart=on-failure RestartSec=5s PIDFile=/var/run/etcd.pid ExecStart=/usr/bin/etcd \\ --name s1 \\ --data-dir $INSTALL_DIR/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 \\ --initial-cluster s1=http://0.0.0.0:2380 \\ --initial-cluster-token tkn \\ --initial-cluster-state new ExecReload=/bin/kill -s HUP \$MAINPID ExecStop=/bin/kill -s QUIT \$MAINPID [Install] WantedBy=multi-user.target EOF systemctl daemon-reload && systemctl enable etcd systemctl restart etcd } _install_method() { if [[ -d files/$ETCD_VER ]]; then echo "install from file" _install_from_file else echo "install from internet" _install_from_internet fi } _usage() { cat <<EOF Install etcd Usage: $_ME [OPTIONS] [OPTARGS] Options: -h get help message --version=[version] print default install version or install specific version --source=[google|github] choose install source. default: google EOF } _main() { ARGS=`getopt -o h -l version::,source::,help -n "$0" -- "$@"` if [ $? != 0 ]; then echo -ne "Wrong values!" _usage exit 1 fi eval set -- "${ARGS}" while true do case "$1" in -v|--version) ETCD_VER=${2:-v3.5.1} echo "Version: $ETCD_VER" if [[ $ETCD_VER == 'v3.5.1' ]] ; then exit 0 else shift fi ;; -s|--source) INSTALL_SOURCE=${2:-google} shift 2 ;; -h|--help) _usage exit 0 ;; --) shift break ;; *) break ;; esac done _install_method } _main $@ ```
zhangky
2022年1月18日 15:13
分享文档
收藏文档
上一篇
下一篇
微信扫一扫
复制链接
手机扫一扫进行分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码