Your question would be better suited for the Unix or Ubuntu site because it looks like a basis Linux issue.
Anyway here goes.
Solution
After you have logged in to your Ubuntu server, you should be on a shell prompt similar to the following:
Last login: Mon Sep 18 14:42:02 2017 from 161.78.198.153
$
The PostgreSQL service will be normally running under the postgres
login, but lets go ahead and verify that. First we switch to the postgres
account:
$ su - postgres
Password:
[postgres@hostname:~] >
Now let's go and search for the postgresql.conf
file:
[postgres@hostname:/etc/postgresql/main1] > locate postgresql.conf
/etc/postgresql/9.5/main/postgresql.conf
/etc/postgresql/9.5/main1/postgresql.conf
/etc/postgresql/9.5/main2/postgresql.conf
/etc/postgresql/9.5/main3/postgresql.conf
/pgsql/data/postgres2/postgresql.conf
/pgsql/data/postgres3/postgresql.conf
/usr/lib/tmpfiles.d/postgresql.conf
/usr/share/postgresql/9.5/postgresql.conf.sample
[postgres@hostname:/etc/postgresql/main1] >
Ok. We have found multiple files. Let's go and look at one:
[postgres@hostname:/etc/postgresql/main1] > more /etc/postgresql/9.5/main/postgresql.conf
This gives us:
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
# values can be found in the PostgreSQL documentation.
#
# The commented-out settings shown in this file represent the default values.
# Re-commenting a setting is NOT sufficient to revert it to the default value;
# you need to reload the server.
#
# This file is read on server startup and when the server receives a SIGHUP
# signal. If you edit the file on a running system, you have to SIGHUP the
# server for the changes to take effect, or use "pg_ctl reload". Some
# parameters, which are marked below, require a server shutdown and restart to
# take effect.
#
# Any parameter can also be given as a command-line option to the server, e.g.,
# "postgres -c log_connections=on". Some parameters can be changed at run time
# with the "SET" SQL command.
#
# Memory units: kB = kilobytes Time units: ms = milliseconds
# MB = megabytes s = seconds
# GB = gigabytes min = minutes
# TB = terabytes h = hours
# d = days
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
data_directory = '/var/lib/postgresql/9.5/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/9.5/main/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/9.5/main/pg_ident.conf' # ident configuration file
--More--(9%)
So you know have a configuration setting pointing you in the right direction.
Caution
Now the PostgreSQL instance could have manually been started with a different configuration file. Let's double-check with the ps -efx
command (beautiful isn't it?):
[postgres@hostname:/etc/postgresql/main1] > ps -efx
PID TTY STAT TIME COMMAND
4507 pts/0 S 0:00 -su TERM=xterm PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games LANG=en_US.UTF-8 LANGUAGE=en_US:en MAIL
4972 pts/0 R+ 0:00 \_ ps -efx pgarchiv=/pgsql-backup/archive/postgres1/ SHELL=/bin/bash TERM=xterm PGHOSTADDR=10.57.198.21 USER=postgr
1672 ? S 0:08 /usr/lib/postgresql/9.5/bin/postgres -D /pgsql/data/postgres2 -c config_file=/etc/postgresql/9.5/main2/postgresql.co
1739 ? Ss 0:00 \_ postgres: checkpointer process
1744 ? Ss 0:02 \_ postgres: writer process
1745 ? Ss 0:02 \_ postgres: wal writer process
1746 ? Ss 0:04 \_ postgres: autovacuum launcher process
1747 ? Ss 0:00 \_ postgres: archiver process last was 000000010000000200000012
1748 ? Ss 0:05 \_ postgres: stats collector process
1671 ? S 0:11 /usr/lib/postgresql/9.5/bin/postgres -D /pgsql/data/postgres1 -c config_file=/etc/postgresql/9.5/main1/postgresql.co
1751 ? Ss 0:00 \_ postgres: checkpointer process
1752 ? Ss 0:02 \_ postgres: writer process
1753 ? Ss 0:02 \_ postgres: wal writer process
1754 ? Ss 0:06 \_ postgres: autovacuum launcher process
1755 ? Ss 0:00 \_ postgres: archiver process last was 000000010000000200000033
1756 ? Ss 0:07 \_ postgres: stats collector process
1664 ? S 0:08 /usr/lib/postgresql/9.5/bin/postgres -D /pgsql/data/postgres3 -c config_file=/etc/postgresql/9.5/main3/postgresql.co
1740 ? Ss 0:00 \_ postgres: checkpointer process
1741 ? Ss 0:02 \_ postgres: writer process
1742 ? Ss 0:02 \_ postgres: wal writer process
1743 ? Ss 0:04 \_ postgres: autovacuum launcher process
1749 ? Ss 0:00 \_ postgres: archiver process last was 000000010000000200000012
1750 ? Ss 0:05 \_ postgres: stats collector process
[postgres@hostname:/etc/postgresql/main1] >
You will find a line containing:
/usr/lib/postgresql/9.5/bin/postgres -D /pgsql/data/postgres2 -c config_file=/etc/postgresql/9.5/main2/postgresql.conf
This is how you can check which PostgreSQL instances are using which *.conf
files.
SHOW data_directory;
. Otherwise, how did you install PostgreSQL?/var/lib/postgresql
?