Skip to content

Commit ab927a6

Browse files
committed
init script
1 parent 7f08387 commit ab927a6

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

reinit.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/sh
2+
3+
reinit_master() {
4+
rm -rf install/data
5+
6+
./install/bin/initdb -A trust -D ./install/data
7+
8+
echo "max_prepared_transactions = 100" >> ./install/data/postgresql.conf
9+
echo "shared_buffers = 512MB" >> ./install/data/postgresql.conf
10+
echo "fsync = off" >> ./install/data/postgresql.conf
11+
echo "log_checkpoints = on" >> ./install/data/postgresql.conf
12+
echo "max_wal_size = 48MB" >> ./install/data/postgresql.conf
13+
echo "min_wal_size = 32MB" >> ./install/data/postgresql.conf
14+
echo "wal_level = logical" >> ./install/data/postgresql.conf
15+
echo "wal_keep_segments = 64" >> ./install/data/postgresql.conf
16+
echo "max_wal_senders = 2" >> ./install/data/postgresql.conf
17+
echo "max_replication_slots = 2" >> ./install/data/postgresql.conf
18+
19+
echo '' > ./install/data/logfile
20+
21+
echo 'local replication stas trust' >> ./install/data/pg_hba.conf
22+
23+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile start
24+
./install/bin/createdb stas
25+
./install/bin/psql -c "create table t(id int);"
26+
}
27+
28+
reinit_slave() {
29+
rm -rf install/data_slave
30+
31+
./install/bin/pg_basebackup -D ./install/data_slave/ -R
32+
33+
echo "port = 5433" >> ./install/data_slave/postgresql.conf
34+
echo "hot_standby = on" >> ./install/data_slave/postgresql.conf
35+
36+
echo '' > ./install/data_slave/logfile
37+
38+
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/data_slave/logfile start
39+
}
40+
41+
make install > /dev/null
42+
43+
44+
pkill -9 postgres
45+
reinit_master >> /dev/null
46+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy