本文共 2397 字,大约阅读时间需要 7 分钟。
#!/bin/bash#回显执行的命令和参数set -x#cd到目录执行脚本,然后通过cd - 返回到当前目录cd ../../utils. ./sys_info.sh. ./sh-test-libcd -#根据不同的发行版安装repocase "${distro}" in centos|fedora) sudo wget -O /etc/yum.repos.d/estuary.repo https://raw.githubusercontent.com/open-estuary/distro-repo/master/estuaryftp.repo sudo chmod +r /etc/yum.repos.d/estuary.repo sudo rpm --import ftp://repoftp:repopushez7411@117.78.41.188/releases/ESTUARY-GPG-KEY yum clean dbcache print_info $? setup-estuary-repository #保存好repo之后安装etcd的安装包 pkgs="etcd" install_deps "${pkgs}" print_info $? install-bazel ;; *) error_msg "Unsupported distribution!"esac#启动etcd server 并在后台运行etcd &print_info $? start-single-etcd#执行etcdctl 命令etcdctl set hello worldprint_info $? create-key-valueetcdctl get hello | grep "world"print_info $? search-key-value#删除etcd 进程kill -9 $(pidof etcd)print_info $? stop-single-etcdecho $local_ip#重新执行etcd命令,设置位置参数etcd --name infra0 --initial-advertise-peer-urls http://$local_ip:2380 \ --listen-peer-urls http://$local_ip:2380 \ --listen-client-urls http://$local_ip:2379,http://127.0.0.1:2379 \ --advertise-client-urls http://$local_ip:2379 \ --initial-cluster-token etcd-cluster-1 \ --initial-cluster infra0=http://$local_ip:2380,infra1=http://$local_ip:2382,infra2=http://$local_ip:2384 \ --initial-cluster-state new &etcd --name infra1 --initial-advertise-peer-urls http://$local_ip:2382 \ --listen-peer-urls http://$local_ip:2382 \ --listen-client-urls http://$local_ip:2381,http://127.0.0.1:2381 \ --advertise-client-urls http://$local_ip:2381 \ --initial-cluster-token etcd-cluster-1 \ --initial-cluster infra0=http://$local_ip:2380,infra1=http://$local_ip:2382,infra2=http://$local_ip:2384 \ --initial-cluster-state new &etcd --name infra2 --initial-advertise-peer-urls http://$local_ip:2384 \ --listen-peer-urls http://$local_ip:2384 \ --listen-client-urls http://$local_ip:2383,http://127.0.0.1:2383\ --advertise-client-urls http://$local_ip:2383 \ --initial-cluster-token etcd-cluster-1 \ --initial-cluster infra0=http://$local_ip:2380,infra1=http://$local_ip:2382,infra2=http://$local_ip:2384 \ --initial-cluster-state new &print_info $? start-cluster-etcd#执行etcdctl命令etcdctl member listprint_info $? search-cluster-listetcdctl cluster-health | grep 'cluster is healthy'print_info $? check-cluster-health#删除etcd 进程kill -9 $(pidof etcd)print_info $? stop-cluster-etcd#删除包yum remove -y etcdprint_info $? remove-etcd
转载地址:http://lznmi.baihongyu.com/