PostgreSQL starts for a few minutes, then fails - database

I recently moved my PostgreSQL data_directory from /var/lib/pgsql/data to /home/databasepostgre/. I have followed these steps from
$sudo systemctl stop postgresql-9.4.service
edit postgresql.conf data_directory to /home/databasepostgre/pgsql/9.4/data
$sudo rsync -av /var/lib/pgsql/9.4/data /home/databasepostgre/pgsql/9.4/data
$su postgres
psql
SHOW data_directory; "it shows new directory which is /home/databasepostgre/pgsql/9.4/data"
systemctl start service
But each time i execute step #6, I always end up with this error :
Job for postgresql-9.4.service failed because a timeout was exceeded. See systemctl status postgresql-9.4.service and journalctl -xe for details.
From journalctl -xe the error is as follows:
May 11 13:35:04 systemd[1]: postgresql-9.4.service start operation timed out. Terminating.
May 11 13:35:04 systemd[1]: Failed to start PostgreSQL 9.4 database server.
-- Subject: Unit postgresql-9.4.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql-9.4.service has failed.
--
-- The result is failed.
May 11 13:35:04 systemd[1]: Unit postgresql-9.4.service entered failed state.
May 11 13:35:04 systemd[1]: postgresql-9.4.service failed.
Can anyone please help me? This is a production server and I still cannot find the issue and how to solve it.

Related

pgbouncer fails to start when configured to dockerized postgres

I am trying to configuer pgbouncer for the first time.
My postgres DB is running as a container (with port 5011)
My OS is debian 10.
I used apt-install to install pgbouncer:
sudo apt-get install pgbouncer
and then could see that pgbouncer status was OK:
# sudo systemctl status pgbouncer
● pgbouncer.service - LSB: start pgbouncer
Loaded: loaded (/etc/init.d/pgbouncer; generated)
Active: active (running) since Wed 2021-05-26 16:15:49 IDT; 11min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 2 (limit: 4915)
Memory: 2.4M
CGroup: /system.slice/pgbouncer.service
└─4392 /usr/sbin/pgbouncer -d /etc/pgbouncer/pgbouncer.ini
my database name is mydb, postgres container is running on port 5011, so I configured /etc/pgbouncer/pgbouncer.ini like this:
[databases]
octopus-bouncer = host=10.1.1.1 port=5011 user=dbauser dbname=mydb
;; Configuration section
[pgbouncer]
auth_file = userlist.txt
; IP address or * which means all IPs
listen_addr = *
listen_port = 6432
; any, trust, plain, crypt, md5, cert, hba, pam
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
; total number of clients that can connect
max_client_conn = 100
; default pool size. 20 is good number when transaction pooling
; is in use, in session pooling it needs to be the number of
; max clients you want to handle at any moment
default_pool_size = 20
I finally put my user to /etc/pgbouncer/userlist.txt:
"dbauser" "mypassword"
Then I restarted pgbouncer - but failed:
# sudo systemctl restart pgbouncer
Job for pgbouncer.service failed because the control process exited with error code.
See "systemctl status pgbouncer.service" and "journalctl -xe" for details.
status shows only this:
# sudo systemctl status pgbouncer
● pgbouncer.service - LSB: start pgbouncer
Loaded: loaded (/etc/init.d/pgbouncer; generated)
Active: failed (Result: exit-code) since Wed 2021-05-26 17:04:00 IDT; 2min 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 28111 ExecStart=/etc/init.d/pgbouncer start (code=exited, status=1/FAILURE)
May 26 17:04:00 Octopus systemd[1]: Starting LSB: start pgbouncer...
May 26 17:04:00 Octopus pgbouncer[28111]: Starting PgBouncer: pgbouncer failed!
May 26 17:04:00 Octopus systemd[1]: pgbouncer.service: Control process exited, code=exited, status=1/FAILURE
May 26 17:04:00 Octopus systemd[1]: pgbouncer.service: Failed with result 'exit-code'.
May 26 17:04:00 Octopus systemd[1]: Failed to start LSB: start pgbouncer.
Am I missing something?
How can I debug the problem?
You can add KillSignal=SIGINT to service unit file:
cat /usr/lib/systemd/system/pgbouncer.service
[Unit]
Description=A lightweight connection pooler for PostgreSQL
Documentation=man:pgbouncer(1)
After=syslog.target network.target
[Service]
RemainAfterExit=yes
User=postgres
Group=postgres
# Path to the init file
Environment=BOUNCERCONF=/etc/pgbouncer/pgbouncer.ini
#Environment=SYSTEMD_LOG_LEVEL=debug
ExecStart=/usr/bin/pgbouncer -q ${BOUNCERCONF}
ExecReload=/usr/bin/pgbouncer -R -q ${BOUNCERCONF}
KillSignal=SIGINT
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300
[Install]
WantedBy=multi-user.target
from pgbouncer man:
Signals
SIGHUP Reload config. Same as issuing the command RELOAD on the console.
SIGINT Safe shutdown. Same as issuing PAUSE and SHUTDOWN on the console.

