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
citusdb=# select * from pg_timezone_names limit 1; | |
name | abbrev | utc_offset | is_dst | |
------------+--------+------------+-------- | |
Etc/GMT-12 | +12 | 12:00:00 | f | |
(1 row) | |
citusdb=# select current_timestamp at time zone 'UTC'; | |
timezone | |
--------------------------- | |
2023-11-20 09:59:05.33791 |
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
-- port 5432 | |
drop publication db1 ; | |
drop subscription db12; | |
drop subscription db13; | |
drop table t; | |
create table t(id int primary key); | |
create publication db1 for all tables WITH ( PUBLISH = 'insert,update,delete,truncate' ); | |
CREATE SUBSCRIPTION db12 connection 'dbname=postgres port=5433 host=localhost user=postgres' publication db2 WITH (origin = none, copy_data = | |
off); | |
CREATE SUBSCRIPTION db13 connection 'dbname=postgres port=5434 host=localhost user=postgres' publication db3 WITH (origin = none, copy_data = |
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
why pg_repack will not do online data migration | |
https://github.com/reorg/pg_repack/pull/162 |
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
postgres@pg:~/citusdb$ cat setup.sh | |
#!/bin/bash | |
export PATH=/usr/lib/postgresql/14/bin:$PATH | |
port=5432 | |
if [[ -d dbcr ]] | |
then | |
pg_ctl -D dbcr stop | |
rm -rf dbcr* | |
fi |
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
https://blog.devgenius.io/setup-continuous-archiving-and-point-in-time-recovery-pitr-with-postgresql-db-7e670523e8e4 | |
PostgreSQL is a powerful open-source relational database management system. It is widely used in various industries and applications due to its reliability, security, and scalability. One of its most useful features is Point-In-Time-Recovery (PITR), which allows you to recover your database to a specific point in time. PITR is essential in disaster recovery scenarios because it can minimize data loss. | |
Here are the steps to set up PITR with PostgreSQL: | |
Enable Archiving | |
In the postgresql.conf file, set the archive_mode configuration parameter to on. This will enable archiving. | |
Configure Archive Command | |
In the postgresql.conf file, set the archive_command configuration parameter to a command that will copy the WAL files to a safe location. For example, you can use the following command: |
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
i need to modify my postmaster.pid file in postgresql to a custom path. how to do it | |
ChatGPT | |
To modify the path of the postmaster.pid file in PostgreSQL, you'll need to update the configuration file (postgresql.conf) with the desired location. Here's a step-by-step guide to help you: | |
Locate the postgresql.conf file: The exact location of the file depends on your operating system and PostgreSQL installation. Common locations include: | |
Linux: /etc/postgresql/{version}/main/postgresql.conf | |
macOS: /usr/local/var/postgres/postgresql.conf | |
Windows: C:\Program Files\PostgreSQL\{version}\data\postgresql.conf | |
Open the postgresql.conf file using a text editor. |
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
#if i bump number of concurrent subscriptions to 400 my vm freezes :), but otherwise it works fine. so may be some resource bottleneck | |
#is resulting in the errors | |
postgres@pg:~/temp$ cat run.sh | |
#!/bin/bash | |
for i in {1..3} | |
do | |
pg_ctl -D db$i -l db${i}.log stop |
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
postgres@pg:~/temp$ initdb -D db1 | |
postgres@pg:~/temp$ pg_ctl -D db1 -l db1.log start | |
waiting for server to start.... done | |
server started | |
postgres@pg:~/temp$ | |
postgres@pg:~/temp$ pg_basebackup -D replica -R -c fast -C -S replica -d "port=5432" | |
postgres@pg:~/temp$ vim replica/postgresql.auto.conf | |
postgres@pg:~/temp$ pg_ctl -D db2 -l db2.log start | |
pg_ctl: directory "db2" does not exist | |
postgres@pg:~/temp$ pg_ctl -D replica -l replica.log start |
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
postgres@pg:~/citusdb$ more setup.sh | |
#!/bin/bash | |
export PATH=/usr/lib/postgresql/14/bin:$PATH | |
port=5432 | |
for i in db1 db2 db3 db4 | |
do | |
pg_ctl -D $i stop | |
rm -rf $i | |
initdb -D $i |