Redis - server closed the connection / can't connect - node.js

I'm trying to get redis running locally. It works fine sometimes, but sometimes I have this problem when starting it. It appears to start fine, but then I can't make any connections to it or use the command line tool. I can't understand why there would be no errors when starting redis, it says its running on 6379, but won't respond on that port.
Toms-MBP:tinder-art tomchambers$ redis-server
[86521] 23 Apr 18:37:22.427 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[86521] 23 Apr 18:37:22.429 * Increased maximum number of open files to 10032 (it was originally set to 256).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.19 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 86521
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[86521] 23 Apr 18:37:22.431 # Server started, Redis version 2.8.19
[86521] 23 Apr 18:37:22.432 * DB loaded from disk: 0.000 seconds
[86521] 23 Apr 18:37:22.432 * The server is now ready to accept connections on port 6379
Toms-MBP:tinder-art tomchambers$ redis-cli monitor
Error: Server closed the connection
^CToms-MBP:tinder-art tomchambers$ node app.js
Connecting to local redis
Connecting to local redis
Server started 3000
Redis error: [Error: Ready check failed: Redis connection to 127.0.0.1:6379 failed - read ECONNRESET]
Redis error: [Error: Redis connection to 127.0.0.1:6379 failed - read ECONNRESET]
Redis error: [Error: Ready check failed: Redis connection to 127.0.0.1:6379 failed - read ECONNRESET]
Redis error: [Error: Redis connection to 127.0.0.1:6379 failed - read ECONNRESET]
Redis error: [Error: Ready check failed: Redis connection gone from end event.]
Redis error: [Error: Ready check failed: Redis connection gone from end event.]
Redis error: [Error: Ready check failed: Redis connection gone from end event.]
Redis error: [Error: Ready check failed: Redis connection gone from end event.]
Redis error: [Error: Ready check failed: Redis connection gone from end event.]

Related

lftp problem to upload files in runner gitlab-ci,yml

this message return on upload file:
$ lftp -c "debug; set ftp:ssl-force true; set ssl:verify-certificate false; open -u $FTP_HOST_DEPLOY_USERNAME,$FTP_HOST_DEPLOY_PASSWORD $FTP_HOST_DEPLOY; mirror -Renv ./dist/app ./public_html"
---- Resolving host address...
---- IPv6 is not supported or configured
---- 1 address found: 145.14.145.229
---- Connecting to [MASKED] (145.14.145.229) port 21
**** Socket error (Operation timed out) - reconnecting
---- Closing control socket
---- Connecting to [MASKED] (145.14.145.229) port 21
**** Socket error (Operation timed out) - reconnecting
---- Closing control socket
---- Connecting to [MASKED] (145.14.145.229) port 21
**** Socket error (Operation timed out) - reconnecting
---- Closing control socket
---- Connecting to [MASKED] (145.14.145.229) port 21
**** Socket error (Operation timed out) - reconnecting
---- Closing control socket
---- Connecting to [MASKED] (145.14.145.229) port 21

Error starting vreplication engine: error in connecting to mysql db with connection <nil> Vitess on kubernetes

kubernetes version: v1.16.3
linux version: 7.3.1611
Starting Vitess cluster on kubernetes using default operator.yaml and 101_initial_cluster.yaml, one of example-vttablet-zone1-xxx pod is restarting forever.
using kubectl logs -f example-vttablet-zone1-2548885007-46a852d0 -c vttablet to see the logs, i got
W0706 07:42:02.200507 1 tm_init.go:531] Cannot get current mysql port, will keep retrying every 1s: net.Dial(/vt/socket/mysql.sock) to local server failed: dial unix /vt/socket/mysql.sock: connect: no such file or directory (errno 2002) (sqlstate HY000)
E0706 07:42:02.285406 1 engine.go:213] Error starting vreplication engine: error in connecting to mysql db with connection <nil>, err net.Dial(/vt/socket/mysql.sock) to local server failed: dial unix /vt/socket/mysql.sock: connect: no such file or directory (errno 2002) (sqlstate HY000), will keep retrying.
E0706 07:42:02.285504 1 state_manager.go:276] Error transitioning to the desired state: MASTER, Serving, will keep retrying: net.Dial(/vt/socket/mysql.sock) to local server failed: dial unix /vt/socket/mysql.sock: connect: no such file or directory (errno 2002) (sqlstate HY000)
I0706 07:42:02.285527 1 state_manager.go:661] State: exiting lameduck
E0706 07:42:02.285539 1 tm_state.go:258] Cannot start query service: net.Dial(/vt/socket/mysql.sock) to local server failed: dial unix /vt/socket/mysql.sock: connect: no such file or directory (errno 2002) (sqlstate HY000)
I0706 07:42:02.285553 1 tm_state.go:305] Publishing state: alias:<cell:"zone1" uid:2548885007 > hostname:"10.233.107.217" port_map:<key:"grpc" value:15999 > port_map:<key:"vt" value:15000 > keyspace:"commerce" shard:"-" key_range:<> type:MASTER db_name_override:"vt_commerce" mysql_hostname:"10.233.107.217" master_term_start_time:<seconds:1625527268 nanoseconds:196807555 >
I didn't change any yaml in operator directory, anyone know why is this?

