forked from jocubeit/vagrant-postgresql-hot-standby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·39 lines (35 loc) · 1.35 KB
/
setup
File metadata and controls
executable file
·39 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
export VSSH="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $HOME/.vagrant.d/insecure_private_key"
export VSCP="scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $HOME/.vagrant.d/insecure_private_key"
export ADMIN=vagrant
export TARGET=master
./setup-generic
export TARGET=slave
./setup-generic
echo ""
echo "----------------------------------------------------------------------------"
echo ""
echo " Setting up the PostgreSQL Master and Slave"
echo ""
echo "----------------------------------------------------------------------------"
echo ""
$VSSH $ADMIN@slave "sudo service postgresql stop"
$VSSH $ADMIN@master "/tmp/pg-ms-setup/setup-master"
$VSSH $ADMIN@slave "/tmp/pg-ms-setup/setup-slave"
echo ""
echo "----------------------------------------------------------------------------"
echo ""
echo " To try it out:"
echo ""
echo " vagrant ssh master"
echo " sudo -u postgres psql -d postgres -c \"create database sampledb;\""
echo " sudo -u postgres psql -d sampledb -c \"create table tab (val int); insert into tab values (42);\""
echo " exit"
echo ""
echo " vagrant ssh slave"
echo " sudo bash"
echo " su postgres -c 'psql -d sampledb -c \"select * from tab;\"'"
echo " exit"
echo " exit"
echo ""
echo "----------------------------------------------------------------------------"
echo ""