List All Cluster:
root@debian:~# pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
Find Status of given instance:
root@debian:~# pg_ctlcluster 9.6 main status
pg_ctl: server is running (PID: 6062)
/usr/lib/postgresql/9.6/bin/postgres "-D" "/var/lib/postgresql/9.6/main" "-c" "config_file=/etc/postgresql/9.6/main/postgresql.conf"
Kill Process:
sudo kill -SIGHUP 6062
Change Status of instance – start/stop:
pg_ctlcluster 9.6 main stop
pg_ctlcluster 9.6 main start
pg_ctlcluster 9.6 main restart
View Cluster Configuration:
root@debian:~# pg_ctlcluster 9.6 main status
pg_ctl: server is running (PID: 6062)
/usr/lib/postgresql/9.6/bin/postgres "-D" "/var/lib/postgresql/9.6/main" "-c" "config_file=/etc/postgresql/9.6/main/postgresql.conf"
root@debian:~# ^C
root@debian:~# pg_conftool 9.6 main show all
cluster_name = '9.6/main'
data_directory = '/var/lib/postgresql/9.6/main'
datestyle = 'iso, mdy'
default_text_search_config = pg_catalog.english
dynamic_shared_memory_type = posix
external_pid_file = '/var/run/postgresql/9.6-main.pid'
hba_file = '/etc/postgresql/9.6/main/pg_hba.conf'
ident_file = '/etc/postgresql/9.6/main/pg_ident.conf'
lc_messages = en_IN
lc_monetary = en_IN
lc_numeric = en_IN
lc_time = en_IN
log_line_prefix = '%t [%p-%l] %q%u@%d '
log_timezone = localtime
max_connections = 100
port = 5432
shared_buffers = 128MB
ssl = true
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
stats_temp_directory = '/var/run/postgresql/9.6-main.pg_stat_tmp'
timezone = localtime
unix_socket_directories = '/var/run/postgresql'
Create New Cluster:
pg_createcluster 9.6 new_cluster
DROP Cluster:
pg_dropcluster --stop 9.6 main
Update Cluster:
pg_upgradecluster 9.5 main
it upgrades to next version
Reload Configuration:
pg_ctlcluster 9.6 main reload
Restart Postgres Service:
root@debian:~# systemctl reload postgresql
/var/run/postgresql:5432 - accepting connections
root@debian:~# pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
Find Status of given instance:
root@debian:~# pg_ctlcluster 9.6 main status
pg_ctl: server is running (PID: 6062)
/usr/lib/postgresql/9.6/bin/postgres "-D" "/var/lib/postgresql/9.6/main" "-c" "config_file=/etc/postgresql/9.6/main/postgresql.conf"
Kill Process:
sudo kill -SIGHUP 6062
Change Status of instance – start/stop:
pg_ctlcluster 9.6 main stop
pg_ctlcluster 9.6 main start
pg_ctlcluster 9.6 main restart
View Cluster Configuration:
root@debian:~# pg_ctlcluster 9.6 main status
pg_ctl: server is running (PID: 6062)
/usr/lib/postgresql/9.6/bin/postgres "-D" "/var/lib/postgresql/9.6/main" "-c" "config_file=/etc/postgresql/9.6/main/postgresql.conf"
root@debian:~# ^C
root@debian:~# pg_conftool 9.6 main show all
cluster_name = '9.6/main'
data_directory = '/var/lib/postgresql/9.6/main'
datestyle = 'iso, mdy'
default_text_search_config = pg_catalog.english
dynamic_shared_memory_type = posix
external_pid_file = '/var/run/postgresql/9.6-main.pid'
hba_file = '/etc/postgresql/9.6/main/pg_hba.conf'
ident_file = '/etc/postgresql/9.6/main/pg_ident.conf'
lc_messages = en_IN
lc_monetary = en_IN
lc_numeric = en_IN
lc_time = en_IN
log_line_prefix = '%t [%p-%l] %q%u@%d '
log_timezone = localtime
max_connections = 100
port = 5432
shared_buffers = 128MB
ssl = true
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
stats_temp_directory = '/var/run/postgresql/9.6-main.pg_stat_tmp'
timezone = localtime
unix_socket_directories = '/var/run/postgresql'
Create New Cluster:
pg_createcluster 9.6 new_cluster
DROP Cluster:
pg_dropcluster --stop 9.6 main
Update Cluster:
pg_upgradecluster 9.5 main
it upgrades to next version
Reload Configuration:
pg_ctlcluster 9.6 main reload
Restart Postgres Service:
root@debian:~# systemctl reload postgresql
CHECK if Postgres is Listensing :
root@debian:~# pg_isready/var/run/postgresql:5432 - accepting connections
No comments:
Post a Comment