3

I have followed all the steps from link: https://linuxtechlab.com/how-install-redis-server-linux/ and using below linux version.

uname -a

Linux ech-10-XX-XX-28 2.6.32-696.13.2.el6.x86_64 #1 SMP Thu Oct 5 17:03:21 PDT 2017 x86_64 x86_64 x86_64 GNU/Linux

This is installed somewhere on cloud on virtual machine and from local windows machine I am trying to access the redis getting below error mentioned here: nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool.

My Windows machine:

C:\Softwares\redis-2.4.5-win32-win64\64bit>redis-cli -h 10.XX.XX.28 -P 6379
Could not connect to Redis at 10.XX.XX.28:6379: Unknown error

Redis installed on Linux machine:

[user@10.XX.XX-28:~]$ redis-cli
127.0.0.1:6379> KEYS *
1) "Prateek"
127.0.0.1:6379>

The version of redis installed on Unix

[user@10.XX.XX.28:~]$ redis-server --version
Redis server v=3.2.9 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=d8a68cad035640c6
Community
  • 1
  • 1
Jeff Cook
  • 7,956
  • 36
  • 115
  • 186

2 Answers2

5

I was able to solve this issue like below: "Accessing redis from remote system"

By default, redis is accessible from localhost but if you wish to access redis server from a remote location then we need to make some changes in the configuration file. Open the configuration file for the instance, i.e. /etc/6379.conf

$ vi /etc/redis/6379.conf

& look for ‘bind 127.0.0.1’. We can either replace 127.0.0.1 with 0.0.0.0 or add IP address of our server to it. It should look like

bind 0.0.0.0

or

bind 127.0.0.1 192.168.1.100

Now exit the file after saving the changes & restart the service for changes to take effect.

$ service redis_6379 restart

Remember if using multiple or different port numbers, changes are to made to all the configuration files for respective port numbers.

Now to check if we can login to redis from a remote system, login to remote system first & enter the following command from terminal,

$ redis-cli -h 192.168.1.100 -p 6379

where, 192.168.1.100 is the IP address of the redis server with 6379 as the redis instance port number.

Done :)

Perform if any issues: yum install make gcc gcc-c++ kernel-devel

Jeff Cook
  • 7,956
  • 36
  • 115
  • 186
  • I am able to connect to remote redis server with IP address as you mentioned. But when I try to use hostname, it is not working. It shows Unknown error. – Savan Gadhiya Jun 10 '20 at 09:52
2

For me redis server was not running.

Follow the below steps if you are in Windows.

1. Press winKey+R
2. Type services.msc
3. You will see a window with list of services.
4. Find Redis and start it. Stop and restart it if it is already running!
Kanagalingam
  • 2,096
  • 5
  • 23
  • 40