Failed to connect to Postgres database Postgres requires connecting to a specific database, the following databases were tried:

I'm getting this error when i try to connect my fabric-ca to use postgres as a database.
Using postgres database, connecting to database...
2019/10/22 09:21:16 [DEBUG] Database Name: fabriccaserver
2019/10/22 09:21:16 [DEBUG] Connecting to PostgreSQL server, using connection string: host=127.0.0.1 port=5432 user=**** password=**** dbname=fabriccaserver sslmode=disable
2019/10/22 09:21:16 [WARNING] Failed to connect to database 'fabriccaserver'
2019/10/22 09:21:16 [DEBUG] Connecting to PostgreSQL server, using connection string: host=127.0.0.1 port=5432 user=**** password=**** dbname=postgres sslmode=disable
2019/10/22 09:21:16 [WARNING] Failed to connect to database 'postgres'
2019/10/22 09:21:16 [DEBUG] Connecting to PostgreSQL server, using connection string: host=127.0.0.1 port=5432 user=**** password=**** dbname=template1 sslmode=disable
2019/10/22 09:21:16 [WARNING] Failed to connect to database 'template1'
2019/10/22 09:21:16 [ERROR] Error occurred initializing database: Failed to connect to Postgres database. Postgres requires connecting to a specific database, the following databases were tried: [fabriccaserver postgres template1]. Please create one of these database before continuing
I solved this error by putting container_name in the host i,e.
db:
db:
type: postgres
datasource: host=db-postgres port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable
tls:
enabled: false
certfiles:
client:
certfile:
keyfile:
Previously, i was entering localhost and also tried with 127.0.0.1 and after that i saw that in my docker-compose.yaml my postgres service was under different network and ica.org1.example.com was under different network which i fixed and also had to do docker network prune after killing and removing all the docker processes.

Unable run mongo shell in Ubuntu 16.04 after restart

I am unable to access mongo shell in Ubuntu 16.04, but am able to run
sudo mongod
and its working , but when i try to run
mongo or sudo mongo
the following error raises
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017 2017-07-26T14:33:50.413+0000
W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking
socket for error after poll), reason: Connection refused
2017-07-26T14:33:50.414+0000 E QUERY [thread1] Error: couldn't
connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:237:13 #(connect):1:6
exception: connect failed
Print the last line of cat /var/log/mongodb/mongod.log and the content of /etc/mongod.conf.
Ensure that in /etc/mongod.conf the dbPath exists, the port is correctly bind to 27017, host is 127.0.0.1
In addition try to remove the mongod socket file /tmp/mongodb-27017.sock

How to connect to redis which is running on EC2, from node.js application running on local system using Express.js?

I am writing an Node.js application on Express.js. I have a Redis server installed on an EC2 instance running on UBUNTU Server 16.04. I have installed npm modules for Redis.I have mentioned the port and the host like this:-
var redis = require('redis');
var client = redis.createClient(6379,"127.0.0.1");
When I try connecting to EC2 instance of Redis, I get an error like this:-
events.js:141
throw er; // Unhandled 'error' event
^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1061:14)
How do I connect to redis which is running on ec2?
from the error message, it seems like redis isn't actually running on your host. i would check that redis is indeed running like this:
ps auxwg | grep redis
and check for a running redis process. another, simpler way would be to use the 'telnet' command to attempt to connect your local redis instance like:
wintermute:~ 07:52:58 melgart$ telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
in my case, redis is up and running so i get the 'connected' response. HTH

Resources