linux redis 查看客户端连接数量,redis查看最大连接数及其他参数

场景

集群项目总是报连接超时,想看下到底是有多少连接。

过程

连接并查看参数

客户端可以看redis参数么,肯定是可以的,命令:

/usr/bin/redis -a ***password # 连接redis

查看参数:

info # 查看所有信息

info clients # 查看连接数等客户端信息,可用值有server,memory等

info命令报错:NOAUTH Authentication required.

无密码连接,然后输入 info 命令就会报这个错。 是因为默认连接方式没有查看权限。

使用带密码的登录方式即可。

info参数列表

info可以查看所有参数。

info 模块名可以看对应的模块,如 info server,info memory等。

一般用 info clients 命令就可以了,输出内容如下:

# Clients

connected_clients:865 # 链接数

client_recent_max_input_buffer:4

client_recent_max_output_buffer:0

blocked_clients:0

client list 查看连接列表

有很多字段,age表示创建时间(秒) idle表示空闲时间(秒)

idle时间过长 表示一直空置,可以干掉

age=idle 表示创建后就没有用过,也可以干掉

查看超时设置

config get timeout # 查看超时设置

config set timeout 300 # 设置超时时间(秒)

config get * # 查看所有的配置列表

info 所有参数列表

所有参数列表:

# Server

redis_version:3.2.12

redis_git_sha1:00000000

redis_git_dirty:0

redis_build_id:7897e7d0e13773f

redis_mode:standalone

os:Linux 3.10.0-957.21.3.el7.x86_64 x86_64

arch_bits:64

multiplexing_api:epoll

gcc_version:4.8.5

process_id:29031

run_id:c810b029bd8eea504cbcd4b466cf1e18c6948f7e

tcp_port:6379

uptime_in_seconds:7308611

uptime_in_days:84

hz:10

lru_clock:13908165

executable:/usr/bin/redis-server

config_file:/etc/redis.conf

# Clients

connected_clients:1

client_longest_output_list:0

client_biggest_input_buf:0

blocked_clients:0

# Memory

used_memory:813696

used_memory_human:794.62K

used_memory_rss:1810432

used_memory_rss_human:1.73M

used_memory_peak:5022056

used_memory_peak_human:4.79M

total_system_memory:3973533696

total_system_memory_human:3.70G

used_memory_lua:37888

used_memory_lua_human:37.00K

maxmemory:0

maxmemory_human:0B

maxmemory_policy:noeviction

mem_fragmentation_ratio:2.22

mem_allocator:jemalloc-3.6.0

# Persistence

loading:0

rdb_changes_since_last_save:0

rdb_bgsave_in_progress:0

rdb_last_save_time:1590722687

rdb_last_bgsave_status:ok

rdb_last_bgsave_time_sec:0

rdb_current_bgsave_time_sec:-1

aof_enabled:0

aof_rewrite_in_progress:0

aof_rewrite_scheduled:0

aof_last_rewrite_time_sec:-1

aof_current_rewrite_time_sec:-1

aof_last_bgrewrite_status:ok

aof_last_write_status:ok

# Stats

total_connections_received:446262

total_commands_processed:1143019

instantaneous_ops_per_sec:0

total_net_input_bytes:110594091

total_net_output_bytes:724507868

instantaneous_input_kbps:0.00

instantaneous_output_kbps:0.00

rejected_connections:0

sync_full:0

sync_partial_ok:0

sync_partial_err:0

expired_keys:9814

evicted_keys:0

keyspace_hits:54673

keyspace_misses:10209

pubsub_channels:0

pubsub_patterns:0

latest_fork_usec:212

migrate_cached_sockets:0

# Replication

role:master

connected_slaves:0

master_repl_offset:0

repl_backlog_active:0

repl_backlog_size:1048576

repl_backlog_first_byte_offset:0

repl_backlog_histlen:0

# CPU

used_cpu_sys:2315.55

used_cpu_user:1439.36

used_cpu_sys_children:1.90

used_cpu_user_children:1.28

# Cluster

cluster_enabled:0

# Keyspace

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值