No module named _dbus_bindings fedora 34

This morning I restarted the computer and I found that System Security Services Daemon(SSSD) and Firewalld services didnt start, so I used systemctl status to view the problem and I got
Firewalld:
>systemd[1]: Starting firewalld - dynamic firewall daemon... \
>python3[7218]: detected unhandled Python exception in '/usr/sbin/firewalld' \
>systemd[1]: firewalld.service: Main process exited, code=exited, status=1/FAILURE \
>systemd[1]: firewalld.service: Failed with result 'exit-code'. \
>systemd[1]: Failed to start firewalld - dynamic firewall daemon.
SSSD:
>systemd[1]: sssd.service: Scheduled restart job, restart counter is at 10. \
>systemd[1]: Stopped System Security Services Daemon. \
>systemd[1]: sssd.service: Start request repeated too quickly. \
>systemd[1]: sssd.service: Failed with result 'exit-code'. \
>systemd[1]: Failed to start System Security Services Daemon.
Then I tried opening Automatic Bug Reporting tool(ABRT) and it didnt open, so I used terminal to open and found this
I recently updated all apps using "dnf update" and Python 3.9.5(FYI do not know if this was the cause) was one of them.
I tried to run firewalld manually using terminal using the command "firewalld"
So I restarted the computer, and then fsck failed, so the system automatically went to emergency mode, then it cleared some parts, and I rebooted using the terminal in the emergency mode
Firewalld and SSSD still failed and its because of DBus
What should I do now?
Thanks in Advance

Failed Start for Microsoft SQL Server Database Engine on Linux

I have installed mssql on Ubuntu 16.04. following are the details of sql server.
ms sql (14.0.3015.40-1) i.e SQL server 2017.
when I run the configuration command #sudo /opt/mssql/bin/sqlservr-setup
I got error sudo: /opt/mssql/bin/sqlservr-setup: command not found
I have stopped and restarted but of no use.
When I check the status by command #systemctl status mssql-server
I got
mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2018-02-02 16:15:29 IST; 4min 20s ago
Docs: https://learn.microsoft.com/en-us/sql/linux
Process: 28050 ExecStart=/opt/mssql/bin/sqlservr (code=exited, status=200/CHDIR)
Main PID: 28050 (code=exited, status=200/CHDIR)
Feb 02 16:15:28 chetan-desktop systemd[1]: mssql-server.service: Unit entered failed state.
Feb 02 16:15:28 chetan-desktop systemd[1]: mssql-server.service: Failed with result 'exit-code'.
Feb 02 16:15:29 chetan-desktop systemd[1]: mssql-server.service: Service hold-off time over, scheduling restart.
Feb 02 16:15:29 chetan-desktop systemd[1]: Stopped Microsoft SQL Server Database Engine.
Feb 02 16:15:29 chetan-desktop systemd[1]: mssql-server.service: Start request repeated too quickly.
Feb 02 16:15:29 chetan-desktop systemd[1]: Failed to start Microsoft SQL Server Database Engine.
I have googled and tried all possible options. But unable to start SQL server.
Please guide me through this.
I had the same two problems.
First, I was referencing very old documentation that applied to an early (preview) release for RHEL, and so I was using the wrong command. The correct command is:
/opt/mssql/bin/mssql-conf setup
Second, the service was failing to start because my virtual machine did not have enough RAM available (SQL Server on Linux requires at least 2GiB of RAM available.) The documentation I was referred to incorrectly stated that only 0.5GiB was required, this is incorrect and journalctl was not providing any useful information about the start failure.
After configuring available memory to 2GiB and using the correct mssql-conf command I was able to successfully configure and start an MSSQL Server instance on Linux.
References:
Configure SQL Server on Linux with the mssql-conf tool (Microsoft Docs)
KB052969: FIX: Minimum memory limit set to 2GB to install or start SQL Server 2017 (Microsoft Support)
Installation guidance for SQL Server on Linux (Microsoft Docs)
The error says that the executable wasn't found in this path, not that the service couldn't start.
According to the installation instructions for Ubuntu you need to run mssql-conf setup to configure the server :
sudo /opt/mssql/bin/mssql-conf setup
not sqlservr-setup
Increasing the RAM size to 3GB on my VM resolved the issue for me.

