Could not connect to Redis at 127.0.0.1:6379: Name or service not known




Asked on August 04, 2018
Hi, I am trying to connect Redis CLI with Redis server locally but unable to connect it. I am following the steps.

Step-1:

$ redis-server
5936:C 04 Aug 15:04:06.955 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5936:C 04 Aug 15:04:06.955 # Redis version=4.0.10, bits=64, commit=00000000, mod           ified=0, pid=5936, just started
5936:C 04 Aug 15:04:06.955 # Warning: no config file specified, using the defaul           t config. In order to specify a config file use src/redis-server /path/to/redis.           conf
5936:M 04 Aug 15:04:06.958 # You requested maxclients of 10000 requiring at leas           t 10032 max file descriptors.
5936:M 04 Aug 15:04:06.958 # Server can't set maximum open files to 10032 becaus           e of OS error: Too many open files.
5936:M 04 Aug 15:04:06.958 # Current maximum open files is 3200. maxclients has            been reduced to 3168 to compensate for low ulimit. If you need higher maxclients            increase 'ulimit -n'.
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 4.0.10 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 5936
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

5936:M 04 Aug 15:04:06.969 # Server initialized
5936:M 04 Aug 15:04:06.970 * DB loaded from disk: 0.001 seconds
5936:M 04 Aug 15:04:06.970 * Ready to accept connections

Step-2: Opening another command prompt and running redis cli

$ redis-cli
Could not connect to Redis at 127.0.0.1:6379: Name or service not known
Aborted (core dumped)

What is going wrong?



Replied on August 04, 2018
Use localhost instead of 127.0.0.1 and try. It could be that any Firewall is blocking 127.0.0.1
 
You can use -h and -p to assign server host and port.

$ redis-cli -h localhost -p 6379



Replied on August 04, 2018
Thanks. It is working.

Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us