pika.exceptions.ConnectionClosed: Connection to ***.***.*.*:5672 failed: timeout - python

I am trying to connect to one of my development server via rabbitmq.
I am able to connect to all other servers except one.
I am able to connect this server to itself.
I have tried almost all the solutions in stackoverflow.
connection=pika.BlockingConnection(pika.ConnectionParameters(credentials=credentials,host="**.***.*.*",socket_timeout=300))
pika.exceptions.ConnectionClosed:Connection to **.***.*.*:5672 failed: timeout

first check wheather rabbitmq is running
sudo service rabbitmq-server status
then check if you are able to ping the server
run ping 12.123.1.1
now we have to check if port is open or not
telnet 12.123.1.1 5672

Related

(Pycharm docker setting)Connection refused:no further information

I'm new to Docker. I get a connecting error when trying to setup Docker in PyCharm Professional edition.
I have followed this official manual and turn on the checkbox(Expose daemon on tcp://localhost:2375 without TLS)
But it still not work.
Cannot connect: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.O.O.1:2375
caused by: java.net.ConnectException: Connection refused: no further information
I have accidentally connected docker one time.But when i restart my computer i cannot connect docker anymore.
Any further help would be gratefully appreciated.
If you are facing connection refused then there may be a chance that there is no server to respond to your request.
So first check whether docker server is listening on 2375 port.
netstat -anp tcp | findstr 2375
Or, use tcpview for GUI.
If docker is not listening on this port, then check your C:\ProgramData\Docker\config\daemon.json file and verify whether you have the below Key value pair in your JSON.
"hosts": ["tcp://0.0.0.0:2375"]
If it is not there, then add this and restart your docker daemon.
If you are behind a proxy, then make sure to add this in no-proxy, so that your requests will not be routed via a proxy server.
NOTE: I don't have any experience with docker on windows

RabbitMQ on Docker: Pika hangs on connection when given port, connection refused without port

I am trying to connect to a queue using pika, run on my local box, and rabbitmq run in a docker container. I am able to access rabbitmq on http://0.0.0.0:15677 with both curl commands and by viewing it in a web browser, so I know that rabbitmq looks like it is running fine - however, I cannot connect to it using python.
When I don't include the port in my pika.ConnectionParemeters, the connection is outright refused immediately. When I do include the port, the connection hangs and never shows on rabbitmq's side. Not sure if there's something funky going on with docker or with pika, but it is worth mentioning that my code connects to an otherwise identical rabbitmq server that is not a docker container.
I am running the newest version of OSX and using python 2.7 and pika 0.10.0.
RMQ_URL = '0.0.0.0'
HOST_QUEUE = 'snarfer'
VHOST = 'beta'
RMQ_PORT = 15677
ROUTING_KEY = 'snarfer.discovery'
self.connection = pika.BlockingConnection(pika.ConnectionParameters(
host=s.RMQ_URL, virtual_host=s.VHOST, port=s.RMQ_PORT))
***EDIT: Adding credentials to the ConnectionParameters does nothing.
If you use the TCP port of the management web UI for your AMQP client, it cannot work: RabbitMQ expects HTTP requests on that port, not AMQP frames. That's why the client appears to hang.
If you don't specify a TCP port, it will use 5672, the default AMQP port. According to the management UI port (15677), I suppose your RabbitMQ is listening for AMQP connections on port 5677 because by default, the management plugin listens to $amqp_port + 10000.
Thus try with RMQ_PORT = 5677.
If it doesn't work, double-check your RabbitMQ configuration and/or look at the management UI to find out the AMQP port.

PyCharm remote debugging (pydevd) does not connect

PyCharm remote debugging (pydevd) does not connect with the following message:
error: [Errno 10061] No connection could be made because the target machine actively refused it
How can I troubleshoot it?
The output console in PyCharm shows:
Starting debug server at port 21000
Use the following code to connect to the debugger:
import pydevd
pydevd.settrace('*.*.*.*', port=21000, suspend=False)
Waiting for process connection...
Server stopped.
I checked the firewall and PyCharm is allowed for both incoming and outgoing connections.
10061 is WSAECONNREFUSED, 'connection refused', which means there was nothing listening at the IP:port you tried to connect to.
Though I see that you have validated its not a firewall issue, but still I would suggest to check the port numbers again with respect to the ones opened in windows firewall. Or to narrow down just run a simplehttpserver or icmp server at the same port and confirm.
In a direct link communication, it often means that you have already something connected to this port.
To check what process is hearing what port, check this SO question.
You can then either kill the program or change the port, depending of what you can do.
Without more information of the "remote tested", it is hard to know what is happening.
I was having the trouble as well (Server stopped as soon as the client connected).
Turned out that I had apparently too many breakpoints defined.
after having removed most of them and re-initiated my remote debug connection from the client (and having restarted the debug server in pycharm) it doesn't trigger anymore the "Server stopped." problem.

Can't connect to remote django server port 80

I'm having an issue running and connecting to my python django server on a windows 2012 server. To run the server I use command: python manage.py 0.0.0.0:80. This results in an error below
[Error 10013]: an attempt was made to access a socket in a way forbidden by its access permissions
I've tried running the command prompt as an administrator with no change. For reference, I am able to run the server on port 8000 but then I cannot connect to the port remotely. I have turned off firewalls as well so that is probably not the issue.
While it is preferable to run the django on port 80, I am trying to get this working on any port.
Port 80 (and many other ports) is reserved by Windows Server. Checkout this https://serverfault.com/questions/633179/cant-make-confluence-run-on-port-80-with-windows-server-2012-r2,
You may want to google "Windows Server Reserved port" for more info and a way to "unreserve" it.

How to use https for my application running on different port other than 443

My python application is running on port number 6666 on a linux machine to which I can connect using putty and I have sudo permissions to execute commands (I dont know root password)
1.If I change the port number in that application to 443 and if I run that application then getting some permission denied error at the time of socket binding
2.and if I use sudo for the above case then getting some module not found error.
If I open https://that_server_name:6666/path_to_my_appln from my localhost, then getting the error as cound not find response (as I am able to successfully run my application with port 6666, I ran the application and I tried to open that url)
or else if I open https://that_server_name:443/path_to_my_appln , then getting error as 503, service temporarily unavailable(as I am getting above mentioned errors for port number 443, so I did not start my application in backend)
My question is how to map 443 to an application running on 6666 port
In order to listen to a port below 1024 on Linux you need to have root permissions. You can
Run the program as root and secure it, for example by dropping privileges after binding to the socket.
Use a webserver (Apache, nginx, ...) to proxy the request.
Of cause there are some more solutions.
You should try to solve the problem of module not found error. That would be a good solution to your problem. If you post your module not found error that would be helpful. How are you running the Python application. Are you running it from a virtualenv?

Categories

Resources