Created
October 29, 2018 22:49
-
-
Save begriffs/077987830902845a07d63a5aa9d0326b to your computer and use it in GitHub Desktop.
little hacky script I use to manage versions
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 | |
ACTION="${1:-start}" | |
VER="${2:-8.0}" | |
case $ACTION in | |
install) | |
echo "Installing versioned extension shared object" | |
cp src/backend/distributed/citus.so /usr/local/lib/postgresql/citus-${VER}.so | |
;; | |
start) | |
echo "Activating Citus shared object" | |
pushd . | |
cd /usr/local/lib/postgresql | |
sudo rm citus.so | |
sudo ln -s citus-${VER}.so citus.so | |
cd /usr/local/share/postgresql/extension | |
sudo rm citus.control | |
sudo ln -s citus.control-${VER} citus.control | |
popd | |
echo "Starting Citus $VER" | |
pg_ctl -D ~/databases/citus-${VER}/coord start | |
pg_ctl -D ~/databases/citus-${VER}/w1 -o '-p 5433' start | |
pg_ctl -D ~/databases/citus-${VER}/w2 -o '-p 5434' start | |
;; | |
stop) | |
echo "Stopping Citus $VER" | |
pg_ctl -D ~/databases/citus-${VER}/coord stop | |
pg_ctl -D ~/databases/citus-${VER}/w1 stop | |
pg_ctl -D ~/databases/citus-${VER}/w2 stop | |
;; | |
destroy) | |
echo "Destroying Citus $VER db clusters" | |
rm -fr ~/databases/citus-${VER} | |
;; | |
status) | |
ps aux | grep postgres | grep -- -D | |
;; | |
new) | |
echo "Creating Citus $VER Cluster" | |
initdb -D ~/databases/citus-${VER}/coord | |
initdb -D ~/databases/citus-${VER}/w1 | |
initdb -D ~/databases/citus-${VER}/w2 | |
echo "Adding new configuration settings..." | |
cat <<CONF | tee -a ~/databases/citus-${VER}/{coord,w1,w2}/postgresql.conf | |
shared_preload_libraries = 'citus' | |
citus.enable_statistics_collection = off | |
log_destination = 'stderr' | |
logging_collector = on | |
log_directory = 'pg_log' | |
log_filename = 'postgresql-%Y-%m-%d.log' | |
log_statement = 'all' | |
CONF | |
echo "\nStart the cluster and run CREATE EXTENSION on each node." | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you create
citus.control-${VER}
files in your setup? Did you make changes in the install targets in citus makefile so thatcitus.control
files are installed with their version numbers appended to them?