SequelizeConnectionRefusedError errno:-111 ECONNREFUSED - node.js

I got following exception on node.js express and how can I troubleshoot it?
{"name":"SequelizeConnectionRefusedError","parent":{"errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":6432},"original":{"errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":6432}}

You are getting this exception because your app cannot connect to the database server in localhost and port 6432.
Please make sure your database server is up and running on port 6432 in your localhost

Related

Mongodb crud with an ionic application

I created a database on a remote server. I created a js file to connect to the database using mongoose, express, body-parser.
I made a connection to the remote server with the following command:
mongoose.connect ("mongodb: //176.31.212.51: 27017 / db")
I test the connection and I have a successful connection,
I launched a "listener" to listen on the port as follows:
app.listen (process.env.PORT)
with the port = 3000
I tested and I got an error.
Is there any solution to make a successful connection with the ionic application to do the operations of CRUD?

Socket.io, connect to socket inside docker container

My app is using websocket with Socket.io library. On the fronted, I open a connection to a backend socket like this :
io.connect(window.location.origin)
Everything is working fine when my backend is running on my computer. But when I run it inside a docker container, I get this error on my client:
WebSocket connection to 'ws://localhost/socket.io/?EIO=3&transport=websocket' failed: Invalid frame header
Figured out that I must make the socket listen on '0.0.0.0'

Error connecting to my redis server from my code

io.adapter(redis({ host: config.redisHost, port: config.redisPort }));
Both the confif.redisHost and config.redisPort are the correct values, but when I try to connect from my code I get the error -
'Error: Redis connection to 104.xxx.xx.xxx:6379 failed - connect ECONNREFUSED 104.xxx.xx.xxx:6379'
In redis.conf I've changed the bind to 0.0.0.0 as well as removing it completely and I've also tried setting protected mode to off just to try and get the connection working.
The IP and port are definitely, correct. Does anyone know why I might not be able to access the server from my code? My code is just being ran on my local machine and the redis server is being ran on a digital ocean ubuntu 14.04 machine. The status of the server is definitely running and I can access the redis-cli from the machine itself.
For some reason, it wasn't using redis.conf when I tried starting the server, I had to manually tell it to use it when starting up, now it's working.

Nodejs : Error get/response localhost

I'm running a Cakephp app with MAMP on localhost at port 80. I've also Node.js who listen/write on port 4000 with a js script from the Cake app (localhost/client).
When I call Node from js app, it works.
But, when I try to call a Cakephp page (localhost/saveData/123) from Node by http.get(); oder http.request for saving data in database, it crash.
events.js:71
throw arguments[1]; // Unhandled 'error' event
^ Error: connect ECONNREFUSED
at errnoException (net.js:770:11)
at Object.afterConnect [as oncomplete] (net.js:761:19)
Oder
problem with request: connect ECONNREFUSED
I've test width www.google.com, it works. It seems that's the problem is about "localhost".
Could someone help me? :)
EDIT : I've try with 127.0.0.1 too but it doesn't work (for MAMP and Node).
PS : sorry for my english, i'm french :)
Probably you have a local webserver running on port 80. Also programs like Skype can be connected to the port 80.
You can try close Skype and/or Webserver (XAMPP, WAMPP, usbwebserver, etc...).
Listing ports in Cmd.exe
$ netstat -a

Unable to connect to PostgreSQL server: could not connect to server: Permission denied

Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running on host "10.0.1.201" and accepting TCP/IP connections on port 5432?
This is the error i am getting when trying to connect to remote database from linux based server
Though i am able to connect to it from localhost
Can anyone help me in this
One possible scenario/solution that worked for me (for the very same problem) is here:
service httpd stop
service postgresql stop
setsebool -P httpd_can_network_connect 1
service httpd start
service postgresql start
Here we're basically allowing HTTPD to connect to PostgreSQL over network by setting SELinux bool equals to 1 (true).
Check the listen_addresses setting in postgresql.conf. If it is set to localhost, then only loopback connections will be accepted, and remote connections will get a "connection refused" error. Set listen_addresses to "*" to enable listening on all interfaces.
In PostgreSQL you have to configure client authentication in pg_hba.conf on the remote server.
Read more about pg_hba.conf # http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html , otherwise you'll never connect to that server :).
Hope it will help,
Stefan

Resources