Postgres DB not starting on Mac OSX: ERROR says: connections on Unix domain socket [closed] - macos

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I ve installed Postgresql and then ran a bunch of rails apps on my local Mac OSX Mountain Lion and created databases etc. Today after a while when I launched pgAdminIII and tried to launch a database server I got this error:
A quick google showed this post. More browsing pointed to the fact that there might be some sort of postmaster.pid file lying around that might be the root cause of this. If I delete that things would be fine.
However, before I go deleting stuff on my computer I wanted to make sure Im debugging this in a systematic way which would not result in more problems.
Somewhere I read that before deleting that file, I need to run this command:
ps auxw | grep post
If I get no results then, its OK to delete the file. Else not. Well, I got this result of that command:
AM 476 0.0 0.0 2423356 184 s000 R+ 9:28pm 0:00.00 grep post
So now of course Im throughly confused.
So what should I do?
Here is part of my postgres server error log:
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 171) running in data directory "/usr/local/var/postgres"?
Postgresql is still not running, still get the same error and nothing has changed. Im too chicken to delete things without checking on SO.
Could some of you experts please guide a noob.
Thanks

I had the same problem today on Mac Sierra. In Mac Sierra you can find postmaster.pid inside /Users/<user_name>/Library/Application Support/Postgres/var-9.6. Delete postmaster.pid and problem will be fixed.

This can happen if the database did not shut down correctly. To fix it simply delete the postmaster.pid file. The location differs based on your OS:
MacOS:
rm /Users/<user_name>/Library/Application\ Support/Postgres/var-9.6/postmaster.pid
or using Postgres.app:
rm /Users/<user>/Library/Application\ Support/Postgres/var-10/postmaster.pid
Linux:
rm /usr/local/var/postgres/postmaster.pid

I have the database working now.
Here are the steps I took:
I rebooted my computer
I opened the terminal and ran cd /
Then I did ls -la
Ensured that I could get to MackintoshHD/usr/local/var/postgres
Then did ls -la
Here I saw the postmaster.pid file
I ran this command cp postmaster.pid ~/Desktop which copied the
file to my desktop.I like to do this if I am deleting files. If
something does wrong i can put it back
Then I ran this command to remove the file from the postgres
directory rm -r postmaster.pid
I went to my pgadmin3 gui and fired it up. and Voila it worked :)
Thanks to #Craig Ringer for his help

I'm using Postgres.app, and the below worked for me:
I entered the commands into my terminal below, locating the Postgres folder beforehand and not using "justin".
$declare -x PGDATA="/Users/justin/Library/Application Support/Postgres/var-9.4"
$pg_ctl restart -m immediate
As Justin explains in his post, the output after this was:
waiting for server to shut down……………………………………………………… failed pg_ctl:
server does not shut down
After entering the command again:
$pg_ctl restart -m immediate
It worked and I got this message:
pg_ctl: old server process (PID: 373) seems to be gone starting server
anyway server starting LOG: database system was interrupted; last
known up at 2015-07-28 18:15:26 PDT LOG: database system was not
properly shut down; automatic recovery in progress LOG: record with
zero length at 0/4F0F7A8 LOG: redo is not required LOG: database
system is ready to accept connections LOG: autovacuum launcher started
Source

Related

Open Source Greenplum: GPFDIST error 'Segmentation fault' when selecting from external table

