CentOS 7 pgbouncer.pid Permissions Issue - postgresql

I have installed pgbouncer. I can't get it started because the directory that houses the .pid file re-generates its own ownership.
2020-07-31 04:58:34.083 EDT [3682] DEBUG loading auth_file: "/etc/pgbouncer/userlist.txt"
2020-07-31 04:58:34.088 EDT [3682] DEBUG pktbuf_dynamic(128): 0x8d52f0
2020-07-31 04:58:34.088 EDT [3682] DEBUG make_room(0x8d52f0, 9): realloc newlen=256
2020-07-31 04:58:34.088 EDT [3682] DEBUG pktbuf_dynamic(128): 0x8d54d0
2020-07-31 04:58:34.089 EDT [3682] FATAL could not open pidfile '/var/run/pgbouncer/pgbouncer.pid': Permission denied
I've set the permissions on /var/run/pgbouncer/ to postgres:postgres after the original installation (forget what those permissions were) and it is still being denied due to permissions. I restart the box and the permissions change back to pgbouncer:pgbouncer. So it seems the package install forms this permissions issue right from the start.
How can I get pgbouncer to work? Any insight appreciated. Cheers

Related

Postgres13.7 fail to start with bdr3.7.16

I've installed, postgres13.7 with bdr 3.7.16, below the packages installed:
postgresql13-13.7r2ndq1.1.9-1.el7.x86_64
postgresql13-docs-13.7r2ndq1.1.9-1.el7.x86_64
postgresql13-bdr-3.7.16-1.el7.x86_64
postgresql13-server-13.7r2ndq1.1.9-1.el7.x86_64
postgresql13-libs-13.7r2ndq1.1.9-1.el7.x86_64
postgresql13-devel-13.7r2ndq1.1.9-1.el7.x86_64
postgresql13-pglogical-3.7.16-1.el7.x86_64
postgresql13-contrib-13.7r2ndq1.1.9-1.el7.x86_64
on file 'postgres.conf', I've added:
shared_preload_libraries = 'pglogical,bdr' # (change requires restart)
But if I try to start the node, I receive this error:
waiting for server to start....2022-07-12 14:37:42.934 CEST [1782] FATAL: incompatible library "/usr/pgsql-13/lib/pglogical.so": magic block mismatch
2022-07-12 14:37:42.934 CEST [1782] DETAIL: Server has FUNC_MAX_ARGS = 250, library has 100.
2022-07-12 14:37:42.934 CEST [1782] LOG: database system is shut down
stopped waiting
pg_ctl: could not start server
Which version of pglogical I need to install?
Thanks a lot

Restore postgres db from folder

i have an old copy of my postgresql db folder (/var/lib/postgresql/9.5/main/) from my server. Now I want to get the data out of the files. So i copied the main folder to my local machine and changed the postgresql config (/etc/postgresql/9.5/main/postgresql.conf) to point to that directory. Also i changed the permission of the main directory to the user postgres. After restarting the postgresql service (sudo service postgresql restart) it doesn't really work.
What I'm doing wrong? (Yea I know, pg_dump is the preferred way, but in this way...)
So my question, does this even work?
Or is there a other way to get the data out of this?
everything is done on ubuntu 16.04.
Edit:
the log file after changing the postgresql.conf file to point to the new directory.
2017-10-13 06:15:43 CEST [968-1] LOG: database system was shut down at 2017-10-13 00:21:04 CEST
2017-10-13 06:15:43 CEST [968-2] LOG: MultiXact member wraparound protections are now enabled
2017-10-13 06:15:43 CEST [959-1] LOG: database system is ready to accept connections
2017-10-13 06:15:43 CEST [975-1] LOG: autovacuum launcher started
2017-10-13 06:15:43 CEST [983-1] [unknown]#[unknown] LOG: incomplete startup packet
2017-10-13 06:47:55 CEST [975-2] LOG: autovacuum launcher shutting down
2017-10-13 06:47:55 CEST [959-2] LOG: received smart shutdown request
2017-10-13 06:47:55 CEST [972-1] LOG: shutting down
2017-10-13 06:47:55 CEST [972-2] LOG: database system is shut down
2017-10-13 06:47:55 CEST [4667-1] FATAL: database files are incompatible with server
2017-10-13 06:47:55 CEST [4667-2] DETAIL: The database cluster was initialized without USE_FLOAT8_BYVAL but the server was compiled with USE_FLOAT8_BYVAL.
2017-10-13 06:47:55 CEST [4667-3] HINT: It looks like you need to recompile or initdb.
Ok that pointed me to this. The server is a armv7l, whereas the local machine is x86_64 (uname -m). So there is no chance to get the data out of it?
thx, Luc
If it's really true that your data directory is from an ARM7l system, and your local system is x86_64, you're going to have some difficulties.
The immediate error about USE_FLOAT8_BYVAL is because ARM7L is 32-bit, and cannot pass 64-bit floating point values (8 byte) by-value. Your 64-bit host can. But if you recompiled a custom postgres with USE_FLOAT8_BYVAL disabled you'd likely just run into other issues.
I suggest installing PostgreSQL on a matching ARM system to recover the data. Data directories for PostgreSQL are not portable across architectures (for performance reasons).
If you do not have access to the ARM system anymore, an emulator like qemu should be able to help you.
Otherwise, maybe you can compile a modified PostgreSQL (probably starting with 32-bit x86) that can read the data-dir, with appropriate configure options etc. I've never needed to try this.

