I installed Postgres 12.3 from source code with steps(according to this):
./configure --with-openssl --with-systemd
make
sudo make install
If I start with pg_ctl from postgres user all works fine:
pg_ctl -D $PGDATA -l /path/to/logfile
Then I try to create a systemd service, as described here.
Steps:
Create file /etc/systemd/system/postgresql.service with content:
[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)
[Service]
Type=notify
User=postgres
ExecStart=/usr/local/pgsql/bin/postgres -D /path/to/pgdata
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
[Install]
WantedBy=multi-user.target
sudo systemctl enable postgresql.service
Then I reboot my machine.
After restart Postgres unavaliable. Some logs:
sudo systemctl status postgresql.service
postgresql.service - PostgreSQL database server
Loaded: loaded (/etc/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2020-06-05 03:23:32 MSK; 37s ago
Docs: man:postgres(1)
Process: 724 ExecStart=/usr/local/pgsql/bin/postgres -D /path/to/pgdata (code=exited, status=1/FAILURE)
Main PID: 724 (code=exited, status=1/FAILURE)
Jun 05 03:23:31 ctsvc systemd[1]: Starting PostgreSQL database server...
Jun 05 03:23:32 ctsvc systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
Jun 05 03:23:32 ctsvc systemd[1]: Failed to start PostgreSQL database server.
Jun 05 03:23:32 ctsvc systemd[1]: postgresql.service: Unit entered failed state.
Jun 05 03:23:32 ctsvc systemd[1]: postgresql.service: Failed with result 'exit-code'.
journalctl -xe | grep postgres
-- Subject: Unit postgresql.service has begun start-up
-- Unit postgresql.service has begun starting up.
Jun 05 03:23:32 ctsvc postgres[724]: 2020-06-05 03:23:32.209 MSK [724] LOG: starting PostgreSQL 12.3 on armv7l-unknown-linux-gnueabihf, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 32-bit
Jun 05 03:23:32 ctsvc postgres[724]: 2020-06-05 03:23:32.211 MSK [724] LOG: could not bind IPv4 address "172.17.17.42": Cannot assign requested address
Jun 05 03:23:32 ctsvc postgres[724]: 2020-06-05 03:23:32.211 MSK [724] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
Jun 05 03:23:32 ctsvc postgres[724]: 2020-06-05 03:23:32.211 MSK [724] WARNING: could not create listen socket for "172.17.17.42"
Jun 05 03:23:32 ctsvc postgres[724]: 2020-06-05 03:23:32.211 MSK [724] FATAL: could not create any TCP/IP sockets
Jun 05 03:23:32 ctsvc postgres[724]: 2020-06-05 03:23:32.212 MSK [724] LOG: database system is shut down
Jun 05 03:23:32 ctsvc systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit postgresql.service has failed
-- Unit postgresql.service has failed.
Jun 05 03:23:32 ctsvc systemd[1]: postgresql.service: Unit entered failed state.
Jun 05 03:23:32 ctsvc systemd[1]: postgresql.service: Failed with result 'exit-code'.
Jun 05 03:24:09 ctsvc sudo[1602]: user1 : TTY=pts/0 ; PWD=/home/user1 ; USER=root ; COMMAND=/bin/systemctl status postgresql.service
netstat -tnl | grep "5432" - shows nothing.
After that I can manualy run this service:
sudo systemctl status postgresql.service
● postgresql.service - PostgreSQL database server
Loaded: loaded (/etc/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2020-06-05 03:30:57 MSK; 8s ago
Docs: man:postgres(1)
Main PID: 1681 (postgres)
Tasks: 8 (limit: 4915)
CGroup: /system.slice/postgresql.service
├─1681 /usr/local/pgsql/bin/postgres -D /path/to/pgdata
├─1683 postgres: checkpointer
├─1684 postgres: background writer
├─1685 postgres: walwriter
├─1686 postgres: autovacuum launcher
├─1687 postgres: stats collector
├─1688 postgres: logical replication launcher
└─1693 postgres: postgres postgres 172.17.17.40(53600) idle
Jun 05 03:30:56 ctsvc systemd[1]: Starting PostgreSQL database server...
Jun 05 03:30:57 ctsvc postgres[1681]: 2020-06-05 03:30:57.006 MSK [1681] LOG: starting PostgreSQL 12.3 on armv7l-unknown-linux-gnueabihf, compiled b
Jun 05 03:30:57 ctsvc postgres[1681]: 2020-06-05 03:30:57.007 MSK [1681] LOG: listening on IPv4 address "172.17.17.42", port 5432
Jun 05 03:30:57 ctsvc postgres[1681]: 2020-06-05 03:30:57.032 MSK [1681] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
Jun 05 03:30:57 ctsvc postgres[1681]: 2020-06-05 03:30:57.424 MSK [1682] LOG: database system was shut down at 2020-06-05 02:59:03 MSK
Jun 05 03:30:57 ctsvc postgres[1681]: 2020-06-05 03:30:57.725 MSK [1681] LOG: database system is ready to accept connections
Jun 05 03:30:57 ctsvc systemd[1]: Started PostgreSQL database server.
netstat -tnl | grep '5432'
tcp 0 0 172.17.17.42:5432 0.0.0.0:* LISTEN
In my postgresql.conf I have following:
# - Connection Settings -
listen_addresses = '172.17.17.42'
port = 5432
max_connections = 100
If it helps: Postgres runs on Cubietruck with Armbian.
uname -a
Linux ctsvc 4.19.62-sunxi #5.92 SMP Wed Jul 31 22:07:23 CEST 2019 armv7l GNU/Linux
In my system there are no more processes that try to bind this port at boot time. As far as I understand, with the service itself and Postgresql everything is fine. However, something strange happens during the launch, but I can’t understand how to find out the reason of this behavior.
Thanks in advance.
Finally my file /etc/systemd/system/postgresql.service looks like this:
[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=notify
User=postgres
ExecStart=/usr/local/pgsql/bin/postgres -D /path/to/pgdata
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
[Install]
WantedBy=multi-user.target
Thanks to Laurenz Albe comment, I added following in Unit section:
Wants=network-online.target
After=network.target network-online.target
to make sure that network fully operational before PG start. After this PG running correctly after reboot.
I am installing rabbitMQ on ubuntu16.04. But I am getting below error. I tries searching for it but not able to resolve it.
Adding group `rabbitmq' (GID 131) ...
Done.
Adding system user `rabbitmq' (UID 123) ...
Adding new user `rabbitmq' (UID 123) with group `rabbitmq' ...
Not creating home directory `/var/lib/rabbitmq'.
Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.
invoke-rc.d: initscript rabbitmq-server, action "start" failed.
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2018-07-05 12:21:02 IST; 3ms ago
Process: 9259 ExecStop=/bin/sh -c while ps -p $MAINPID >/dev/null 2>&1; do sleep 1; done (code=exited, status=0/SUCCESS)
Process: 9107 ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
Process: 8788 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 8788 (code=exited, status=1/FAILURE)
Jul 05 12:21:02 sumit-precision-7520 systemd[1]: Failed to start RabbitMQ broker.
Jul 05 12:21:02 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jul 05 12:21:02 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
dpkg: error processing package rabbitmq-server (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
rabbitmq-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
When I run following command.
systemctl status rabbitmq-server.service
Output:
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2018-07-05 12:21:26 IST; 8s ago
Process: 10278 ExecStop=/bin/sh -c while ps -p $MAINPID >/dev/null 2>&1; do sleep 1; done (code=exited, status=0/SUCCESS)
Process: 10127 ExecStop=/usr/lib/rabbitmq/bin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
Process: 9805 ExecStart=/usr/lib/rabbitmq/bin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 9805 (code=exited, status=1/FAILURE)
Jul 05 12:21:26 sumit-precision-7520 systemd[1]: Failed to start RabbitMQ broker.
Jul 05 12:21:26 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jul 05 12:21:26 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
My host entries are :
127.0.0.1 localhost
127.0.1.1 sumit-precision-7520
Also when I checked this /var/log/rabbitmq/ Path, there is no file in it.
Why I am getting this output. How can I resolve it.
Edit
Output of following commands
CMD: journalctl -xe
-- Unit rabbitmq-server.service has begun starting up.
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: BOOT FAILED
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: ===========
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Error description:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: noproc
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Log files (may contain more information):
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: /var/log/rabbitmq/rabbit#sumit-precision-7520.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: /var/log/rabbitmq/rabbit#sumit-precision-7520-sasl.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Stack trace:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: [{gen,do_for_proc,2,[{file,"gen.erl"},{line,228}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {gen_event,rpc,2,[{file,"gen_event.erl"},{line,239}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {rabbit,ensure_working_log_handlers,0,
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: [{file,"src/rabbit.erl"},{line,856}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,288}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,424}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {init,start_em,1,[]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {init,do_boot,3,[]}]
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: =INFO REPORT==== 10-Jul-2018::11:29:58.597458 ===
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Error description:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: noproc
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Log files (may contain more information):
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: /var/log/rabbitmq/rabbit#sumit-precision-7520.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: /var/log/rabbitmq/rabbit#sumit-precision-7520-sasl.log
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: Stack trace:
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: [{gen,do_for_proc,2,[{file,"gen.erl"},{line,228}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {gen_event,rpc,2,[{file,"gen_event.erl"},{line,239}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {rabbit,ensure_working_log_handlers,0,
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: [{file,"src/rabbit.erl"},{line,856}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,288}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,424}]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {init,start_em,1,[]},
Jul 10 11:29:58 sumit-precision-7520 rabbitmq-server[29523]: {init,do_boot,3,[]}]
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: {"init terminating in do_boot",noproc}
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: init terminating in do_boot (noproc)
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: [1B blob data]
Jul 10 11:29:59 sumit-precision-7520 rabbitmq-server[29523]: Crash dump is being written to: erl_crash.dump...done
Jul 10 11:29:59 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Main process exited, code=exited, status=1/FAILURE
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: Stopping and halting node 'rabbit#sumit-precision-7520'
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: Error: unable to connect to node 'rabbit#sumit-precision-7520': nodedown
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: DIAGNOSTICS
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: ===========
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: attempted to contact: ['rabbit#sumit-precision-7520']
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: rabbit#sumit-precision-7520:
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: * connected to epmd (port 4369) on sumit-precision-7520
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: * epmd reports: node 'rabbit' not running at all
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: no other nodes on sumit-precision-7520
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: * suggestion: start the node
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: current node details:
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: - node name: 'rabbitmq-cli-19#sumit-precision-7520'
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: - home dir: /var/lib/rabbitmq
Jul 10 11:30:00 sumit-precision-7520 rabbitmqctl[29847]: - cookie hash: Yz59fP8Pd/2GV5iaJa/Xng==
Jul 10 11:30:00 sumit-precision-7520 systemd[1]: Failed to start RabbitMQ broker.
-- Subject: Unit rabbitmq-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit rabbitmq-server.service has failed.
--
-- The result is failed.
Jul 10 11:30:00 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Unit entered failed state.
Jul 10 11:30:00 sumit-precision-7520 systemd[1]: rabbitmq-server.service: Failed with result 'exit-code'.
CMD: /usr/sbin/rabbitmq-server as root
BOOT FAILED
===========
Error description:
noproc
Log files (may contain more information):
/var/log/rabbitmq/rabbit#sumit-precision-7520.log
/var/log/rabbitmq/rabbit#sumit-precision-7520-sasl.log
Stack trace:
[{gen,do_for_proc,2,[{file,"gen.erl"},{line,228}]},
{gen_event,rpc,2,[{file,"gen_event.erl"},{line,239}]},
{rabbit,ensure_working_log_handlers,0,
[{file,"src/rabbit.erl"},{line,856}]},
{rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,288}]},
{rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,424}]},
{init,start_em,1,[]},
{init,do_boot,3,[]}]
=INFO REPORT==== 10-Jul-2018::11:33:14.902211 ===
Error description:
noproc
Log files (may contain more information):
/var/log/rabbitmq/rabbit#sumit-precision-7520.log
/var/log/rabbitmq/rabbit#sumit-precision-7520-sasl.log
Stack trace:
[{gen,do_for_proc,2,[{file,"gen.erl"},{line,228}]},
{gen_event,rpc,2,[{file,"gen_event.erl"},{line,239}]},
{rabbit,ensure_working_log_handlers,0,
[{file,"src/rabbit.erl"},{line,856}]},
{rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,288}]},
{rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,424}]},
{init,start_em,1,[]},
{init,do_boot,3,[]}]
{"init terminating in do_boot",noproc}
init terminating in do_boot (noproc)
Crash dump is being written to: erl_crash.dump...done
I have also checked for the log file at location /var/log/rabbitmq/rabbit#sumit-precision-7520.log
but no log file is generated.
Edit 2
Installation procedure:
$ wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
$ sudo dpkg -i erlang-solutions_1.0_all.deb
$ sudo apt-get update
$ sudo apt-get install esl-erlang
$ echo "deb http://www.rabbitmq.com/debian/ testing main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list > /dev/null
$ sudo wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
$ sudo apt-key add rabbitmq-signing-key-public.asc
$ sudo apt-get update
$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 6B73A36E6026DFCA
$ sudo apt-get update
$ sudo apt-get install rabbitmq-server
Before installing erlang and rabbitmq-server, I have installed LAMP(Apache, Mysql and PHP7.0) and node.js.
I have install the same before and it was working fine. I don't understand what I am missing here.
You should install RabbitMQ with version that is compatible with version of installed Erlang.
RabbitMQ Erlang version requirements you can find here: https://www.rabbitmq.com/which-erlang.html#compatibility-matrix
To get Erlang version type in Terminal:
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
Remove previous RabbitMQ installed:
$ sudo apt-get purge rabbitmq-server
$ sudo rm -fr /var/lib/rabbitmq/
To install appropriate version of RabbitMQ you should do it from repo:
https://www.rabbitmq.com/install-debian.html#manual-installation
In my case (Erlang v21) required version of RabbitMQ is 3.7.17:
$ sudo apt-get -y install socat logrotate init-system-helpers adduser
$ cd /opt/tools/
$ sudo wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.17/rabbitmq-server_3.7.17-1_all.deb
$ sudo dpkg -i rabbitmq-server_3.7.17-1_all.deb
$ sudo rm rabbitmq-server_3.7.17-1_all.deb
I had exactly the same problem when installed from the repository. Resolved by installing both Erlang and RabbitMQ from the .deb files, according to the manual on the official site:
https://www.rabbitmq.com/install-debian.html
Here is a Vagrantfile that is guaranteed to work - I just tested it:
https://gist.github.com/lukebakken/44f2fe3770d43dd12acfe6dfbc1818d3
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
I have also met with the same error while trying to start service after finishing install using apt-get install method. Followed the documentation in the below url.
I could understand that the debain9 installs has the same issue.
https://tecadmin.net/install-rabbitmq-server-debian/
root#rabbitmq:/var/log/rabbitmq# cat startup_log
BOOT FAILED
===========
Error description:
noproc
Log files (may contain more information):
/var/log/rabbitmq/rabbit#rabbitmq.log
/var/log/rabbitmq/rabbit#rabbitmq-sasl.log
I have managed to resolve the case by following dpkg -i installation steps, Below are the steps I have followed.
apt-get purge rabbitmq-server
apt-get purge erlang
apt-get autoremove
reboot
installation via dpkg method which solved the problem
Dependencies that need to be fixed before dpkg method.
apt-get -y install socat logrotate init-system-helpers adduser
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.15/rabbitmq-server_3.7.15-1_all.deb
/etc/init.d/rabbitmq-server start
And service has started good.
PS:This is probably stale by now but let me just add it for someone who is currently facing this issue.
Ensure that there is no process running on port 5672. This error can be common when you are trying to run multiple message brokers on the same JVM. In my case I had to modify activemq ports and let rabbitmq utilize the default port.
We have an application that is running on RHEL6/32 bit and RHEL6/64 bit. This application uses postgresql 8.4 from the beginning. Now, we want to provide support for this application on RHEL7/64 bit. RHEL7 comes with default postgresql 9.2 in its yum list and this is getting installed and its related services are running properly as well. But after installing postgresql 8.4 on RHEL7, it seems like the services are never running. Please find below the logs:
[root#linpubn218 postgres]# service postgresql status
postgresql.service - SYSV: PostgreSQL database server.
Loaded: loaded (/etc/rc.d/init.d/postgresql)
Active: failed (Result: resources) since Mon 2016-07-25 12:40:28 IST; 2h 0min ago
Docs: man:systemd-sysv-generator(8)
Jul 25 12:40:26 linpubn218.gl.avaya.com systemd[1]: Starting SYSV: PostgreSQL database server....
Jul 25 12:40:28 linpubn218.gl.avaya.com postgresql[26957]: Starting postgresql service: [ OK ]
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: PID file /var/run/postmaster-8.4.pid not readable (yet?) after start.
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: Failed to start SYSV: PostgreSQL database server..
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service entered failed state.
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: postgresql.service failed.
Jul 25 14:33:45 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service cannot be reloaded because it is inactive.
Jul 25 14:33:45 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service cannot be reloaded because it is inactive.
After looking at the logs in journalctl -xe
[root#linpubn218 postgres]# journalctl -xe
Jul 25 14:39:21 linpubn218.gl.avaya.com yum[29260]: Installed: postgresql84-libs-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:39:45 linpubn218.gl.avaya.com yum[29275]: Installed: postgresql84-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:40:01 linpubn218.gl.avaya.com useradd[29316]: failed adding user 'postgres', exit code: 9
Jul 25 14:40:02 linpubn218.gl.avaya.com CROND[29320]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 25 14:40:02 linpubn218.gl.avaya.com systemd[1]: Reloading.
Jul 25 14:40:03 linpubn218.gl.avaya.com systemd[1]: Configuration file /usr/lib/systemd/system/auditd.service is marked world-inaccessible. This has no effect as config
Jul 25 14:40:03 linpubn218.gl.avaya.com yum[29309]: Installed: postgresql84-server-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:42:05 linpubn218.gl.avaya.com polkitd[819]: Registered Authentication Agent for unix-process:29459:43987285 (system bus name :1.292 [/usr/bin/pkttyagent --not
Jul 25 14:42:05 linpubn218.gl.avaya.com systemd[1]: Starting SYSV: PostgreSQL database server....
Jul 25 14:42:06 linpubn218.gl.avaya.com runuser[29473]: pam_unix(runuser-l:session): session closed for user postgres
Jul 25 14:42:08 linpubn218.gl.avaya.com postgresql[29464]: Starting postgresql service: [ OK ]
Jul 25 14:42:08 linpubn218.gl.avaya.com systemd[1]: PID file /var/run/postmaster-8.4.pid not readable (yet?) after start.
Jul 25 14:42:08 linpubn218.gl.avaya.com systemd[1]: Failed to start SYSV: PostgreSQL database server..
Can postgresql 8.4 be installed on RHEL7, which is a systemd based OS? If yes, then what should I do to remove the above error?
I noticed that in /etc/init.d/postgresql-8.4 there is a declared variable:
pidfile="/var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid"
But in systemctl, PIDfile is not the same:
# systemctl show postgresql-8.4.service -p PIDFile
PIDFile=/var/run/postmaster-8.4.pid
So, to fix the problem edit /etc/init.d/postgresql-8.4 and replace
pidfile="/var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid"
with
pidfile="/var/run/postmaster-${PGMAJORVERSION}.pid"
then reload systemctl:
# systemctl daemon-reload
#/etc/init.d/postgresql-8.4 start
Starting postgresql-8.4 (via systemctl): [ OK ]
Generally permissions caused this type of error
su - postgres
After that:
chmod 700 -R <data_directory>
And you should check SELinux as well.
I started my mongo with the following command:
[lucas#ecoinstance]~/node/nodetest2$ sudo mongod --dbpath /home/lucas/node/nodetest2/data
2014-06-07T08:46:30.507+0000 [initandlisten] MongoDB starting : pid=6409 port=27017 dbpat
h=/home/lucas/node/nodetest2/data 64-bit host=ecoinstance
2014-06-07T08:46:30.508+0000 [initandlisten] db version v2.6.1
2014-06-07T08:46:30.508+0000 [initandlisten] git version: 4b95b086d2374bdcfcdf2249272fb55
2c9c726e8
2014-06-07T08:46:30.508+0000 [initandlisten] build info: Linux build14.nj1.10gen.cc 2.6.3
2-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-06-07T08:46:30.509+0000 [initandlisten] allocator: tcmalloc
2014-06-07T08:46:30.509+0000 [initandlisten] options: { storage: { dbPath: "/home/lucas/n
ode/nodetest2/data" } }
2014-06-07T08:46:30.520+0000 [initandlisten] journal dir=/home/lucas/node/nodetest2/data/
journal
2014-06-07T08:46:30.520+0000 [initandlisten] recover : no journal files present, no recov
ery needed
2014-06-07T08:46:30.527+0000 [initandlisten] waiting for connections on port 27017
It appears to be working, as I can execute mongo and access the server. However, here are the process running mongo:
[lucas#ecoinstance]~/node/testSite$ ps aux | grep mongo
root 6540 0.0 0.2 33424 1664 pts/3 S+ 08:52 0:00 sudo mongod --dbpath /ho
me/lucas/node/nodetest2/data
root 6541 0.6 8.6 522140 52512 pts/3 Sl+ 08:52 0:00 mongod --dbpath /home/lu
cas/node/nodetest2/data
lucas 6554 0.0 0.1 7836 876 pts/4 S+ 08:52 0:00 grep mongo
As you can see, there are two PID's for mongo. Before I ran sudo mongod --dbpath /home/lucas/node/nodetest2/data, there were none (besides the grep of course). How did my command spawn two PID's, and should I be concerned? Any suggestions or tips would be great.
Additional Info
In addition, I may have other issues that might suggest a cause. I tried running mongo with --fork --logpath /home/lucas..., but it did not work. More information below:
[lucas#ecoinstance]~/node/nodetest2$ sudo mongod --dbpath /home/lucas/node/nodetest2/data
--fork --logpath /home/lucas/node/nodetest2/data/
about to fork child process, waiting until server is ready for connections.
forked process: 6578
ERROR: child process failed, exited with error number 1
[lucas#ecoinstance]~/node/nodetest2$ ls -l data/
total 163852
drwxr-xr-x 2 mongodb nogroup 4096 Jun 7 08:54 journal
-rw------- 1 mongodb nogroup 67108864 Jun 7 08:52 local.0
-rw------- 1 mongodb nogroup 16777216 Jun 7 08:52 local.ns
-rwxr-xr-x 1 mongodb nogroup 0 Jun 7 08:54 mongod.lock
-rw------- 1 mongodb nogroup 67108864 Jun 7 02:08 nodetest1.0
-rw------- 1 mongodb nogroup 16777216 Jun 7 02:08 nodetest1.ns
Also, my db path folder is not the original location. It was originally created under the default /var/lib/mongodb/ and moved to my local data folder. This was done after shutting down the server via /etc/init.d/mongod stop.
I have a Debian Wheezy server, if it matters.
Regarding the 2 processes with the mongod in them after using sudo to run mongod, that is normal. That is how sudo runs. The actual mongod process that is running the database and that you are connecting to with mongo is
root 6541 0.6 8.6 522140 52512 pts/3 Sl+ 08:52 0:00
mongod --dbpath /home/lu cas/node/nodetest2/data
You can always check this by looking at the mongod.lock file in your dbpath - in your case it should be in
/home/lucas/node/nodetest2/data
Regarding your attempt to fork and use a logpath, you are setting up logpath incorrectly. It needs to be a file name, not a directory. Something like:
--logpath /var/log/mongodb/mongo.log