Last active
August 19, 2016 13:18
-
-
Save vadmeste/80cf25f690cff0d29a72b2d81161d195 to your computer and use it in GitHub Desktop.
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 | |
usage() { | |
echo "USAGE: ./$0 NR_PARALLEL_MINIOS BACKEND_PATH" | |
exit -1 | |
} | |
[[ -z "$1" ]] && usage || nr_parallel="$1" | |
[[ -z "$2" ]] && usage || backend_path="$2" | |
minio_args=() | |
minio_pids=() | |
kill_minios() { | |
for pid in "${minio_pids[@]}" | |
do | |
kill $pid | |
done | |
exit | |
} | |
trap kill_minios SIGINT SIGTERM | |
# Add aliases for loopback interface to be able to bind | |
# the same port 9000 | |
for i in $(seq 1 $nr_parallel); do | |
echo sudo ifconfig lo:$i 127.53.0.$i netmask 255.255.255.255 up | |
sudo ifconfig lo:$i 127.53.0.$i netmask 255.255.255.255 up | |
done | |
# Construct minio arguments | |
for i in $(seq 1 $nr_parallel); do | |
minio_args+=("127.53.0.$i:$backend_path/export$i/") | |
done | |
# Run minio servers | |
for i in $(seq 1 $nr_parallel) ; do | |
echo minio server --address "127.53.0.$i:9000" "${minio_args[@]}" | |
minio server --address "127.53.0.$i:9000" "${minio_args[@]}" & | |
minio_pids+=($!) | |
done | |
echo "Press Ctrl-C to shutdown all minio instances.." | |
while true; do | |
read | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment