pgbouncer fails to start when configured to dockerized postgres - pgbouncer

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.

Related

Clickhouse doen't work on port 8123. Code: 210. DB::NetException: Connection refused (localhost:9000)

everyone. I have install clickhouse on Ubuntu. But when I am trying to start server:
sudo systemctl start clickhouse-server
nothing happen. Also I noticed that db doesn't listen default port 8123. For, instance commands below do not give any result:
sudo netstat -tulpn | grep clickhouse
sudo netstat -tulpn | grep 8123
When I try to start server 'clickhouse-client --password', I get:
ClickHouse client version 22.8.4.7 (official build).
Password for user (default):
Connecting to localhost:9000 as user default.
Code: 210. DB::NetException: Connection refused (localhost:9000). (NETWORK_ERROR)
Clickhouse status:
clickhouse-server.service - ClickHouse Server (analytic DBMS for big data) Loaded: loaded (/lib/systemd/system/clickhouse-server.service; enabled; ve> Active: activating (auto-restart) (Result: exit-code) since Wed 2022-09-07> Process: 10730 ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhous> Main PID: 10730 (code=exited, status=233/RUNTIME_DIRECTORY) CPU: 90ms
Clickhouse clickhouse-server.err.log:
11. _start in /usr/bin/clickhouse (version 22.8.4.7 (official build)). Will overwrite it 2022.09.07 11:42:23.694750 [ 21604 ] {} <Error> Application: DB::Exception: Caught Exception Code: 76. DB::ErrnoException: Cannot open file /var/lib/clickhouse/uuid, errno: 13, strerror: Permission denied. (CANNOT_OPEN_FILE) (version 22.8.4.7 (official build)) while writing the Server UUID file /var/lib/clickhouse/uuid
What about
sudo systemctl status clickhouse-server
sudo tail -300 /var/log/clickhouse-server/clickhouse-server.err.log
sudo tail -300 /var/log/clickhouse-server/stderr.log

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

Trying a quick cluster deployment with Docker:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I found that DolphinDB now supports a quick cluster deployment with docker containers and I followed the guide on github: https://github.com/dolphindb/Tutorials_CN/blob/master/docker_deployment.md to deploy a cluster with DolphinDB Docker package. But I encountered a problem. I looked at any other questions but can't find my own solution.
Here is the problem:
xllu#xllu-OptiPlex-7060:~/DolphinDB-Docker-Compose/Dockerbuild$ docker -v
Docker version 18.09.3, build 774a1f4
xllu#xllu-OptiPlex-7060:~/DolphinDB-Docker-Compose/Dockerbuild$ docker-compose --version
docker-compose version 1.24.0, build 0aa59064
xllu#xllu-OptiPlex-7060:~/DolphinDB-Docker-Compose/Dockerbuild$ docker build -t ddb:latest ./
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I tried restarting docker:
xllu#xllu-OptiPlex-7060:~/DolphinDB-Docker-Compose/Dockerbuild$ sudo service docker restart
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
Then I checked this :
xllu#xllu-OptiPlex-7060:~/DolphinDB-Docker-Compose/Dockerbuild$ systemctl status docker.service
● docker.service - LSB: Create lightweight, portable, self-sufficient containers.
Loaded: loaded (/etc/init.d/docker; generated)
Active: failed (Result: exit-code) since Fri 2019-05-31 15:16:01 CST; 16s ago
Docs: man:systemd-sysv-generator(8)
Process: 29234 ExecStart=/etc/init.d/docker start (code=exited, status=1/FAILURE)
Main PID: 2596 (code=exited, status=0/SUCCESS)
5月 31 15:16:01 xllu-OptiPlex-7060 systemd[1]: Starting LSB: Create lightweight, portable, self-sufficient containers....
5月 31 15:16:01 xllu-OptiPlex-7060 docker[29234]: * /usr/bin/dockerd not present or not executable
5月 31 15:16:01 xllu-OptiPlex-7060 systemd[1]: docker.service: Control process exited, code=exited status=1
5月 31 15:16:01 xllu-OptiPlex-7060 systemd[1]: docker.service: Failed with result 'exit-code'.
5月 31 15:16:01 xllu-OptiPlex-7060 systemd[1]: Failed to start LSB: Create lightweight, portable, self-sufficient containers..
Can you try removing /var/lib/docker with sudo rm -rf /var/lib/docker and try restarting the docker?
You will lose the images stored.

PostgreSQL starts for a few minutes, then fails

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.

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.

Resources