You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过远程服务器/URL运行Redis客户端及查看Redis连接列表?

Redis Remote Client Connection & Connection List Queries

Hey there, let's walk through your questions step by step:

1. How to run a Redis client against a remote server?

Connecting to a remote Redis instance with the official redis-cli tool is straightforward—here are your go-to options, depending on server authentication requirements:

  • Basic connection (no password): Use the -h flag to specify the remote server's IP/hostname, and -p for the port (you can skip -p if using the default 6379 port).
    Example:
    redis-cli -h 10.0.0.5 -p 6379
    
  • Connection with password authentication: Either pass the password directly with the -a flag, or connect first then authenticate with the AUTH command.
    Example with -a:
    redis-cli -h 10.0.0.5 -p 6379 -a mySecurePassword123
    
    Example with post-connection auth:
    redis-cli -h 10.0.0.5 -p 6379
    # Once connected, run:
    AUTH mySecurePassword123
    

2. How to run a Redis client via a remote URL, and how to get the list of connections in Redis cache?

Connecting via a remote URL

Redis supports URL-based connection strings with redis-cli, which is great for scripting or quick one-off connections. The URL format is:
redis://[:password@]host:port/database_number

  • No password, default database (0):
    redis-cli redis://10.0.0.5:6379
    
  • With password and specific database:
    redis-cli redis://:mySecurePassword123@10.0.0.5:6379/2
    

Retrieving active connections

To get full details about all current client connections to your Redis server, use the INFO clients command. When you run this in the connected client, it returns a section with metrics like total connected clients, plus a detailed list of each connection's metadata (IP address, port, idle time, etc.).

Example output snippet:

Clients

connected_clients:7
blocked_clients:0
client_list:id=4 addr=192.168.1.20:45678 fd=6 name= age=24 idle=5 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=ping

For a more concise, line-by-line breakdown of every connection, use the CLIENT LIST command directly—each line represents a single client connection with all its associated details.

内容的提问来源于stack exchange,提问作者Manish

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:28:37