I'm trying to simply setup an Open Source Greenplum instance and have been hitting the same issue regarding GPFDIST for days! Simply put, I do a full installation from scratch on CentOS 7.6 (can provide further details regarding setup if needed) installing OS GPDB software version 5.18 with GPORCA disabled. Full command for the compile is:
./configure --prefix=/usr/local/gpdb --with-perl --with-python --with-libxml --with-gssapi --with-includes=/usr/local/gpdb/include --with-libs=/usr/local/gpdb/lib --disable-orca
This compiles successfully, and the following make/make install commands too complete without issue. The initialisation of the Greenplum database itself also succeeds, and I can then go into a database and create tables, insert data and run queries like normal.
But if I try to select from an external table, such as the following:
create external table test_external_table
(testing smallint
)
location ('gpfdist://mdw:8080/test_data.csv')
format 'csv' (header delimiter '|')
;
with GPFDIST run as follows:
gpfdist -d /home/gpadmin/test/ -p 8080 -l /home/gpadmin/greenplum/logs/gpfdist_log 2>&1 &
then I get two errors; one from the external table, and one from GPFDIST. These are as follows:
External Table Returns:
ERROR: connection with gpfdist failed for gpfdist://mdw:8080/test_data.csv. effective url: http://127.0.0.1:8080/test_data.csv. error code = 104 (Connection reset by peer) (seg0 slice1 127.0.0.1:6000 pid=27962)
GPFDIST Returns:
[1]+ Segmentation fault gpfdist -d /home/gpadmin/test -p 8080 -l /home/gpadmin/greenplum/logs/gpfdist_log 2>&1
I have removed everything that isn't on the OS GPDB GitHub installation guide (for a 'bare-bones' setup), so I don't think that is causing the issue. I have tried everything to do with the hostname and network firewall, and it's all perfect as far as I can see.
I have also downloaded the same version of GPDB (5.18) from Pivotal and installed that version on the same instance simultaneously, and GPFDIST works perfectly fine.
I have also tried OS GPDB 5.17, 6 beta and 7 beta, and I get the same issue for all of them.
Any ideas at all on what might be causing this is VERY much appreciated, as I'm slowly going insane trying to figure this out now.
Thank you very much in advance for any help.
-- Edit --
Okay.. Having nearly chewed my own arm off in sheer frustration at trying to install debuginfo stuff on CentOS 7, I've finally generated a core dump with gdb. I then run:
gdb -c core_dump.<pid>
and get the following output:
Core was generated by `gpfdist -d /home/gpadmin/test -p 8080 -l /home/gpadmin/greenplum/logs/gpfdist_log'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f4f2c07bdff in ?? ()
But I have absolutely no idea what that means... Totally honest, I'm a little over my head with this now and really am stuck on how to proceed.
The connection reset by peer only indicates that the other end of the socket had dropped (...in this case, gpfdist because it crashed out).
Setup your gpfdist and try a wget to a hosted file adding:
--header='X-GP-PROTO:0'
You will need to add the header to avoid having the request rejected.
Are you able to retrieve a file there? Or does that also crash out?
If that crashes out, it's nothing to do with the database - and you will likely need a core dump to determine what the segfault is about (r/w permissions, memory, ...).
I've finally managed to solve this issue. Should anyone come looking with a similar problem, make sure you are installing Libevent version 1.4[.15], and nothing above that.
I had 2.2.0 installed, and whilst Greenplum sees this as fine, it actually doesn't work for it. Unfortunately, I did have to do an entire system installation from scratch to seemingly get it to work, as just installing Libevent 1.4 on the old system with Greenplum already compiled did not work for me.

Docker hangs while pulling

I am trying to run docker run docker/whalesay cowsay boo from the tutorial.
Here is the output I get:
Unable to find image 'docker/whalesay:latest' locally
latest: Pulling from docker/whalesay
e190868d63f8: Already exists
909cd34c6fd7: Already exists
0b9bfabab7c1: Already exists
a3ed95caeb02: Pulling fs layer
00bf65475aba: Already exists
c57b6bcc83e3: Already exists
8978f6879e2f: Waiting
8eed3712d2cf: Download complete
It has been 10 minutes but nothing shows up. Is it supposed to take that long?
I tried control+C and re-run the command, and restarting Docker Quickstart Terminal. It's still not solving the problem.
You don't have to reinstall. Just restarting docker service should do
service docker restart
Similar situation. I got the feeling that concurrent download caused the problem. So I just force the docker downloading connection to 1.
docker-icon -> perferences -> daemon -> add the following code:
{
"max-concurrent-downloads": 1
}
slower but more stable.
Reinstalling docker from scratch solved the problem for me
I also was getting stuck on the "Pulling fs layer" when pulling images, and just want to add another reason it might be happening (this was what happened to me): I was connected to my corporate network and needed to set proxies; once I set the proxies, the image pull finished fine.
I had the same problem because of antivirus program. After I've disabled it (to disable it quickly, I just renamed McAfee installation directory and rebooted) - Docker finally was able to pull all layers.
Just reset default os in virtualBox and try again.
In my case, I had installed boot2docker long ago (March 2016), and this was overshadowing Docker for Mac. I had to manually uninstall boot2docker.

Why won't Apache Server start in MAMP?

I'm trying to view php files locally on my mac.
I'm running Yosemite.
I have MAMP installed on my computer. When I press start the MySQL server starts but Apache doesn't. An error message appears saying 'Error. Apache couldn't be started. Please check your MAMP installation'
I've gone through the internet typing stuff into terminal and changing 'envvars' to '_envvars' but nothing works.
I reinstalled OSX and that worked but when I shut down the computer the problem occurs again.
Can anyone help?
Thanks
Check if you changed the Document Root Location or Renamed it. At least this was my mistake.
MAMP > Preferences > Web Server > Document Root
I didn't get it working with port 8000 or the default 8888, but did get it working with port 80 per the suggestion here:
http://forums.macrumors.com/showthread.php?t=1744944
That didn't work after all, but it didn't error out. However I manually ran the following at the command line (because log file was empty):
sudo /Applications/MAMP/Library/bin/apachectl start
Only to find that after upgrading I was missing the mod_example.so
httpd: Syntax error on line 83 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/Library/modules/mod_example.so into server: dlopen(/Applications/MAMP/Library/modules/mod_example.so, 10): image not found
Copied it from my old install and I was good to go.
If you try to start the server from the terminal, likely that will tell you what is wrong e.g.
sudo /Applications/MAMP/bin/startApache.sh
Password:
(48) Address already in use: make_sock: could not bind to address [::]:8888
(48) Address already in use: make_sock: could not bind to address 0.0.0.0:8888
no listening sockets available, shutting down
Unable to open logs
What you can do in this case, I was inadvertently running a Blockstack browser out of 8888, so changing MAMP to 8887 allowed it to start. [Your mistake might be different.]
Had the same problem, nothing in the logs. After trying the_dillio's suggestion:
sudo /Applications/MAMP/Library/bin/apachectl start
I got an error that pointed back to my vhosts file. It turns out I had an extra /VirtualHost tag. Removed it and it started working again.
i've solved this issue using this command in the terminal :
sudo apachectl stop
I think I've found the solution.
It was the wrong port. I altered the .conf file in the Apache folder. I changed all instances of port 8888 to 8000. When I run MAMP now it all seems to work fine.
Thanks for your help
Also be aware that if you by any chance deleted the folder that was set as Document Root the last time you were using MAMP, you will get this error. Simply open MAMP again, change Document Root to a location that does exist and start the servers.
I received the same error but interestingly it was caused simply because I renamed the root folder and didn't realize it. Sounds like you have a different issue but for anyone else who gets this error message, make sure you haven't renamed the root!
Absolutely bizarre behavior for MAMP PRO (paid license too btw...)
In my case I had to change the location of the log file in order to get it to work...
Click on Mysql icon then the little folder to the right of the path and try changing it to something else.
For MAMP :
You can open the terminal and write:
ps aux | grep mysql
lsof -i
killall -9 mysqld
I hope is good for you!
Bye
I had this experience when upgrading to V4. It tried to used the files from my previous installation and it just never worked. The workaround was to RENAME the original MAMP installation to something different than "MAMP", install brand new version and then copy files you may need like VHOST configs and DATABASES. After all this it worked just fine.
My Apache server problem arose after I enabled SSL. So if this is your case, check your https-ssl.conf file (Applications -> Mamp -> conf -> apache -> extra). The Document Root under the Virtual Host settings had a different file path for htdocs than where it was actually located (easily overlooked). I changed this to "/Applications/MAMP/htdocs" and problem solved. Perhaps also check Document Root in your https.conf file (Applications -> Mamp -> conf -> apache) to see if it has the correct file path to htdocs too.
These are the steps I used to solve this issue.
Checking vcredist that are required and installing them. to check which are the missing vcredist I used a tool called "check_vcredist" from wamp.
I also installed latest Microsoft Visual C++ Redistributable x64.
Doing this steps solved my issue of Apache server not running

Yosemite - MAMP - Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)

I have problem when I try to connect to MySQL MAMP :
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)
I'm doing research but I have not found a solution to my problem, I try to link mysql.sock like this :
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
But, the file /tmp/mysql.sock doesn't exist.
Do you have any ideas ? The problem is blocking me for 2 days, I searched for this time but nothing good for me.
Thanks in advance,
I had the same problem after upgrading MySQL on MAMP from 5.5 to 5.6 version.
After long research I founded this decision https://drupal.stackexchange.com/questions/32402/drush-and-mysql-database-with-mamp-connection-problem
In my case there was no socket file at that location /Applications/MAMP/tmp/mysql/mysql.sock.
The easy solution is to create a symlink:
cd /tmp
ln -s /Applications/MAMP/tmp/mysql/mysql.sock ./mysql.sock
The effect of which is to route all calls for /tmp/mysql.sock to the appropriate MAMP specific path.
simply remove two files ib_logfile0 and ib_logfile1 from /Applications/MAMP/db/mysql56
In some cases /Applications/MAMP/tmp/mysql/mysql.sock.lock may create the problem. remove .lock and it will work (OSX)
I had the same problem. I solved it following these steps:
I stopped and restarted MySQL via System Preferences -> MySQL (see also https://stackoverflow.com/a/26523977/204807)
I entered sudo mysql_upgrade in a terminal window, and pressed enter
After the update process I was able to connect with my MySQL.
Rename .sock file of mysql and restart your MySQL server.
/Applications/MAMP/tmp/mysql/mysql.sock to /Applications/MAMP/tmp/mysql/mysql_old.sock
Also check to make sure MySql is running. You can get this error if you try to use MySql from the command line when MAMP/MySql is not running.
In case this helps anyone, I got past this roadblock by:
Stopping all other versions of MySQL (I forgot that I had Oracle MySQL starting on system launch and I was attempting to connect via that installation.) and removing them anyway to let MAMP handle it.
Use sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Ensure MAMP is running.
Running /Applications/MAMP/Library/bin/mysql.
1) mysql.server stop
2) /Applications/MAMP/bin/startMysql.sh &&
now on MAMP go to
Tools => Upgrade MySQL databases

Cannot open graphical application through command line?

I am having trouble opening graphical applications in linux (Sublime Text 2 in this case) through the terminal. I am using Fedora 17. I get this error for other graphical applications that I try to open up through the command line as well.
[root#computer djproject]# sublime settings.py
No protocol specified
(sublime:4202): Gtk-WARNING **: cannot open display: :0
Also, I get the same type of error when I try to do:
sudo sublime
Note in the command above I was logged in as a regular user without root access. Also 'sublime' is mapped to Sublime Text 2, and I have tested it before in other scenarios, so it is not the problem. Also, I have set this particular user up as a valid sudoer and the sudo command also works in other cases.
While researching the problem I came across many similar cases with no clear solution.
The following link has a user with a similar problem (although using ssh and on Ubuntu, rather than local and Fedora in my case).
Thanks in advance!
I spent quite a lot of time trying to figure this problem out, and came across this thread as I found a fix.
My problem was simply that I was running my commands from within the byobu session. I opened a new terminal tab and successfully ran the same commands.
Since DISPLAY is being defined, this may be a problem with permissions. How are you starting X? (As far as I know normally X is started by root and when you login you are granted access such that these issues don't occur, unless you're running sudo from a different account than the one you're logged into X with.)
You need to provide the correct 'cookie' file to access the session (simply being root isn't enough to get in). For users this is normally ~/.Xauthority, so executing xauth merge /home/<user>/.Xauthority should do the trick.
Alternatively have you tried gksu?
I actually needed this (run an X application from CLI with a different user), and valid workarround is to SSH -X:
user1 owns X
user2 is the second user that wants to run an X program from CLI, in this example, eclipse ide
user1:~$ ssh -X user2#localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
user2#localhost's password:
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-44-generic x86_64)
user2:~$
user2:~$ /opt/eclipse/eclipse
I know this is 5 years old post, but I spend much time to solve issue like this on installation of Renderman of Pixar. Then I like to send my solution that maybe helps someone else
The problem is because of this "sudoer (here root) has no access to graphical space". (I don't know it is always or sometimes. I faced this issue on Ubuntu 16.04)
Doing the following solved my issue:
first, start Terminal as graphical user, Alt+Ctrl+T
then, execute these lines
$ unset XAUTHORITY
$ xhost add $DISPLAY . 123f
$ xhost +local:all
$ sudo xclock # or any graphical program needs sudoer
Let me know your feedbacks

Resources