无法在 10.XX.XX.28:6379 连接到 Redis:未知错误 - 从 Spring Batch 或 Windows 机器访问时 [英] Could not connect to Redis at 10.XX.XX.28:6379: Unknown error - while accessing from Spring Batch or windows machine

查看:41
本文介绍了无法在 10.XX.XX.28:6379 连接到 Redis:未知错误 - 从 Spring Batch 或 Windows 机器访问时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照链接中的所有步骤操作:https://linuxtechlab.com/how-install-redis-server-linux/ 并使用以下 linux 版本.

<块引用>

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

这是安装在虚拟机和本地 Windows 机器上的云上的某个地方我试图访问 redis,这里提到的错误如下:嵌套异常是redis.clients.jedis.exceptions.JedisConnectionException:无法从资源池中获取资源.>

我的 Windows 机器:

C:Softwares
edis-2.4.5-win32-win6464bit>redis-cli -h 10.XX.XX.28 -P 6379无法在 10.XX.XX.28:6379 连接到 Redis:未知错误

Redis 安装在 Linux 机器上:

[user@10.XX.XX-28:~]$ redis-cli127.0.0.1:6379>钥匙 *1) Prateek"127.0.0.1:6379>

Unix下安装的redis版本

[user@10.XX.XX.28:~]$ redis-server --versionRedis 服务器 v=3.2.9 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=d8a68cad035640c6

解决方案

我能够像下面这样解决这个问题:从远程系统访问 redis"

默认情况下,redis 可以从 localhost 访问,但是如果您希望从远程位置访问 redis 服务器,那么我们需要在配置文件中进行一些更改.打开实例的配置文件,即/etc/6379.conf

$ vi/etc/redis/6379.conf

&寻找‘bind 127.0.0.1’.我们可以将 127.0.0.1 替换为 0.0.0.0 或添加我们服务器的 IP 地址.它应该看起来像

绑定 0.0.0.0

绑定 127.0.0.1 192.168.1.100

现在保存更改后退出文件 &重新启动服务以使更改生效.

$ service redis_6379 重启

请记住,如果使用多个或不同的端口号,则需要对各个端口号的所有配置文件进行更改.

现在要检查我们是否可以从远程系统登录redis,首先登录到远程系统&从终端输入以下命令,

$ redis-cli -h 192.168.1.100 -p 6379

其中,192.168.1.100是redis服务器的IP地址,redis实例端口号为6379.

完成:)

如有问题请执行:yum install make gcc gcc-c++ kernel-devel

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
edis-2.4.5-win32-win6464bit>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

解决方案

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

这篇关于无法在 10.XX.XX.28:6379 连接到 Redis:未知错误 - 从 Spring Batch 或 Windows 机器访问时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