[root@localhost myredis]# vim cmd.txt [root@localhost myredis]# cat cmd.txt set k100 v100 set k200 v200 hset k300 name atguigu hset k300 age 20 hset k300 gender male lpush list 1 2 3 4 5 [root@localhost myredis]# cat cmd.txt|redis-cli -a abc123 --pipe Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. All data transferred. Waiting for the last reply... Last reply received from server. errors: 0, replies: 6
[root@localhost myredis]# vim cmd.txt
[root@localhost myredis]# cat cmd.txt
set k100 v100
set k200 v200
hset k300 name atguigu
hset k300 age 20
hset k300 gender male
lpush list 1 2 3 4 5
[root@localhost myredis]# cat cmd.txt|redis-cli -a abc123 --pipe
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
All data transferred. Waiting for the last reply...
Last reply received from server.
errors: 0, replies: 6
127.0.0.1:6379> incr key (integer) 1 127.0.0.1:6379> get key "1" 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> set k10000 v10000 OK 127.0.0.1:6379> mset k1 v1 k2 v2 k3 v3 OK 127.0.0.1:6379> get k100 "v100" 127.0.0.1:6379> get k300 (error) WRONGTYPE Operation against a key holding the wrong kind of value 127.0.0.1:6379> get 200 (nil) 127.0.0.1:6379> get k200 "v200" 127.0.0.1:6379> hget k300 name "atguigu" 127.0.0.1:6379> hget k300 age "20" 127.0.0.1:6379> hget k300 gender "male" 127.0.0.1:6379> hgetall k300 1) "name" 2) "atguigu" 3) "age" 4) "20" 5) "gender" 6) "male" 127.0.0.1:6379> lrange list 0 -1 1) "5" 2) "4" 3) "3" 4) "2" 5) "1"
127.0.0.1:6379> incr key
(integer) 1
127.0.0.1:6379> get key
"1"
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> set k10000 v10000
OK
127.0.0.1:6379> mset k1 v1 k2 v2 k3 v3
OK
127.0.0.1:6379> get k100
"v100"
127.0.0.1:6379> get k300
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379> get 200
(nil)
127.0.0.1:6379> get k200
"v200"
127.0.0.1:6379> hget k300 name
"atguigu"
127.0.0.1:6379> hget k300 age
"20"
127.0.0.1:6379> hget k300 gender
"male"
127.0.0.1:6379> hgetall k300
1) "name"
2) "atguigu"
3) "age"
4) "20"
5) "gender"
6) "male"
127.0.0.1:6379> lrange list 0 -1
1) "5"
2) "4"
3) "3"
4) "2"
5) "1"