查看redis端口命令
[root@VM-20-17-centos etc]# ps -ef|grep redis
redis 1257 1 0 Nov20 ? 00:02:06 /usr/bin/redis-server 0.0.0.0:6379
root 6340 6653 0 15:27 pts/0 00:00:00 grep --color=auto redis
发现redis-server对应端口为1257
查看redis对应的路径,并进入路径
[root@VM-20-17-centos etc]# ls -l /proc/1257/cwd
lrwxrwxrwx 1 redis redis 0 Nov 20 11:41 /proc/1257/cwd -> /etc
[root@VM-20-17-centos etc]# cd /etc
进入redis,执行操作
[root@VM-20-17-centos etc]# /bin/redis-cli # 进入redis
127.0.0.1:6379> dbsize # 当看到127.0.0.1:6379就知道进入成功
(integer) 26
127.0.0.1:6379> flushall # 清理缓存
OK
127.0.0.1:6379> dbsize # 查看当前的缓存数量
(integer) 0
127.0.0.1:6379> keys * # key的个数
(empty list or set)
127.0.0.1:6379> exit # 退出redis
References:
https://blog.csdn.net/changyana/article/details/123289897
标签:Cent7.9,127.0,20,etc,0.1,redis,6379,Linux From: https://www.cnblogs.com/HomeOFMarmot/p/18563007