All of a sudden -- tcp connect (localhost:5432): connection refused - :econnrefused - linux

For a few months all has been ok, but now I have a lot of:
mix phoenix.server
[error] Postgrex.Protocol (#PID<0.302.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
[error] Postgrex.Protocol (#PID<0.303.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
on localhost.
But:
Postgresql is running
Its config is the same
The config of my phoenix/elixir application is the same too.
systemctl status postgresql shows everything is ok
nothing bad in the log
I can connect to Pg via Pg GUI tool
What's the matter?
$ netstat -tulnp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 ::1:5432 :::* LISTEN -
udp 0 0 192.168.1.37:68 0.0.0.0:* -
udp 0 0 0.0.0.0:5353 0.0.0.0:* 25117/libpepflashpl
udp6 0 0 :::5353 :::* 25117/libpepflashpl

Related

Unable to access Docker Application via browser

I am attempting to install a Tableau server running in a Docker Container and I seem to having a lot of issues accessing the application via my browser after the install.
I was able to create the docker image with no issues
REPOSITORY TAG IMAGE ID CREATED SIZE
tableau_server_image 20214.22.0314.1536 18f33191a8c5 10 hours ago 8.68GB
centos 7.9.2009 eeb6ee3f44bd 6 months ago 204MB
pvtmert/tableau latest 31c0207b828b 7 months ago 4.1GB
Also the container seems to currently be running
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5fd0604d7edc 18f33191a8c5 "/bin/sh -c ${DOCKER…" 6 hours ago Up 6 hours 0.0.0.0:8850->8850/tcp, :::8850->8850/tcp, 0.0.0.0:80->8080/tcp, :::80->8080/tcp zen_solomon
However, whenever I attempt to access the application via the public IP on either ports 8850 or port 80, nothing comes up.
Does anyone have any suggestions? Do I have the ports wrongly configured?
These are my results when I run netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 22654/docker-proxy
tcp 0 0 0.0.0.0:8850 0.0.0.0:* LISTEN 22632/docker-proxy
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1112/sshd
tcp6 0 0 :::80 :::* LISTEN 22662/docker-proxy
tcp6 0 0 :::8850 :::* LISTEN 22638/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 1112/sshd

Why can't I talk to a service on tcp/3000 on my CentOS VPS

I'm trying to run a second web service on my VPS at port 3000.
On the VPS I run:
# php -S myhost.com:3000
and then in a browser, navigate to http://myhost.com:3000 but the browser times out and the service logs/outputs nothing.
If I run the service on port 80 (i.e., php -S myhost.com:80 and navigate to http://myhost.com), it works.
So firewall. Except that:
[root#spinal ~]# firewall-cmd --list-ports
3887/tcp 3000/tcp
(the 3887 is another service, which is working correctly.) And I rebooted the VPS after setting up port 3000 in the firewall. I reckon the service is listening correctly because:
[root#spinal ~]# netstat -tupl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:imap 0.0.0.0:* LISTEN 1907/dovecot
tcp 0 0 0.0.0.0:ciphire-data 0.0.0.0:* LISTEN 1876/sshd
tcp 0 0 0.0.0.0:http 0.0.0.0:* LISTEN 1903/nginx: master
tcp 0 0 0.0.0.0:urd 0.0.0.0:* LISTEN 2004/master
tcp 0 0 myhost.com:hbci 0.0.0.0:* LISTEN 2206/php
tcp 0 0 localhost.loca:postgres 0.0.0.0:* LISTEN 1908/postgres
tcp 0 0 0.0.0.0:smtp 0.0.0.0:* LISTEN 2004/master
tcp 0 0 0.0.0.0:https 0.0.0.0:* LISTEN 1903/nginx: master
tcp 0 0 0.0.0.0:imaps 0.0.0.0:* LISTEN 1907/dovecot
tcp 0 0 localhost.lo:cslistener 0.0.0.0:* LISTEN 1878/php-fpm: maste
tcp6 0 0 [::]:imap [::]:* LISTEN 1907/dovecot
tcp6 0 0 [::]:ciphire-data [::]:* LISTEN 1876/sshd
tcp6 0 0 [::]:urd [::]:* LISTEN 2004/master
tcp6 0 0 [::]:smtp [::]:* LISTEN 2004/master
tcp6 0 0 [::]:imaps [::]:* LISTEN 1907/dovecot
I can however connect locally. This works, when run on the VPS:
$ curl http://myhost.com:3000
so that again points at the firewall. But disabling the firewall doesn't help:
# systemctl stop firewalld
so it could be a DNS problem: my browser and the VPS differ on what myhost.com resolves-to. Except that, as mentioned above, switching to port 80 solves the problem. So it's something to do with coming-in on port 3000, from outside. But not firewalld.
The question at Can't reach nodejs on port 3000 from external on CentOS 7 is close to mine, but isn't conclusively answered.
I feel pretty stupid. It was a firewall; not on the VPS, but on my local network. When I tried it on a machine that doesn't go through my local network, it worked. I hope my public confession helps someone else.

Cassandra linux cannot connect from remote

I have installed cassandra but not able to connect to cassandra server from remote ip..
[root#li1632-39 ~]# cassandra -v
3.0.9
I and connecting public_ip:9042 but connection refused. When I try to validate by telnet I can see port is closed.
When I try to check the status of cassandra its running.
[root#li1636-25 ~]# nodetool status
Datacenter: singapore
=====================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 192.168.130.104 297.48 KB 256 100.0% 85bebb4d-4ce9-4144-b33a-8e9759a87e54 rack5
UN 192.168.130.59 262.73 KB 256 100.0% f79f1c04-b567-4e15-98f0-5fd1a8345f61 rack5
I have cassandra.yaml
listen_address: 192.168.130.59
rpc_address: 192.168.130.59
start_rpc: true
I have also tried with cassandra.yaml
listen_address: 0.0.0.0
rpc_address: 0.0.0.0
start_rpc: true
In this case I am getting below error.
[root#li1636-25 ~]# nodetool status
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused (Connection refused)'.
Error from the remote host on telnet.
A-MacBook-Air:~ ads$ telnet public_ip 9042
Trying 172.104.52.39...
telnet: connect to address public_ip: Connection refused
telnet: Unable to connect to remote host
Below is the result of Netstat
netstat -tulpn | grep LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3575/sshd
tcp 0 0 192.168.130.59:7000 0.0.0.0:* LISTEN 6777/java
tcp 0 0 127.0.0.1:7199 0.0.0.0:* LISTEN 6777/java
tcp 0 0 127.0.0.1:37857 0.0.0.0:* LISTEN 6777/java
tcp 0 0 192.168.130.59:9160 0.0.0.0:* LISTEN 6777/java
tcp6 0 0 192.168.130.59:9042 :::* LISTEN 6777/java
tcp6 0 0 :::22 :::* LISTEN 3575/sshd
I have stopped Firewalld also.

Express http only working with localhost but not with external ip http connection

Tried to avoid the listen IP only on the '127.0.0.1', so the listen port 8000 is also bind with the '0.0.0.0'. But external http clients still not able to get the http connection setup. Also tried tcpdump, the client SYN can reach to the node server, but not any response from the node.js http server... this caused the issue. Really appreciate your assistance!
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 1650/node
tcp 0 0 127.0.0.1:56064 127.0.0.1:27017 ESTABLISHED 1650/node
tcp 0 0 127.0.0.1:56062 127.0.0.1:27017 ESTABLISHED 1650/node
tcp 0 0 127.0.0.1:56065 127.0.0.1:27017 ESTABLISHED 1650/node
tcp 0 0 127.0.0.1:56063 127.0.0.1:27017 ESTABLISHED 1650/node
tcp 0 0 127.0.0.1:56061 127.0.0.1:27017 ESTABLISHED 1650/node

Linux Centos 6 Some how filtered port 80 + broke Apache 2

I have magically been able to break port 80 / Apache server when following a guide to install PHPMyAdmin (http://www.krizna.com/centos/installing-apache2-mysql-server-php-centos-6-lamp/#apache)
Prior to me to starting the guide, Apache 2 was working for me (was able to view pages and see the default blue one)
I followed the guide down to Step 4 under "PHP installation" and went to check the page and I was getting the following error (note: I skipped Mysql installation since I have it already installed and "Testing your page" in the Apache section since I had it working prior).
ERROR
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: http://`192.168.141.22`/
Read Error
The system returned: (104) Connection reset by peer
An error condition occurred while reading data from the network. Please retry your request.
Your cache administrator is webmaster.
Generated Wed, 03 Jul 2013 19:04:56 GMT by tx22rrpep4da (hpm/3.0.55)
I tried to uninstall (yum erase) httpd and php and re-install and no success.
I did an nmap and it shows 80/tcp filtered http.
I even disabled/stopped IP tables incase that was the issue, no luck. I have other things like TS3 running on other ports fine.
Restarted the dedicated server.
netstat -tulpn
te PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 25896/httpd
tcp 0 0 0.0.0.0:30033 0.0.0.0:* LISTEN 2967/./ts3server_li
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2736/named
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2798/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2873/master
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2736/named
tcp 0 0 0.0.0.0:10011 0.0.0.0:* LISTEN 2967/./ts3server_li
tcp 0 0 ::1:53 :::* LISTEN 2736/named
tcp 0 0 :::22 :::* LISTEN 2798/sshd
tcp 0 0 ::1:953 :::* LISTEN 2736/named
udp 0 0 0.0.0.0:9987 0.0.0.0:* 2967/./ts3server_li
udp 0 0 127.0.0.1:53 0.0.0.0:* 2736/named
udp 0 0 ::1:53 :::* 2736/named
I had a few other people test the IP in case it was just my connection but they all got the same as well (IP: 192.168.141.22 )
Really hoping I can get this fixed with out doing something over the top like wiping and re-installing centos 6.
The netstat command is showing that Apache is in-deed listening on the following IP & port:
0 0.0.0.0:80
If you want reach Apache in 192... ip, then you need to edit one of the .conf files that has the "Listen" directive(normally in /etc/httpd/conf.d/ports.conf or the main .conf file) and either put in the ip or remove all ips so Apache can listen on all interfaces available in the machine.

Resources