问题
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
回答1:
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
来源:https://stackoverflow.com/questions/51427713/could-not-connect-to-redis-at-10-xx-xx-286379-unknown-error-while-accessing