[root@localhost ~]# cd /myredis [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 26 1月 17 20:36 dumpfiles -rw-r--r--. 1 root root 107540 1月 17 20:06 redis.conf [root@localhost myredis]# cd /dumpfiles bash: cd: /dumpfiles: 没有那个文件或目录 [root@localhost myredis]# cd dumpfiles [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 100 1月 17 20:36 dump6379.rdb [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 100 1月 17 20:36 dump6379.rdb [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 107 1月 17 20:37 dump6379.rdb [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 107 1月 17 20:37 dump6379.rdb [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 114 1月 17 20:38 dump6379.rdb [root@localhost dumpfiles]# date -d @1705495130 2024年 01月 17日 星期三 20:38:50 CST [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 128 1月 18 10:58 dump6379.rdb [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 88 1月 18 10:59 dump6379.rdb [root@localhost dumpfiles]# rm -f dump6379.rdb [root@localhost dumpfiles]# ll 总用量 0 [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb [root@localhost dumpfiles]# ps -ef|grep redis root 6353 1 0 10:22 ? 00:00:03 redis-server *:6379 root 6373 2635 0 10:22 pts/0 00:00:00 redis-cli -a abc123 root 7138 6600 0 11:00 pts/1 00:00:00 grep --color=auto redis [root@localhost dumpfiles]# kill -9 6353 [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb [root@localhost dumpfiles]# ll 总用量 4 -rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb [root@localhost dumpfiles]# cd /usr/local/bin [root@localhost bin]# ll 总用量 29240 -rwxr-xr-x. 1 root root 6900280 1月 16 17:02 redis-benchmark lrwxrwxrwx. 1 root root 12 1月 16 17:02 redis-check-aof -> redis-server lrwxrwxrwx. 1 root root 12 1月 16 17:02 redis-check-rdb -> redis-server -rwxr-xr-x. 1 root root 7620152 1月 16 17:02 redis-cli lrwxrwxrwx. 1 root root 12 1月 16 17:02 redis-sentinel -> redis-server -rwxr-xr-x. 1 root root 15416160 1月 16 17:02 redis-server [root@localhost bin]# redis-check-rdb /myredis/dumpfiles/dump6379.rdb [offset 0] Checking RDB file /myredis/dumpfiles/dump6379.rdb [offset 26] AUX FIELD redis-ver = '7.2.4' [offset 40] AUX FIELD redis-bits = '64' [offset 52] AUX FIELD ctime = '1705546802' [offset 67] AUX FIELD used-mem = '1086472' [offset 79] AUX FIELD aof-base = '0' [offset 81] Selecting DB ID 0 [offset 107] Checksum OK [offset 107] \o/ RDB looks OK! \o/ [info] 2 keys read [info] 0 expires [info] 0 already expired
[root@localhost ~]# cd /myredis
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 26 1月 17 20:36 dumpfiles
-rw-r--r--. 1 root root 107540 1月 17 20:06 redis.conf
[root@localhost myredis]# cd /dumpfiles
bash: cd: /dumpfiles: 没有那个文件或目录
[root@localhost myredis]# cd dumpfiles
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 100 1月 17 20:36 dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 100 1月 17 20:36 dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 107 1月 17 20:37 dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 107 1月 17 20:37 dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 114 1月 17 20:38 dump6379.rdb
[root@localhost dumpfiles]# date -d @1705495130
2024年 01月 17日 星期三 20:38:50 CST
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 128 1月 18 10:58 dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 88 1月 18 10:59 dump6379.rdb
[root@localhost dumpfiles]# rm -f dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 0
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb
[root@localhost dumpfiles]# ps -ef|grep redis
root 6353 1 0 10:22 ? 00:00:03 redis-server *:6379
root 6373 2635 0 10:22 pts/0 00:00:00 redis-cli -a abc123
root 7138 6600 0 11:00 pts/1 00:00:00 grep --color=auto redis
[root@localhost dumpfiles]# kill -9 6353
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb
[root@localhost dumpfiles]# ll
总用量 4
-rw-r--r--. 1 root root 107 1月 18 11:00 dump6379.rdb
[root@localhost dumpfiles]# cd /usr/local/bin
[root@localhost bin]# ll
总用量 29240
-rwxr-xr-x. 1 root root 6900280 1月 16 17:02 redis-benchmark
lrwxrwxrwx. 1 root root 12 1月 16 17:02 redis-check-aof -> redis-server
lrwxrwxrwx. 1 root root 12 1月 16 17:02 redis-check-rdb -> redis-server
-rwxr-xr-x. 1 root root 7620152 1月 16 17:02 redis-cli
lrwxrwxrwx. 1 root root 12 1月 16 17:02 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 15416160 1月 16 17:02 redis-server
[root@localhost bin]# redis-check-rdb /myredis/dumpfiles/dump6379.rdb
[offset 0] Checking RDB file /myredis/dumpfiles/dump6379.rdb
[offset 26] AUX FIELD redis-ver = '7.2.4'
[offset 40] AUX FIELD redis-bits = '64'
[offset 52] AUX FIELD ctime = '1705546802'
[offset 67] AUX FIELD used-mem = '1086472'
[offset 79] AUX FIELD aof-base = '0'
[offset 81] Selecting DB ID 0
[offset 107] Checksum OK
[offset 107] \o/ RDB looks OK! \o/
[info] 2 keys read
[info] 0 expires
[info] 0 already expired
127.0.0.1:6379> keys * 1) "k6" 2) "k5" 3) "k7" 127.0.0.1:6379> set k1 v1 OK 127.0.0.1:6379> set k2 v2 OK 127.0.0.1:6379> set k3 v3 OK 127.0.0.1:6379> keys * 1) "k6" 2) "k1" 3) "k3" 4) "k5" 5) "k7" 6) "k2" 127.0.0.1:6379> flushall OK 127.0.0.1:6379> keys * (empty array) 127.0.0.1:6379> set k1 v1 OK 127.0.0.1:6379> set k2 v2 OK 127.0.0.1:6379> set k3 v3 OK 127.0.0.1:6379> ll (error) ERR unknown command 'll', with args beginning with: 127.0.0.1:6379> keys * Error: Server closed the connection not connected> quit [root@localhost myredis]# redis-server /myredis/redis.conf [root@localhost myredis]# redis-cli -a abc123 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 127.0.0.1:6379> keys * 1) "k2" 2) "k1" 127.0.0.1:6379> get k1 "v1" 127.0.0.1:6379> get k2 "v2" 127.0.0.1:6379> shutdown not connected> quit [root@localhost myredis]# redis-server /myredis/redis.conf [root@localhost myredis]# redis-cli -a abc123 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 127.0.0.1:6379> keys * (empty array) 127.0.0.1:6379> set k1 v1 OK 127.0.0.1:6379> set k2 v2 OK 127.0.0.1:6379> set k3 v3 OK 127.0.0.1:6379> keys * 1) "k3" 2) "k1" 3) "k2" 127.0.0.1:6379> flushdb OK 127.0.0.1:6379> keys * (empty array) 127.0.0.1:6379> shutdown not connected> quit [root@localhost myredis]# redis-server /myredis/redis.conf [root@localhost myredis]# redis-cli -a abc123 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 127.0.0.1:6379> keys * 1) "k1" 2) "k3" 3) "k2" 127.0.0.1:6379> set k4 v4 OK 127.0.0.1:6379> get k4 "v4"
127.0.0.1:6379> keys *
1) "k6"
2) "k5"
3) "k7"
127.0.0.1:6379> set k1 v1
OK
127.0.0.1:6379> set k2 v2
OK
127.0.0.1:6379> set k3 v3
OK
127.0.0.1:6379> keys *
1) "k6"
2) "k1"
3) "k3"
4) "k5"
5) "k7"
6) "k2"
127.0.0.1:6379> flushall
OK
127.0.0.1:6379> keys *
(empty array)
127.0.0.1:6379> set k1 v1
OK
127.0.0.1:6379> set k2 v2
OK
127.0.0.1:6379> set k3 v3
OK
127.0.0.1:6379> ll
(error) ERR unknown command 'll', with args beginning with:
127.0.0.1:6379> keys *
Error: Server closed the connection
not connected> quit
[root@localhost myredis]# redis-server /myredis/redis.conf
[root@localhost myredis]# redis-cli -a abc123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> keys *
1) "k2"
2) "k1"
127.0.0.1:6379> get k1
"v1"
127.0.0.1:6379> get k2
"v2"
127.0.0.1:6379> shutdown
not connected> quit
[root@localhost myredis]# redis-server /myredis/redis.conf
[root@localhost myredis]# redis-cli -a abc123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> keys *
(empty array)
127.0.0.1:6379> set k1 v1
OK
127.0.0.1:6379> set k2 v2
OK
127.0.0.1:6379> set k3 v3
OK
127.0.0.1:6379> keys *
1) "k3"
2) "k1"
3) "k2"
127.0.0.1:6379> flushdb
OK
127.0.0.1:6379> keys *
(empty array)
127.0.0.1:6379> shutdown
not connected> quit
[root@localhost myredis]# redis-server /myredis/redis.conf
[root@localhost myredis]# redis-cli -a abc123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> keys *
1) "k1"
2) "k3"
3) "k2"
127.0.0.1:6379> set k4 v4
OK
127.0.0.1:6379> get k4
"v4"
[root@localhost ~]# cd /myredis [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir drwxr-xr-x. 2 root root 26 1月 18 11:33 dumpfiles -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# ll 总用量 112 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir -rw-r--r--. 1 root root 107 1月 18 11:35 dump6379.rdb drwxr-xr-x. 2 root root 26 1月 18 11:33 dumpfiles -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# cd appendonlydir [root@localhost appendonlydir]# ll 总用量 12 -rw-r--r--. 1 root root 88 1月 18 11:34 appendonly.aof.1.base.rdb -rw-r--r--. 1 root root 110 1月 18 11:35 appendonly.aof.1.incr.aof -rw-r--r--. 1 root root 88 1月 18 11:34 appendonly.aof.manifest [root@localhost appendonlydir]# cd .. [root@localhost myredis]# pwd /myredis [root@localhost myredis]# ll 总用量 112 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir -rw-r--r--. 1 root root 107 1月 18 11:35 dump6379.rdb -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# rm -f dump6379.rdb [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# cp -r appendonlydir/ appendonlydir.bak [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# ll 总用量 112 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak -rw-r--r--. 1 root root 88 1月 18 11:39 dump6379.rdb -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# rm -f dump6379.rdb [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# ll 总用量 112 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak -rw-r--r--. 1 root root 88 1月 18 11:40 dump6379.rdb -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# rm -f dump6379.rdb [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# rm -rf appendonlydir [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# mv appendonlydir.bak appendonlydir [root@localhost myredis]# ll 总用量 108 drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir -rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf [root@localhost myredis]# cd appendonlydir [root@localhost appendonlydir]# ll 总用量 12 -rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.1.base.rdb -rw-r--r--. 1 root root 110 1月 18 11:38 appendonly.aof.1.incr.aof -rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.manifest [root@localhost appendonlydir]# ll 总用量 12 -rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.1.base.rdb -rw-r--r--. 1 root root 162 1月 18 11:44 appendonly.aof.1.incr.aof -rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.manifest [root@localhost appendonlydir]# ll 总用量 12 -rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.1.base.rdb -rw-r--r--. 1 root root 162 1月 18 11:44 appendonly.aof.1.incr.aof -rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.manifest
[root@localhost ~]# cd /myredis
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
drwxr-xr-x. 2 root root 26 1月 18 11:33 dumpfiles
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# ll
总用量 112
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
-rw-r--r--. 1 root root 107 1月 18 11:35 dump6379.rdb
drwxr-xr-x. 2 root root 26 1月 18 11:33 dumpfiles
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# cd appendonlydir
[root@localhost appendonlydir]# ll
总用量 12
-rw-r--r--. 1 root root 88 1月 18 11:34 appendonly.aof.1.base.rdb
-rw-r--r--. 1 root root 110 1月 18 11:35 appendonly.aof.1.incr.aof
-rw-r--r--. 1 root root 88 1月 18 11:34 appendonly.aof.manifest
[root@localhost appendonlydir]# cd ..
[root@localhost myredis]# pwd
/myredis
[root@localhost myredis]# ll
总用量 112
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
-rw-r--r--. 1 root root 107 1月 18 11:35 dump6379.rdb
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# rm -f dump6379.rdb
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# cp -r appendonlydir/ appendonlydir.bak
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# ll
总用量 112
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak
-rw-r--r--. 1 root root 88 1月 18 11:39 dump6379.rdb
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# rm -f dump6379.rdb
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# ll
总用量 112
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak
-rw-r--r--. 1 root root 88 1月 18 11:40 dump6379.rdb
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# rm -f dump6379.rdb
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 103 1月 18 11:34 appendonlydir
drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# rm -rf appendonlydir
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir.bak
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# mv appendonlydir.bak appendonlydir
[root@localhost myredis]# ll
总用量 108
drwxr-xr-x. 2 root root 103 1月 18 11:38 appendonlydir
-rw-r--r--. 1 root root 107531 1月 18 11:33 redis.conf
[root@localhost myredis]# cd appendonlydir
[root@localhost appendonlydir]# ll
总用量 12
-rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.1.base.rdb
-rw-r--r--. 1 root root 110 1月 18 11:38 appendonly.aof.1.incr.aof
-rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.manifest
[root@localhost appendonlydir]# ll
总用量 12
-rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.1.base.rdb
-rw-r--r--. 1 root root 162 1月 18 11:44 appendonly.aof.1.incr.aof
-rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.manifest
[root@localhost appendonlydir]# ll
总用量 12
-rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.1.base.rdb
-rw-r--r--. 1 root root 162 1月 18 11:44 appendonly.aof.1.incr.aof
-rw-r--r--. 1 root root 88 1月 18 11:38 appendonly.aof.manifest