10.Redis-服务器命令
echo,在命令行打印一些内容
select,选择数据库。Redis数据库编号从0-15,可以选择任意一个数据库来进行数据的存取。
quit,退出连接。相当于Ctrl+C
dbsize,返回当前数据库中key的数目。
info,获取服务器的信息和统计。
# Server redis_version:3.0.0 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:25b1b3662f22f990 redis_mode:standalone os:Linux 2.6.32-431.el6.i686 i686 arch_bits:32 multiplexing_api:epoll gcc_version:4.4.7 process_id:5976 run_id:86add8274178fff35cb3ca18c9d0f372494f3732 tcp_port:6379 uptime_in_seconds:52430 uptime_in_days:0 hz:10 lru_clock:1603759 config_file:/usr/local/redis/./redis.conf//配置文件位置 # Clients connected_clients:2//当前有两个客户端连接 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0 # Memory used_memory:659496 used_memory_human:644.04K used_memory_rss:1908736 used_memory_peak:659496 used_memory_peak_human:644.04K used_memory_lua:23552 mem_fragmentation_ratio:2.89 mem_allocator:jemalloc-3.6.0 # Persistence loading:0 rdb_changes_since_last_save:1 rdb_bgsave_in_progress:0 rdb_last_save_time:1595438698 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:7 total_commands_processed:248 instantaneous_ops_per_sec:0 total_net_input_bytes:8827 total_net_output_bytes:10824 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:1 evicted_keys:0 keyspace_hits:121 keyspace_misses:14 pubsub_channels:0 pubsub_patterns:0 latest_fork_usec:596 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:57.81 used_cpu_user:26.55 used_cpu_sys_children:0.05 used_cpu_user_children:0.01 # Cluster cluster_enabled:0 # Keyspace db0:keys=11,expires=0,avg_ttl=0数据库0有11个key db1:keys=1,expires=0,avg_ttl=0数据库1有1个key
flushdb,删除当前选择数据库中的所有key。
flushall,删除所有数据库中的所有key。