Postgresql unable to start: No space left on device

I have taken dump for the db and it make it run short of memory for Postgresql.
I have then restarted postgresql but it failed to restart.And kept on giving me error
[FAIL] Starting PostgreSQL 9.4 database server: main[....] The PostgreSQL server failed to start. Please check the log output: ... failed!
failed!
and in log file there were following lines
2017-05-05 05:49:25 UTC LOG: could not close temporary statistics file "pg_stat_tmp/global.tmp": No space left on device
2017-05-05 05:49:30 UTC LOG: using stale statistics instead of current ones because stats collector is not responding
2017-05-05 05:49:35 UTC LOG: using stale statistics instead of current ones because stats collector is not responding
2017-05-05 05:49:35 UTC LOG: could not close temporary statistics file "pg_stat_tmp/db_0.tmp": No space left on device
2017-05-05 05:49:35 UTC LOG: could not write temporary statistics file "pg_stat_tmp/db_85990.tmp": No space left on device
2017-05-05 05:49:35 UTC LOG: could not close temporary statistics file "pg_stat_tmp/global.tmp": No space left on device
2017-05-05 05:49:40 UTC LOG: could not close temporary statistics file "pg_stat_tmp/db_0.tmp": No space left on device
2017-05-05 05:49:40 UTC LOG: could not close temporary statistics file "pg_stat_tmp/global.tmp": No space left on device
2017-05-05 05:49:45 UTC LOG: using stale statistics instead of current ones because stats collector is not responding
Please Help me to solve this issue if some one can.
thanks.

Fatal error frontend otrs 4 while loading index.pl

I already installed OTRS 4.0.5 in rhel6 after restart apache, mysql and otrs, while loading http://localhost/otrs/index.pl
The page is not loading and it gives:
Fatal error- Frontend -OTRS 4
The index page is not opening and I need some help figuring out why.
My error log is
[Tue Apr 28 15:23:56 2015] -e: DBI connect('database=otrs;host=127.0.0.1','otrs',...) failed: Can't connect to MySQL server on '127.0.0.1' (13) at /opt/otrs//Kernel/System/DB.pm line 184
ERROR: OTRS-CGI-72 Perl: 5.10.1 OS: linux Time: Tue Apr 28 15:23:56 2015
Message: Can't connect to MySQL server on '127.0.0.1' (13)
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/4/f/4fd2983f3605888b9d72424fb64ba2a1': Permission denied
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/3/9/39285138ef78930f9c3f9d967fbdd6bb': Permission denied
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/e/7/e73a715153f074752e829500e76f765b': Permission denied
mkdir /opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/3/d: Permission denied at /opt/otrs//Kernel/System/Cache/FileStorable.pm line 88
Can't write '/opt/otrs/var/tmp/CacheFileStorable/TemplateProvider/e/6/e6f4f8c1130924d59deb478d08f08e5e': Permission denied
Thanks in advance!
You should disable SELinux or add the policy.
To disable SELinux edit /etc/selinux/config and replace and set SELINUX=disabled
Example policy for OTRS is described here:
http://forums.otterhub.org/viewtopic.php?t=20669#p86818
This is SELinux restricting access to the filesystem. You'll need to set an exception or disable SELinux entirely.

Fixing Server Automatic Shutdown Error – Postgresql 8.4

The database in use is Postgres database V8.Every one hour there is a server connection error.The server gets disconnected and needs to be re connected again.
Please find below the log of the error and let know on a solution to resolve this error
2012-01-05 13:28:52 CEST LOG: server process (PID 6128) was terminated by exception 0xC0000017
2012-01-05 13:28:52 CEST HINT: See C include file "ntstatus.h" for a description of the hexadecimal value.
2012-01-05 13:28:52 CEST LOG: terminating any other active server processes
2012-01-05 13:28:52 CEST WARNING: terminating connection because of crash of another server process
2012-01-05 13:28:52 CEST DETAIL:The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2012-01-05 13:28:52 CEST HINT:In a moment you should be able to reconnect to the database and repeat your command.
2012-01-05 13:28:52 CEST WARNING:terminating connection because of crash of another server process
2012-01-05 13:28:52 CEST DETAIL:The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory
Thanks in Advance
Apparently that status is STATUS_NO_MEMORY, so look at your server memory setup (shared_buffers, work_mem et al) and monitor the memory usage on the machine around the time it crashes (if it is regular). Does it always coincide with some sort of scheduled task?