Linux MS SQL Server evaluation expired, can't upgrade to developer

When I installed MS SQL Server for Linux half a year ago, there was no way to choose between evaluation and developer. Now the evaluation period has expired and I can't install a developer version. I don't care about any of my databases and I have tried to remove SQL Server before installing it again. The installation is fine but when I run mssql-conf setup I get the following:
Configuring SQL Server...
Error: The evaluation period has expired.
This program has encountered a fatal error and cannot continue running.
The following diagnostic information is available:
Reason: 0x00000001
Signal: SIGSEGV - Segmentation fault (11)
Stacktrace: 0000564434051ee7 00007f9892387b20 00005644340236c2
000056443404a8db 000056443404a059
Process: 7228 - sqlservr
Thread: 7253 (application thread 0x1060)
Instance Id: 357ebf86-214d-4100-b14f-cb62b380917e
Crash Id:
Build stamp: 3db4cdd88f9bbf816f82e0ab6e17825a0a0f8b2ef98a5c67b521be0ed19c297c
/opt/mssql/lib/mssql-conf/invokesqlservr.sh: line 15: 7227 Aborted sudo -EH -u mssql /bin/bash -c "$CMDLINE"
Setup has completed successfully. SQL Server is now starting.
The last line is wrong, SQL Server does not start.
I assume that uninstallation leaves some trace of my old evaluation that is detected when I try to set up the new developer installation. Anyone knows if there is a way to get rid of whatever is blocking the new install?
TIA,
Gunnar
Shane's comment answered the question. Replacing the repository according to https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-suse did the trick!

Apache cookbook fail to start

I have followed the steps from Opscode Youtube video to create apache cookbook.
~/chef-repo/cookbooks/apache/recipes/default.rb
package "apache2" do
action :install
end
service "apache2" do
action [:enable, :start]
end
cookbook_file "/var/www/index.html" do
source "index.html"
mode "0644"
end
but chef-client failed.
Running handlers: [2014-10-31T10:58:27+08:00] ERROR: Running exception
handlers Running handlers complete [2014-10-31T10:58:27+08:00] ERROR:
Exception handlers complete [2014-10-31T10:58:27+08:00] FATAL:
Stacktrace dumped to /var/chef/cache/chef-sta cktrace.out Chef
Client failed. 0 resources updated in 1.137832751 seconds
[2014-10-31T10:58:27+08:00] ERROR: service[apache2] (apache::default
line 14) ha d an error: Mixlib::ShellOut::ShellCommandFailed:
Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/apache2 start ---- STDOUT: * Starting web server apache2 Action 'start' failed. The Apache error log may
have more information. ...fail! STDERR: (98)Address already in use:
make_sock: could not bind to address 0.0.0.0 :80 no listening
sockets available, shutting down Unable to open logs
---- End output of /etc/init.d/apache2 start ---- Ran /etc/init.d/apache2 start returned 1 [2014-10-31T10:58:27+08:00]
FATAL: Chef::Exceptions::ChildConvergeError: Chef ru n process
exited unsuccessfully (exit code 1)
Something else is already listening on port 80 (Address already in use). You can use the command sudo netstat -ltnp to check what it is.

Resources