1. Redis View Configuration
CONFIG Get *
[Email protected] redis]#/USR/LOCAL/REDIS/BIN/REDIS-CLI
127.0.0.1:6379> CONFIG Get *
1) "Dbfilename"
2) "Dump.rdb"
3) "Requirepass"
4) ""
5) "Masterauth"
6) ""
7) "Unixsocket"
8) ""
2. Reset Timeout0
CONFIG Set Timeout 0
127.0.0.1:6379> CONFIG Set Timeout 0
Ok
127.0.0.1:6379> CONFIG Get Timeout
1) "Timeout"
2) "0"
Second, Redis Universal configuration
[Email protected] redis]# cat/usr/local/redis/etc/redis.conf
Daemonize Yes
Pidfile/usr/local/redis/var/redis.pid
Port 6379
Timeout 300
LogLevel Debug
Logfile/usr/local/redis/var/redis.log
Databases 16
Save 900 1
Save 300 10
Save 60 10000
Rdbcompression Yes
Dbfilename Dump.rdb
dir/usr/local/redis/var/
AppendOnly No
Appendfsync always
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/77/24/wKioL1ZkBurg6-9MAAJ-3LZKXAU088.png "title=" Image.png "alt=" Wkiol1zkburg6-9maaj-3lzkxau088.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/77/24/wKioL1ZkBwDQc3uqAALpOYmx6KM629.png "title=" Image.png "alt=" Wkiol1zkbwdqc3uqaalpoymx6km629.png "/>
127.0.0.1:6379> Select 1
OK
127.0.0.1:6379[1]> Keys *
(empty list or set)
127.0.0.1:6379[1]> Select 0
OK
127.0.0.1:6379> Keys *
1) "Caimz"
127.0.0.1:6379> Select
OK
127.0.0.1:6379[15]> Keys
(Error) ERR wrong number of arguments for ' Keys ' command
127.0.0.1:6379[15]> Keys *
(empty list or set)
127.0.0.1:6379[15]> Select
(Error) ERR Invalid DB index
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/77/26/wKiom1ZkBrGBPcC3AALAa-g2dbA640.png "title=" Image.png "alt=" Wkiom1zkbrgbpcc3aalaa-g2dba640.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/77/26/wKiom1ZkBsGSjW5SAAIiQtNIDH0901.png "title=" Image.png "alt=" Wkiom1zkbsgsjw5saaiiqtnidh0901.png "/>
1. Add Redis password, just like MySQL setup password
[Email protected] redis]# vim/usr/local/redis/etc/redis.conf
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/77/24/wKioL1ZkB0rgaHWXAAA6d5ziLCc251.png "title=" Image.png "alt=" Wkiol1zkb0rgahwxaaa6d5zilcc251.png "/>
[Email protected] redis]# service Redis restart
stopping redis-server: [OK]
Starting redis-server: [OK]
[Email protected] redis]#/usr/local/redis/bin/redis-c
Redis-check-aof Redis-check-dump REDIS-CLI
[Email protected] redis]#/USR/LOCAL/REDIS/BIN/REDIS-CLI
127.0.0.1:6379> L
(Error) ERR unknown command ' l '
127.0.0.1:6379> Get Caimz
(Error) Noauth Authentication required.#此时要需要密码
2. Password Login Redis
[[email protected] redis]#/usr/local/redis/bin/redis-cli -a caimz #-a followed by the password
127.0.0.1:6379> Get Caimz
"Leco"
1. Renaming
[Email protected] redis]# vim/usr/local/redis/etc/redis.conf
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/77/24/wKioL1ZkB2rSj4pcAAA9efVXDVo492.png "title=" Image.png "alt=" Wkiol1zkb2rsj4pcaaa9efvxdvo492.png "/>
Restart
Redis AOF
Redis AOF Persistence-related configuration
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/77/26/wKiom1ZkBzXSB-IeAAK9knDrW1M594.png "title=" Image.png "alt=" Wkiom1zkbzxsb-ieaak9kndrw1m594.png "/>
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/77/24/wKioL1ZkB7ejBcfOAAJQFxErakI529.png "title=" Image.png "alt=" Wkiol1zkb7ejbcfoaajqfxeraki529.png "/>
1, Configuration redis.conf
[[email protected] redis]# vim/usr/local/redis/etc/redis.conf
[[email protected] redis]# cat/usr/local/redis/etc/redis.conf
daemonize Yes
pidfile/usr/local/redis/var/redis.pid
Port 6379
Timeout
loglevel debug
logfile /usr/local/redis/var/redis.log
Databases
save 1
Save
Save 10000
Rdbcompression Yes
dbfilename dump.rdb
Dir/usr/local/redis /var/
appendonly yes #yes open aof no off aof< /span>
appendfilename append.aof
Appendfsync always
requirepass Caimz
[[Email protected] redis]# service Redis restart #重启redis because of the new configuration redis.conf
stopping redis-server: [OK]
Starting redis-server: [OK]
[Email protected] desktop]# ls/usr/local/redis/var/
append.aof Dump.rdb redis.log redis.pid
[Email protected] desktop]# ls-al/usr/local/redis/var/
Total 128
DRWXRWXRWX 2 root root 4096 Dec 6 01:40.
Drwxr-xr-x 5 root root 4096 Dec 6 00:44..
-rw-r--r--1 Redis 0 Dec 6 01:40 append.aof #此时还没有数据
-rw-r--r--1 Redis 6 01:40 Dump.rdb
-rw-r--r--1 Redis 109675 Dec 6 01:42 Redis.log
-rw-r--r--1 Redis redis 5 Dec 6 01:40 redis.pid
[Email protected] redis]#/usr/local/redis/bin/redis-cli-a caimz #进入redisredis数据
127.0.0.1:6379> Set Key1 Caimz
Ok
127.0.0.1:6379> Get Key1
"Caimz"
127.0.0.1:6379>
[Email protected] desktop]# ls-al/usr/local/redis/var/
Total 136
DRWXRWXRWX 2 root root 4096 Dec 6 01:40.
Drwxr-xr-x 5 root root 4096 Dec 6 00:44..
-rw-r--r--1 Redis 6 01:42 append.aof #此时就有记录
-rw-r--r--1 Redis 6 01:40 Dump.rdb
-rw-r--r--1 Redis 110679 Dec 6 01:42 Redis.log
-rw-r--r--1 Redis redis 5 Dec 6 01:40 redis.pid
Redis Configuration Explained