1. Installation
wget http://download.redis.io/releases/redis-3.2.3.tar.gz
Compile and install:
Tar XF redis-3.2.3.tar.gzcd redis-3.2.3make && make install
Configuration:
mkdir/etc/Redis Setup configuration file storage directoryCP-A redis.conf/etc/redis/6379. conf copying a configuration fileCP-A utils/redis_init_script/etc/init.d/redis replication Startup scriptsmkdir-p/home/redis-home set up data storage directory IP= ' IP addr show eth0 |grepeth0 |grepinet |Cut-D" "-F6|Cut-D"/"-F1' Get interface IPsed-I."s/^bind.*$/bind 127.0.0.1 $ip/"/etc/redis/6379. conf configuring bind bind IP Addresssed-I.'s/^daemonize no/daemonize yes/'/etc/redis/6379. conf Configure boot to Yessed-I.'s/^dir. \//dir \/home\/redis-home/'/etc/redis/6379. conf configuration data storage file for established redis-Home Directorysed-I.'3i# chkconfig:-14\n# descript:redis init script'/etc/init.d/redis configuration Boot file join Chkconfig description
Start:
Chkconfig--add redis configuration reids Join boot boot
Chkconfig redis on configuration Redis boot up
Service Redis start starts Redis
Dbsize Test if Redis is working properly
Service Redis stop off Redis
2.redis.conf
Daemonize Yes whether the next program run, the default nopidfile/var/run/redis.pid background run, need to develop Pidport 6379 default listening port 6379timeout 0 link Timeout time logleve L Notice Log level, debug,verbose,notice,warninglogfile "" Output log file, ' stdout ' flag output, if run later, output to/dev/null# syslog-enabled No Whether to output to system log # Syslog-ident Redis System Log Identifier # syslog-facility LOCAL0 databases 16 Setting the number of databases save 1save 10save 60 1 0000 after 900s and 1 key changes, will trigger the Save action Rdbcompression Yes to store data when the data is compressed, the default Yesdbfilename dump.rdb Save the Dump data filename dir. Directories must be directories instead of files slaveof <masterip> <masterport> slaveof Set one Redis instance to another Redis from the library Masterauth < master-password> slave-serve-stale-data Yes # requirepass foobared specify require password login # maxclients 10000 connection Max limit, recommended No Limit # maxmemory <bytes> use maximum memory limit, recommended no Limit # Maxmemory-policy noeviction default configuration: Volatile-lru: Use lrunning algorithm to remove past set, AL LKEYS-LRU removes any key,volatile-random that follows the LRU algorithm, randomly deletes the key,allkeys-random in the expired set, randomly deletes a key,volatile-ttl, Delete recently expiring key.noeviction, do not expire at all, write operation error appendonly no turn on the mode, will put each of theRecorded in the Appendonly.aof file, read into memory during Redis restart Appendfilename "appendonly.aof" # Appendfsync Alwaysappendfsync everysec# Appendfsync No: No Fsync, just notify the OS to flush the data, specifically whether the flush depends on the OS. Better performance. Always: Every time you write append only log file, it fsync. Poor performance, but very safe. Everysec: There is no interval of 1 seconds for a fsync. Eclectic No-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64MB append only files are automatically rewritten for 0 When overridden, Slowlog-log-slower-than 10000 negative turns off slow log,0 will cause each command to be recorded Slowlog-max-len REDIS CLUSTER
Redis Learning Note one: Basic installation and configuration