diff --git a/.github/bootstrap.sh b/.github/bootstrap.sh index 603b4310d66..f02bffd1f1b 100755 --- a/.github/bootstrap.sh +++ b/.github/bootstrap.sh @@ -167,7 +167,9 @@ function install_etcd() { rm "$file" ln -snf "$dist/etcd-${version}-${platform}-${target}/etcd" "$VTROOT/bin/etcd" } -install_dep "etcd" "v3.3.10" "$VTROOT/dist/etcd" install_etcd + +# Install etcd if not detected +which etcd || install_dep "etcd" "v3.3.10" "$VTROOT/dist/etcd" install_etcd echo echo "bootstrap finished" diff --git a/bootstrap.sh b/bootstrap.sh index 8a16afcd3f0..d8bd3b3a8b9 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -236,7 +236,7 @@ function install_etcd() { rm "$file" ln -snf "$dist/etcd-${version}-${platform}-${target}/etcd" "$VTROOT/bin/etcd" } -install_dep "etcd" "v3.3.10" "$VTROOT/dist/etcd" install_etcd +which etcd || install_dep "etcd" "v3.3.10" "$VTROOT/dist/etcd" install_etcd # Download and install consul, link consul binary into our root. diff --git a/examples/local/env.sh b/examples/local/env.sh index ef9a0c8538a..9232c60b4ff 100644 --- a/examples/local/env.sh +++ b/examples/local/env.sh @@ -58,14 +58,7 @@ if [ "${TOPO}" = "zk2" ]; then else echo "enter etcd2 env" - case $(uname) in - Linux) etcd_platform=linux;; - Darwin) etcd_platform=darwin;; - esac - ETCD_SERVER="localhost:2379" - ETCD_VERSION=$(cat "${VTROOT}/dist/etcd/.installed_version") - ETCD_BINDIR="${VTROOT}/dist/etcd/etcd-${ETCD_VERSION}-${etcd_platform}-amd64/" TOPOLOGY_FLAGS="-topo_implementation etcd2 -topo_global_server_address $ETCD_SERVER -topo_global_root /vitess/global" mkdir -p "${VTDATAROOT}/tmp" diff --git a/examples/local/etcd-down.sh b/examples/local/etcd-down.sh index 9d05f649c44..cb2d5b1023f 100755 --- a/examples/local/etcd-down.sh +++ b/examples/local/etcd-down.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This is an example script that stops the ZooKeeper servers started by zk-up.sh. +# This is an example script that stops the etcd servers started by etcd-up.sh. set -e diff --git a/examples/local/etcd-up.sh b/examples/local/etcd-up.sh index 05d25ab0e28..51a1ef10cd2 100755 --- a/examples/local/etcd-up.sh +++ b/examples/local/etcd-up.sh @@ -20,22 +20,23 @@ set -e cell=${CELL:-'test'} script_root=$(dirname "${BASH_SOURCE[0]}") +export ETCDCTL_API=2 # shellcheck source=./env.sh # shellcheck disable=SC1091 source "${script_root}/env.sh" -${ETCD_BINDIR}/etcd --data-dir "${VTDATAROOT}/etcd/" --listen-client-urls "http://${ETCD_SERVER}" --advertise-client-urls "http://${ETCD_SERVER}" > "${VTDATAROOT}"/tmp/etcd.out 2>&1 & +etcd --data-dir "${VTDATAROOT}/etcd/" --listen-client-urls "http://${ETCD_SERVER}" --advertise-client-urls "http://${ETCD_SERVER}" > "${VTDATAROOT}"/tmp/etcd.out 2>&1 & PID=$! echo $PID > "${VTDATAROOT}/tmp/etcd.pid" sleep 5 echo "add /vitess/global" -${ETCD_BINDIR}/etcdctl --endpoints "http://${ETCD_SERVER}" mkdir /vitess/global & +etcdctl --endpoints "http://${ETCD_SERVER}" mkdir /vitess/global & echo "add /vitess/$cell" -${ETCD_BINDIR}/etcdctl --endpoints "http://${ETCD_SERVER}" mkdir /vitess/$cell & +etcdctl --endpoints "http://${ETCD_SERVER}" mkdir /vitess/$cell & # And also add the CellInfo description for the cell. # If the node already exists, it's fine, means we used existing data.