postgresql-12.service doesn't start on CentOS 8 after reboot - postgresql

I have a PostgreSQL 12 database running on CentOS 8 and until today everything was good.
After restarting my database server, my postgresql-12.service doesn't start anymore, I've tried with systemctl like systemctl start postgresql-12.service and I got this:
[postgres#perseus ~]$ sudo systemctl start postgresql-12.service
[sudo] password for postgres:
Job for postgresql-12.service failed because the control process exited with error code.
See "systemctl status postgresql-12.service" and "journalctl -xe" for details.
[postgres#perseus ~]$ sudo systemctl status postgresql-12.service
● postgresql-12.service - PostgreSQL 12 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-12.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2020-08-11 08:57:51 -03; 11s ago
Docs: https://www.postgresql.org/docs/12/static/
Process: 2822 ExecStart=/usr/pgsql-12/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE)
Process: 2816 ExecStartPre=/usr/pgsql-12/bin/postgresql-12-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 2822 (code=exited, status=1/FAILURE)
Aug 11 08:57:49 perseus postmaster[2822]: 2020-08-11 08:57:49.040 -03 [2822] LOG: listening on IPv4 address "0.0.0.0", port 5432
Aug 11 08:57:49 perseus postmaster[2822]: 2020-08-11 08:57:49.040 -03 [2822] LOG: listening on IPv6 address "::", port 5432
Aug 11 08:57:49 perseus postmaster[2822]: 2020-08-11 08:57:49.041 -03 [2822] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Aug 11 08:57:49 perseus postmaster[2822]: 2020-08-11 08:57:49.042 -03 [2822] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
Aug 11 08:57:49 perseus postmaster[2822]: 2020-08-11 08:57:49.068 -03 [2822] LOG: redirecting log output to logging collector process
Aug 11 08:57:49 perseus postmaster[2822]: 2020-08-11 08:57:49.068 -03 [2822] HINT: Future log output will appear in directory "log".
Aug 11 08:57:51 perseus systemd[1]: postgresql-12.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 08:57:51 perseus systemd[1]: postgresql-12.service: Killing process 2824 (postmaster) with signal SIGKILL.
Aug 11 08:57:51 perseus systemd[1]: postgresql-12.service: Failed with result 'exit-code'.
Aug 11 08:57:51 perseus systemd[1]: Failed to start PostgreSQL 12 database server.
And then, googling this error, i've tried some workarounds, like using pg_ctl and initdb comands, but it's also fails, like this:
[postgres#perseus ~]$ /usr/pgsql-12/bin/pg_ctl start -D /var/lib/pgsql/12/data
waiting for server to start....2020-08-11 09:04:44.197 -03 [2897] LOG: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit
2020-08-11 09:04:44.197 -03 [2897] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-08-11 09:04:44.197 -03 [2897] LOG: listening on IPv6 address "::", port 5432
2020-08-11 09:04:44.197 -03 [2897] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-08-11 09:04:44.198 -03 [2897] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-08-11 09:04:44.222 -03 [2897] LOG: redirecting log output to logging collector process
2020-08-11 09:04:44.222 -03 [2897] HINT: Future log output will appear in directory "log".
.. stopped waiting
pg_ctl: could not start server
Examine the log output.
[postgres#perseus ~]$ /usr/pgsql-12/bin/initdb -D '/var/lib/pgsql/12/data'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
initdb: error: directory "/var/lib/pgsql/12/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/pgsql/12/data" or run initdb
with an argument other than "/var/lib/pgsql/12/data".
journalctl -xe results:
[postgres#perseus ~]$ sudo systemctl start postgresql-12.service
[sudo] password for postgres:
Job for postgresql-12.service failed because the control process exited with error code.
See "systemctl status postgresql-12.service" and "journalctl -xe" for details.
[postgres#perseus ~]$ sudo journalctl -xe
Aug 11 11:16:49 perseus sudo[3022]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Aug 11 11:16:49 perseus sudo[3022]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Aug 11 11:16:49 perseus sudo[3022]: pam_unix(sudo:session): session closed for user root
Aug 11 11:20:01 perseus systemd[1]: Starting system activity accounting tool...
-- Subject: Unit sysstat-collect.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit sysstat-collect.service has begun starting up.
Aug 11 11:20:01 perseus systemd[1]: Started system activity accounting tool.
-- Subject: Unit sysstat-collect.service has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit sysstat-collect.service has finished starting up.
--
-- The start-up result is RESULT.
Aug 11 11:26:10 perseus sudo[3095]: postgres : TTY=pts/0 ; PWD=/var/lib/pgsql ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 11 11:26:10 perseus sudo[3095]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Aug 11 11:26:10 perseus sudo[3095]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Aug 11 11:26:49 perseus sudo[3095]: pam_unix(sudo:session): session closed for user root
Aug 11 11:26:52 perseus sudo[3107]: postgres : TTY=pts/0 ; PWD=/var/lib/pgsql ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 11 11:26:52 perseus sudo[3107]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Aug 11 11:26:52 perseus sudo[3107]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Aug 11 11:27:48 perseus sudo[3107]: pam_unix(sudo:session): session closed for user root
Aug 11 11:30:01 perseus systemd[1]: Starting system activity accounting tool...
-- Subject: Unit sysstat-collect.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit sysstat-collect.service has begun starting up.
Aug 11 11:30:01 perseus systemd[1]: Started system activity accounting tool.
-- Subject: Unit sysstat-collect.service has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit sysstat-collect.service has finished starting up.
--
-- The start-up result is RESULT.
Aug 11 11:34:13 perseus sudo[3167]: postgres : TTY=pts/0 ; PWD=/var/lib/pgsql ; USER=root ; COMMAND=/bin/systemctl start postgresql-12.service
Aug 11 11:34:13 perseus sudo[3167]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Aug 11 11:34:13 perseus sudo[3167]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Aug 11 11:34:13 perseus systemd[1]: Starting PostgreSQL 12 database server...
-- Subject: Unit postgresql-12.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit postgresql-12.service has begun starting up.
Aug 11 11:34:13 perseus postmaster[3176]: 2020-08-11 11:34:13.373 -03 [3176] LOG: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit
Aug 11 11:34:13 perseus postmaster[3176]: 2020-08-11 11:34:13.373 -03 [3176] LOG: listening on IPv4 address "0.0.0.0", port 5432
Aug 11 11:34:13 perseus postmaster[3176]: 2020-08-11 11:34:13.373 -03 [3176] LOG: listening on IPv6 address "::", port 5432
Aug 11 11:34:13 perseus postmaster[3176]: 2020-08-11 11:34:13.375 -03 [3176] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Aug 11 11:34:13 perseus postmaster[3176]: 2020-08-11 11:34:13.380 -03 [3176] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
Aug 11 11:34:13 perseus postmaster[3176]: 2020-08-11 11:34:13.399 -03 [3176] LOG: redirecting log output to logging collector process
Aug 11 11:34:13 perseus postmaster[3176]: 2020-08-11 11:34:13.399 -03 [3176] HINT: Future log output will appear in directory "log".
Aug 11 11:34:17 perseus systemd[1]: postgresql-12.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 11:34:17 perseus systemd[1]: postgresql-12.service: Killing process 3177 (postmaster) with signal SIGKILL.
Aug 11 11:34:17 perseus systemd[1]: postgresql-12.service: Failed with result 'exit-code'.
Aug 11 11:34:17 perseus systemd[1]: Failed to start PostgreSQL 12 database server.
-- Subject: Unit postgresql-12.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit postgresql-12.service has failed.
--
-- The result is RESULT.
Aug 11 11:34:17 perseus sudo[3167]: pam_unix(sudo:session): session closed for user root
Aug 11 11:34:38 perseus sudo[3188]: postgres : TTY=pts/0 ; PWD=/var/lib/pgsql ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 11 11:34:38 perseus sudo[3188]: pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice
Aug 11 11:34:38 perseus sudo[3188]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Database log with verbose mode:
2020-08-11 15:23:01.400 -03 [7405] LOG: 00000: database system was interrupted; last known up at 2020-08-07 11:37:10 -03
2020-08-11 15:23:01.400 -03 [7405] LOCATION: StartupXLOG, xlog.c:6305
2020-08-11 15:23:05.160 -03 [7405] FATAL: 58P01: could not open directory "": No such file or directory
2020-08-11 15:23:05.160 -03 [7405] LOCATION: ReadDirExtended, fd.c:2563
2020-08-11 15:23:05.161 -03 [7403] LOG: 00000: startup process (PID 7405) exited with exit code 1
2020-08-11 15:23:05.161 -03 [7403] LOCATION: LogChildExit, postmaster.c:3675
2020-08-11 15:23:05.161 -03 [7403] LOG: 00000: aborting startup due to startup process failure
2020-08-11 15:23:05.161 -03 [7403] LOCATION: reaper, postmaster.c:2945
2020-08-11 15:23:05.163 -03 [7403] LOG: 00000: database system is shut down
2020-08-11 15:23:05.163 -03 [7403] LOCATION: UnlinkLockFiles, miscinit.c:860
The PGDATA directory:
[postgres#perseus ~]$ ll -la /var/lib/pgsql/12/data/
total 88
drwx------. 20 postgres postgres 4096 Aug 11 15:49 .
drwx------. 4 postgres postgres 66 Aug 11 14:55 ..
drwx------. 26 postgres postgres 4096 Jul 28 09:29 base
-rw------- 1 postgres postgres 30 Aug 11 15:49 current_logfiles
drwx------. 2 postgres postgres 4096 Aug 11 09:34 global
-rw-r--r-- 1 root root 560 May 29 10:05 global.sql
drwx------. 2 postgres postgres 188 Aug 11 15:50 log
drwx------. 2 postgres postgres 6 May 22 09:16 pg_commit_ts
drwx------. 2 postgres postgres 6 May 22 09:16 pg_dynshmem
-rw------- 1 postgres postgres 4329 May 28 09:07 pg_hba.conf
-rw-------. 1 postgres postgres 1636 May 22 09:16 pg_ident.conf
drwx------. 4 postgres postgres 68 Aug 7 11:37 pg_logical
drwx------. 4 postgres postgres 36 May 22 09:16 pg_multixact
drwx------. 2 postgres postgres 18 Aug 11 15:49 pg_notify
drwx------. 2 postgres postgres 6 May 22 09:16 pg_replslot
drwx------. 2 postgres postgres 6 May 22 09:16 pg_serial
drwx------. 2 postgres postgres 6 May 22 09:16 pg_snapshots
drwx------. 2 postgres postgres 6 Jul 24 14:45 pg_stat
drwx------. 2 postgres postgres 4096 Aug 11 15:49 pg_stat_tmp
drwx------. 2 postgres postgres 18 Jul 28 09:36 pg_subtrans
drwx------. 2 postgres postgres 6 May 22 09:16 pg_tblspc
drwx------. 2 postgres postgres 6 May 22 09:16 pg_twophase
-rw-------. 1 postgres postgres 3 May 22 09:16 PG_VERSION
drwx------. 3 postgres postgres 4096 Jul 31 17:16 pg_wal
drwx------. 2 postgres postgres 4096 Jun 3 11:51 pg_xact
-rw-------. 1 postgres postgres 88 May 22 09:16 postgresql.auto.conf
-rw------- 1 postgres postgres 26808 Aug 11 15:22 postgresql.conf
-rw------- 1 postgres postgres 58 Aug 11 15:49 postmaster.opts
-rw-r--r-- 1 root root 1160 May 29 09:08 teste.backup
Edited with more data.

Related

Postgres bdr_init_physical command is in idle

I've installed, correctly Postgres13 with BDR. First node is configured correctly
create_node
-------------
661510928
(1 row)
create_node_group
-------------------
3209631483
(1 row)
wait_for_join_completion
--------------------------
ACTIVE
(1 row)
The problem is on second node, if I try to join the node 1, with command:
bdr_init_physical -D /home/postgres/data -n bdr_node_rm1_02 --local-dsn="port=5432 dbname=lmw host=192.168.0.101 user=postgres password=PWD" -d "port=5432 dbname=lmw host=192.168.0.102 user=postgres password=PWD"
Starting bdr_init_physical ...
Getting remote server identification ...
Creating replication slot on remote node ...
Creating base backup of the remote node ...
38798/38798 kB (100%), 1/1 tablespace
Creating temporary synchronization replication slot on remote node ...
Bringing local node to the target lsn ...
I see on log, that this command is in idle:
Feb 15 10:16:43 localhost postgres[8080]: [11-1] 2023-02-15 10:16:43.685 CET [8080] LOG: logical decoding found consistent point at 0/405EA10
Feb 15 10:16:43 localhost postgres[8080]: [11-2] 2023-02-15 10:16:43.685 CET [8080] DETAIL: There are no running transactions.
Feb 15 10:16:43 localhost postgres[8080]: [11-3] 2023-02-15 10:16:43.685 CET [8080] STATEMENT: SELECT pg_catalog.pg_create_logical_replication_slot('bdr_lmw_lmw_bdr_node_rm1_02', 'pglogical_output') -- bdr_init_physical
Feb 15 10:16:43 localhost postgres[8081]: [11-1] 2023-02-15 10:16:43.734 CET [8081] LOG: using default exclude directory 0xa0a220 0xa0a220
Feb 15 10:16:43 localhost postgres[8081]: [11-2] 2023-02-15 10:16:43.734 CET [8081] STATEMENT: BASE_BACKUP LABEL 'pg_basebackup base backup' PROGRESS FAST NOWAIT MANIFEST 'yes'
Feb 15 10:16:45 localhost postgres[8078]: [11-1] 2023-02-15 10:16:45.851 CET [8078] LOG: logical decoding found consistent point at 0/6000028
Feb 15 10:16:45 localhost postgres[8078]: [11-2] 2023-02-15 10:16:45.851 CET [8078] DETAIL: There are no running transactions.
Feb 15 10:16:45 localhost postgres[8078]: [11-3] 2023-02-15 10:16:45.851 CET [8078] STATEMENT: CREATE_REPLICATION_SLOT "bdr_lmw_lmw_bdr_node_rm1_02_tmp" TEMPORARY LOGICAL pglogical_output
Feb 15 10:16:45 localhost postgres[8078]: [12-1] 2023-02-15 10:16:45.851 CET [8078] LOG: exported logical decoding snapshot: "00000008-0000002C-1" with 0 transaction IDs
Feb 15 10:16:45 localhost postgres[8078]: [12-2] 2023-02-15 10:16:45.851 CET [8078] STATEMENT: CREATE_REPLICATION_SLOT "bdr_lmw_lmw_bdr_node_rm1_02_tmp" TEMPORARY LOGICAL pglogical_output
Do you know why this command is in idle?

Why I got the next errors?

could someone help me with this error please:
Output for command: systemctl start postgresql-13.service
Job for postgresql-13.service failed because the control process exited with error code.
See "systemctl status postgresql-13.service" and "journalctl -xeu postgresql-13.service" for details.
Output for command systemctl status postgresql-13.service
× postgresql-13.service - PostgreSQL 13 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-13.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2022-08-23 12:17:50 CDT; 1min 47s ago
Docs: https://www.postgresql.org/docs/13/static/
Process: 1079 ExecStartPre=/usr/pgsql-13/bin/postgresql-13-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Process: 1110 ExecStart=/usr/pgsql-13/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE)
Main PID: 1110 (code=exited, status=1/FAILURE)
CPU: 40ms
Aug 23 12:17:47 fedora systemd[1]: Starting PostgreSQL 13 database server...
Aug 23 12:17:50 fedora postmaster[1110]: 2022-08-23 12:17:50.144 CDT [1110] LOG: redirecting log output to logging collector process
Aug 23 12:17:50 fedora postmaster[1110]: 2022-08-23 12:17:50.144 CDT [1110] HINT: Future log output will appear in directory "log".
Aug 23 12:17:50 fedora systemd[1]: postgresql-13.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 12:17:50 fedora systemd[1]: postgresql-13.service: Killing process 1132 (postmaster) with signal SIGKILL.
Aug 23 12:17:50 fedora systemd[1]: postgresql-13.service: Killing process 1132 (postmaster) with signal SIGKILL.
Aug 23 12:17:50 fedora systemd[1]: postgresql-13.service: Failed with result 'exit-code'.
Aug 23 12:17:50 fedora systemd[1]: postgresql-13.service: Unit process 1132 (postmaster) remains running after unit stopped.
Aug 23 12:17:50 fedora systemd[1]: Failed to start PostgreSQL 13 database server.
Already I uninstall and reinstall postgresql but nothing works. Also I tried to install postgresql-14 but I get the same error.
I have to install postgresql to work alongs with Ruby on Rails.

Postgresql Failed in Ubuntu environment. with error message - "socket "/var/run/postgresql/.s.PGSQL.5432"?

One day, My Postgresql server stopped working. Checked log. It was shutdown somehow.
root#ip_address:/# tail /var/log/postgresql/postgresql-10-main.log
2020-02-19 06:47:49.215 CET [23497] LOG: received smart shutdown request
2020-02-19 06:47:49.477 CET [23497] LOG: worker process: logical replication launcher (PID 23512) exited with exit code 1
2020-02-19 06:47:49.482 CET [23507] LOG: shutting down
2020-02-19 06:47:49.546 CET [23497] LOG: database system is shut down
When I run,
root#ip_address:/# psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
It complained that there are no files and directory. so I checked if my postgresql running.
root#ip_address:/# systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Sun 2020-03-08 16:19:24 CET; 26min ago
Process: 30136 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 30136 (code=exited, status=0/SUCCESS)
Mar 08 16:19:24 vps584959 systemd[1]: Starting PostgreSQL RDBMS...
Mar 08 16:19:24 vps584959 systemd[1]: Started PostgreSQL RDBMS.
It was running. but, if I check postgresql cluster.
root#ip_address:/# pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
10 main 5432 down postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
It was DOWN
so I tried
root#ip_address:/# pg_ctlcluster 10 main start
Error: Config owner (deploy:1003) and data owner (postgres:114) do not match, and config owner is not root
I wasn't able to make it work. then I tried.
sudo chown -R deploy:postgres /var/lib/postgresql/10/ && sudo chmod -R u=rwX,go= /var/lib/postgresql/10/
try again.
root#ip_address:/# pg_ctlcluster 10 main start
Job for postgresql#10-main.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status postgresql#10-main.service" and "journalctl -xe" for details.
root#ip_address:/# systemctl status postgresql#10-main.service
● postgresql#10-main.service - PostgreSQL Cluster 10-main
Loaded: loaded (/lib/systemd/system/postgresql#.service; indirect; vendor preset: enabled)
Active: failed (Result: protocol) since Sun 2020-03-08 16:59:53 CET; 2min 52s ago
Process: 31635 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code=exited, status=1/FAILURE)
Main PID: 23497 (code=exited, status=0/SUCCESS)
Mar 08 16:59:53 vps584959 systemd[1]: Starting PostgreSQL Cluster 10-main...
Mar 08 16:59:53 vps584959 postgresql#10-main[31635]: Error: /usr/lib/postgresql/10/bin/pg_ctl /usr/lib/postgresql/10/bin/pg_ctl start -D /var/lib/postgresql/10/main -l /var/log/postgre
Mar 08 16:59:53 vps584959 systemd[1]: postgresql#10-main.service: Can't open PID file /var/run/postgresql/10-main.pid (yet?) after start: No such file or directory
Mar 08 16:59:53 vps584959 systemd[1]: postgresql#10-main.service: Failed with result 'protocol'.
Mar 08 16:59:53 vps584959 systemd[1]: Failed to start PostgreSQL Cluster 10-main.
Don't know what to do more. Is anybody had the same problem?
More infos.
root#ip_address:/var/run/postgresql# ls
total 0
drwxrwsr-x 3 postgres postgres 60 Feb 19 06:47 .
drwxr-xr-x 28 root root 1060 Mar 8 13:58 ..
drwxr-s--- 2 postgres postgres 40 Feb 19 06:47 10-main.pg_stat_tmp
pg_ctlcluster 10 main start
Error: Config owner (deploy:1003) and data owner (postgres:114) do not match, and config owner is not root
That's pretty clear, isn't it?
The Ubuntu PostgreSQL startup script wants that postgresql.conf and/or pg_hba.conf be owned by user postgres, else it refuses to proceed.

Postgresql Start failed

psql (PostgreSQL) 9.5.5
sorry for my eng lang.
can't connect to DataBase.
postgresql.service - LSB: PostgreSQL RDBMS server
Loaded: loaded (/etc/init.d/postgresql; bad; vendor preset: enabled)
Active: active (exited) since Thu 2016-12-01 00:53:23 UTC; 2s ago
Docs: man:systemd-sysv-generator(8)
Process: 25257 ExecStop=/etc/init.d/postgresql stop (code=exited, status=0/SUCCESS)
Process: 24764 ExecReload=/etc/init.d/postgresql reload (code=exited, status=0/SUCCESS)
Process: 25293 ExecStart=/etc/init.d/postgresql start (code=exited, status=0/SUCCESS)
Main PID: 1058 (code=exited, status=0/SUCCESS)
Dec 01 00:53:23 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting LSB: PostgreSQL RDBMS server...
Dec 01 00:53:23 Ubuntu-1604-xenial-64-minimal systemd[1]: Started LSB: PostgreSQL RDBMS server.
Try to connect:
psql -h localhost -p 5432 -U postgres -W
Password for user postgres:
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
In my postgresql.conf i have listen all = '*' and port 5432
sudo netstat -pant | grep postgres - nothing show
root#Ubuntu-1604-xenial-64-minimal /var/log # tail postgresql/postgresql-9.5-main.log
2016-11-28 23:58:21 UTC [897-3] LOG: invalid record length at 0/14CC9C90
2016-11-28 23:58:21 UTC [897-4] LOG: redo is not required
2016-11-28 23:58:21 UTC [897-5] LOG: MultiXact member wraparound protections are now enabled
2016-11-28 23:58:21 UTC [847-1] LOG: database system is ready to accept connections
2016-11-28 23:58:21 UTC [909-1] LOG: autovacuum launcher started
2016-11-28 23:58:21 UTC [915-1] [unknown]#[unknown] LOG: incomplete startup packet
2016-11-29 22:43:00 UTC [847-2] LOG: received smart shutdown request
2016-11-29 22:43:00 UTC [909-2] LOG: autovacuum launcher shutting down
2016-11-29 22:43:00 UTC [906-1] LOG: shutting down
2016-11-29 22:43:00 UTC [906-2] LOG: database system is shut down
postgres#Ubuntu-1604-xenial-64-minimal:~/9.5/main$ ls
base global pg_clog pg_commit_ts pg_dynshmem pg_logical pg_multixact pg_notify pg_replslot pg_serial pg_snapshots pg_stat pg_stat_tmp pg_subtrans pg_tblspc pg_twophase PG_VERSION pg_xlog postgresql.auto.conf postmaster.opts
And
root#Ubuntu-1604-xenial-64-minimal ~ # sudo systemctl start postgresql
root#Ubuntu-1604-xenial-64-minimal ~ # sudo su - postgres -c psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
After reboot check status
● postgresql.service - LSB: PostgreSQL RDBMS server
Loaded: loaded (/etc/init.d/postgresql; bad; vendor preset: enabled)
Active: active (exited) since Thu 2016-12-01 02:21:43 UTC; 13min ago
Docs: man:systemd-sysv-generator(8)
Dec 01 02:21:43 Ubuntu-1604-xenial-64-minimal systemd[1]: Starting LSB: PostgreSQL RDBMS server...
Dec 01 02:21:43 Ubuntu-1604-xenial-64-minimal systemd[1]: Started LSB: PostgreSQL RDBMS server.
Dec 01 02:25:56 Ubuntu-1604-xenial-64-minimal systemd[1]: Started LSB: PostgreSQL RDBMS server.
I would look at /var/log to see if it wrote a log.
If it did not, I would attempt to start it manually to the database:
su - postgres
postgres -d 5 -D /var/db/postgres/data96
The -d 5 command sets debugging to level 5. The -D command tells PostgreSQL where the database files are. The above directory is the location where PostgreSQL 9.6 runs on FreeBSD. If you are running Ubuntu, the directory should be /var/lib/postgresql/[PostgreSQL version]/data/. The PostgreSQL default data directory is /usr/local/pgsql/data.

cannot get mongodb connected with scrapy-linkedin

Mon Oct 31 18:40:34 [initandlisten] fd limit hard:1024 soft:1024 max conn: 819
Mon Oct 31 18:40:34 [initandlisten] waiting for connections on port 27017
Mon Oct 31 18:40:34 BackgroundJob starting: snapshot
Mon Oct 31 18:40:34 BackgroundJob starting: ClientCursorMonitor
Mon Oct 31 18:40:34 BackgroundJob starting: PeriodicTask::Runner
Mon Oct 31 18:40:34 [websvr] fd limit hard:1024 soft:1024 max conn: 819
Mon Oct 31 18:40:34 [websvr] admin web console waiting for connections on port 28017
the command prompt gets hung up for so much time as i start mongod.exe
i have made the directory data\db as well
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#mongodb-as-a-windows-service