Redis configuration file details, one-click deployment
(1) redis.conf in the home directory
Daemonize no-> yes / / run in the background
Port 6379 / / Port
Appendonly no-> yes / / log switch
Logfile stdout->. / logs/redis.log / / log file
Dbfilename dump.rdb / / persistent data file
(2) what's new in Redis 3.2: address access security
Bind assigns IP to listen on bind 192.168.47.xx ip2 ip3 ip4
Prohibit protected-mode-protected-mode yes/no
Add requirepass {password}-requirepass guo
Use-auth {password} for authentication in redis-cli
(3) running configuration:
Get the current configuration: CONFIG GET *
Change the running configuration: CONFIG SET loglevel "notice" (temporary modification, restart failure, long-term need to modify the configuration file)
(4) Redis data storage
Persistence:
1) RDB persistence can generate a point-in-time snapshot of a dataset (point-in-time snapshot) within a specified time interval
2) AOF persistently records all write commands performed by the server and restores the dataset by re-executing these commands when the server starts. All commands in the AOF file are saved in the Redis protocol format, and the new command is appended to the end of the file. Redis can also rewrite (rewrite) the AOF file in the background so that the size of the AOF file does not exceed the actual size required to save the dataset state.
3) Redis can also use both AOF persistence and RDB persistence. In this case, when Redis restarts, it gives priority to using the AOF file to restore the dataset because the dataset saved by the AOF file is usually more complete than the dataset saved by the RDB file.
4) you can even turn off persistence so that the data exists only while the server is running.
Persistence strategy:
Log file appendonly yes/no
Save 900 1
Save 300 10
Save 60 10000
It means that there are 1 change in 900 seconds (15 minutes), 10 changes in 300 seconds (5 minutes), and 10000 changes in 60 seconds to write data to the hard disk.
Compression:
Dbcompression yes
Specifies whether the data is compressed when stored in the local database, which defaults to LZF compression for yes,Redis, which can be turned off to save CPU time, but can cause the database file to become large.
Synchronization:
Appendfsync everysec
-no: indicates that the operating system synchronizes the data cache to disk. Linux is about 20 seconds (fast).
-always: indicates that fsync () is called after each update operation to write data to disk (slow, secure)
-everysec: synchronizes once per second (eclectic, default)
(5) data structure:
General operation:
KEYS * View KEY supports wildcards
DEL deletes one or more given key
EXISTS checks whether it exists.
EXPIRE sets time to live
TTL returns expiration time in seconds
DUMP RESTORE serialization and deserialization
PEXIRE PTTL PERSIST in milliseconds
RENAME changes KEY name
SORT key value sort, there is a non-digital Times error
TYPE returns the type of key value stored by the key
-
#! / bin/bashmkdir-p / data/rpmcd / data/rpm [- f / data/rpm/redis-3.2.0.tar.gz] | | wget tar-xf redis-3.2.0.tar.gzmv redis-3.2.0 / data/server/rediscd / data/server/redismakecp / data/scripts/redis/files/redis / etc/init.drm-rf / data/server/redis/redis.confcp / data/scripts/redis/files/redis.conf / data/server/redis/redis .confchmod + x / etc/init.d/redisln-s / data/server/redis/src/redis-cli / usr/bin/redis-clichkconfig redis onservice redis startservice redis status