Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable etcd topo server to on OSX #4916

Merged
merged 1 commit into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions examples/local/env.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
# Copyright 2017 Google Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -41,7 +41,15 @@ fi

if [ "${TOPO}" = "etcd2" ]; then
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"
Expand Down
9 changes: 4 additions & 5 deletions examples/local/etcd-down.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

# Copyright 2017 Google Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -26,5 +26,4 @@ source "${script_root}/env.sh"

# Stop etcd servers.
echo "Stopping etcd servers..."
ETCD_VERSION=$(cat "$VTROOT/dist/etcd/.installed_version")
kill -9 "$(pgrep -f "dist/etcd/etcd-${ETCD_VERSION}-linux-amd64/etcd")"
kill -9 "$(pgrep -f "${ETCD_BINDIR}/etcd")"
14 changes: 6 additions & 8 deletions examples/local/etcd-up.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

# Copyright 2017 Google Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -25,17 +25,15 @@ script_root=$(dirname "${BASH_SOURCE[0]}")
# shellcheck disable=SC1091
source "${script_root}/env.sh"

ETCD_VERSION=$(cat "${VTROOT}/dist/etcd/.installed_version")

"${VTROOT}"/dist/etcd/etcd-"${ETCD_VERSION}"-linux-amd64/etcd --data-dir "${VTDATAROOT}/etcd/" --listen-client-urls "http://${ETCD_SERVER}" --advertise-client-urls "http://${ETCD_SERVER}" > "${VTDATAROOT}"/tmp/etcd.out 2>&1 &
${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 &
sleep 5

echo "add /vitess/global"
"${VTROOT}"/dist/etcd/etcd-"${ETCD_VERSION}"-linux-amd64/etcdctl --endpoints "http://${ETCD_SERVER}" mkdir /vitess/global &
${ETCD_BINDIR}/etcdctl --endpoints "http://${ETCD_SERVER}" mkdir /vitess/global &


echo "add /vitess/$cell"
"${VTROOT}"/dist/etcd/etcd-"${ETCD_VERSION}"-linux-amd64/etcdctl --endpoints "http://${ETCD_SERVER}" mkdir /vitess/$cell &
${ETCD_BINDIR}/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.
Expand Down