如何连接到远程Redis服务器? [英] How to connect to remote Redis server?

查看:50
本文介绍了如何连接到远程Redis服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有远程 Redis 服务器的 URL 和端口.我可以从 Scala 写入 Redis.但是我想通过终端使用 redis-server 或类似的东西连接到远程 Redis,以便多次调用 hgetget 等.(我可以用我本地安装的 Redis 做到这一点,没有任何问题).

I have URL and PORT of remote Redis server. I am able to write into Redis from Scala. However I want to connect to remote Redis via terminal using redis-server or something similar in order to make several call of hget, get, etc. (I can do it with my locally installed Redis without any problem).

推荐答案

redis-cli -h XXX.XXX.XXX.XXX -p YYYY

xxx.xxx.xxx.xxx 是 IP 地址,yyyy 是端口

xxx.xxx.xxx.xxx is the IP address and yyyy is the port

来自我的开发环境的示例

EXAMPLE from my dev environment

redis-cli -h 10.144.62.3 -p 30000

REDIS CLI 命令

主机、端口、密码和数据库 默认redis-cli连接到服务器在 127.0.0.1 端口 6379.你可以猜到,你可以很容易地改变这使用命令行选项.指定不同的主机名或IP 地址,使用 -h.要设置不同的端口,请使用 -p.

Host, port, password and database By default redis-cli connects to the server at 127.0.0.1 port 6379. As you can guess, you can easily change this using command line options. To specify a different host name or an IP address, use -h. In order to set a different port, use -p.

redis-cli -h redis15.localnet.org -p 6390 ping

redis-cli -h redis15.localnet.org -p 6390 ping

这篇关于如何连接到远程Redis服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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