BlitzinBuffalo
6/12/2018 - 2:00 PM

citus-ubuntu

citus ubuntu

sudo curl https://install.citusdata.com/community/deb.sh | sudo bash
sudo apt -y install postgresql-10-citus-7.4


#####
# initialize cluster
#####

sudo mkdir /citus
sudo chmod -R 777 /citus

sudo vi /etc/fstab

/dev/sdb1    /citus/worker1   ext4    defaults     0        2
/dev/sdc1    /citus/worker2   ext4    defaults     0        2

sudo su - postgres
export PATH=$PATH:/usr/lib/postgresql/10/bin
mkdir -p /citus/coordinator /citus/worker1 /citus/worker2

initdb -D /citus/coordinator
initdb -D /citus/worker1
initdb -D /citus/worker2

echo "shared_preload_libraries = 'citus'" >> /citus/coordinator/postgresql.conf
echo "shared_preload_libraries = 'citus'" >> /citus/worker1/postgresql.conf
echo "shared_preload_libraries = 'citus'" >> /citus/worker2/postgresql.conf


#####
# initialize cluster
#####

export PATH=$PATH:/usr/lib/postgresql/10/bin
pg_ctl -D /citus/coordinator -o "-p 9700" -l coordinator_logfile start
pg_ctl -D /citus/worker1 -o "-p 9701" -l worker1_logfile start
pg_ctl -D /citus/worker2 -o "-p 9702" -l worker2_logfile start

psql -p 9700 -c "CREATE EXTENSION citus;"
psql -p 9701 -c "CREATE EXTENSION citus;"
psql -p 9702 -c "CREATE EXTENSION citus;"

psql -p 9700 -c "SELECT * from master_add_node('localhost', 9701);"
psql -p 9700 -c "SELECT * from master_add_node('localhost', 9702);"


#####
# verify installation
#####

psql -p 9700 -c "select * from master_get_active_worker_nodes();"