pgbouncer ignores pidfile from ini - pgbouncer

trying to start pgbouncer I see in log:
2017-04-25 11:18:06.319 7186 FATAL #src/main.c:612 in function
check_pidfile(): pidfile exists, another instance running?
indeed, it was not deleted by service pgbouncer stop:
[root#b ~]# grep pid /etc/pgbouncer/pgbouncer.ini
pidfile = /pg/pgbouncer/pgbouncer.pid
[root#b ~]# ls -al /pg/pgbouncer/pgbouncer.pid
-rw-r--r-- 1 pgbouncer pgbouncer 5 Apr 25 10:45 /pg/pgbouncer/pgbouncer.pid
because it is hard coded in init:
[root#b ~]# grep ^pid /etc/init.d/pgbouncer
pidfile=/var/run/pgbouncer/pgbouncer.pid
when I change the path to the one I specify in /etc/pgbouncer/pgbouncer.ini it starts working...
Qestion: What do I do to make init.d pickup pid file location from config?
I have:
[root#b ~]# uname -a
Linux 4.9.20-11.31.amzn1.x86_64 #1 SMP Thu Apr 13 01:53:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root#b ~]# pgbouncer -V
pgbouncer version 1.7.2
Installed it with:
wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-ami201503-96-9.6-2.noarch.rpm
rpm -ivh pgdg-ami201503-96-9.6-2.noarch.rpm
yum install pgbouncer
.

Related

Where is mssql_cli installed in the MacOS?

So I did this in my M1,
pip3 install mssql-cli
The 2nd time it says:
Requirement already satisfied: mssql-cli in ./Library/Python/3.8/lib/python/site-packages (0.3)
From ls -l ./Library/Python/3.8/lib/python/site-packages/mssql_cli
-rw-r--r-- 1 haha staff 39 Aug 8 17:39 __init__.py
-rw-r--r-- 1 haha staff 2395 Aug 8 17:39 mssql_cli.py
I'm trying to do mssql-cli -S localhost -U haha
zsh: command not found: mssql-cli
Same thing for mssql cmd.
So how should I run it from command line please?

get list of preinstalled packages debian 10

Is there a way to list all the packages that were preinstalled in debian 10 before I started installing packages myself, including dependencies etc ? And is there a way to re-initialize debian 10 by removing all these packages ?
Thanks in advance!
Find the oldest apt log file:
$ ls -la /var/log/apt/history.log*
-rw-r--r-- 1 root root 19614 Dec 19 17:09 /var/log/apt/history.log
-rw-r--r-- 1 root root 8570 Nov 29 17:05 /var/log/apt/history.log.1.gz
-rw-r--r-- 1 root root 2573 Oct 23 11:09 /var/log/apt/history.log.2.gz
Find the first package you install manually (use zcat for .gz or cat otherwise):
$ zcat /var/log/apt/history.log.2.gz | grep '^Commandline: apt\(-get\)\? install' | head -1
Commandline: apt install gpm
It seems gpm is the first package I installed manually.
Get the list of all installed packages in chronological order:
$ zcat /var/log/dpkg.log.*.gz | cat - /var/log/dpkg.log | grep ' install ' | sort | awk '{print $4}'
Packages before your first manual package are the ones that were installed by Debian installer. Everything else is what you installed yourself.

mongod : Failed to unlink socket file

I am trying to start mongod.
I run
sudo service mongod start
but I get:
Failed to unlink socket file /tmp/mongodb-27017.sock Unknown error
Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp
685
Theres a question here but I have tried all solutions to no avail
Os: Ubuntu 16.04
When I run
ls -lsah /tmp/mongodb-27017.sock
I see:
0 srwx------ 1 mongodb mongodb 0 Jun 14 11:45 /tmp/mongodb-27017.sock
Then I run
rm /tmp/mongodb-27017.sock
sudo service mongod start
When I run
ls -lsah /tmp/mongodb-27017.sock
again, I see:
0 srwx------ 1 mongodb mongodb 0 Jun 14 11:45 /tmp/mongodb-27017.sock
When I run mongod, it gives me the same error.
I had the same problem and noticed this old answer: https://stackoverflow.com/a/34290982/2683681.
You can use their command:
sudo chown `whoami` /tmp/mongodb-27017.sock
But if you're using root then you'd better be doing:
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
My problem stemmed from the fact that root owned the socket.

Mongodb /var/log/mongodb/mongod.log prevents mongod from starting

I am using mongodb 3.6.3 on a centos 7 aws ec2 instance.
2 Questions (only one needs to be answered):
Why is the --logpath preventing the mongod command if done manually through the cli with sudo mongod --storageEngine etc
Why is sudo service mongod status showing the failure that it is?
When I run the below command, (since currently, sudo service mongod start isn't working but the below works) it fails when I specify the --logpath but will run without it. Unfortunately, when I run it without it, all of my logs end up in the / which is absolutely the wrong location.
sudo mongod --storageEngine wiredTiger --dbpath /data --bind_ip 127.0.0.1,apiIP --logpath /var/log/mongodb/mongod.log --auth --fork
Below is what happens when I try to run that above line as is.
I CONTROL [main] log file "/var/log/mongodb/mongod.log" exists; moved to "/var/log/mongodb/mongod.log.2018-03-16T15-16-01".
From what I can tell, it is conflicting with the currently existent
Just for reference, sudo service mongod status returns:
mongod.service - mongodb database
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2018-03-16 15:11:53 UTC; 9min ago
Process: 26620 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=2)
Main PID: 26620 (code=exited, status=2)
Mar 16 15:11:53 ip-* systemd[1]: Started mongodb database.
Mar 16 15:11:53 ip-* systemd[1]: Starting mongodb database...
Mar 16 15:11:53 ip-* mongod[26620]: F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
Mar 16 15:11:53 ip-* systemd[1]: mongod.service: main process exited, code=exited, status=1/FAILURE
Mar 16 15:11:53 ip-* systemd[1]: Unit mongod.service entered failed state.
Mar 16 15:11:53 ip-* systemd[1]: mongod.service failed.
/etc/mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /data
# logpath: /log/mongod.log
journal:
enabled: true
engine: wiredTiger
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
# fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1, apiIP
Thanks to #AlexBlex for noticing the spacing issue in the yaml file.
With that sorted, the status error has this line
Unrecognized option: storage.wiredTiger
cd /var/log
sudo mkdir -m 777 mongodb
sudo service mongod start
sudo service mongod status
Hopefully, that's will do!
sudo systemctl enable mongod
sudo systemctl restart mongod
sudo journalctl -u mongod.service
Hopefully, that will do!
Reference: https://stackoverflow.com/a/51286526/122441

Page timing out with 404 error when script runs longer than 120 seconds

I have a script that needs to run for up to 15 minutes through a cron job. But I can't get the script to stay running. It errors out with a 404 message at exactly 120 seconds. Very strange. I have even called my hosting provider. I am at a loss.
I have set max_execution_time = 5000
Does anyone have any suggestions?
set_time_limit(0);
$array = array('1','2', '3');
foreach ($array as $row) {
echo $row . '<br>';
sleep(50);
}
You may also need to look at Apache's timeout setting, as you can change the max execution time value in php.ini and still get stopped by Apache's timeout value in the httpd.conf file.
You can find httpd.conf by running httpd -V in terminal (The command name depends on your system/apache version, it can be also apache -V) ~ If you don't have terminal access, you may need to contact your webhost. Example output:
bash-3.2# httpd -V
Server version: Apache/2.2.22 (Unix)
Server built: Aug 24 2012 17:16:58
Server's Module Magic Number: 20051115:30
Server loaded: APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/bin/suexec"
-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="/private/var/run/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf" <-- HERE IT IS
httpd.conf could look like this: https://www.devside.net/guides/config/linux/httpd-conf
Notice the line:
Timeout 300

Resources