My installation system is:Red Hat Enterprise Linux 5.5
Here are the installation procedures and some of the problems encountered:
1. Download the installation package
[Email protected] ~]$ wget http://download.redis.io/releases/redis-2.6.13.tar.gz
2. Decompression
[Email protected] ~]# tar xzf redis-2.6.13.tar.gz
3. Compiling
[[Email protected] ~]# CD Redis-2.6.13[[email protected] ~]# make
If there is a server on the installation of GCC's compilation environment will be error, install GCC can be run with the root user: Yum install gcc will automatically download the installation, such as
And then run: Make command
After compiling, the configuration redis.conf configuration options for Redis are as follows: Modify as needed
Daemonize whether the next process runs, the default is Nopidfile, such as the next process to run, you need to specify a PID, the default is/var/run/redis.pidbind bound host IP, the default value is 127.0.0.1 (note) Port listening ports, The default is 6379timeout time-out, default is 300 (seconds) LogLevel logging level, there are 4 optional values, Debug,verbose (default), Notice,warninglogfile logging mode, The default value is stdoutdatabases the number of available databases, the default is 16, and the default database is 0save <seconds> <changes> indicates how many times the update operation is synchronized to the data file. This can be a combination of multiple conditions, such as the default configuration file settings, set three conditions. Save 900 1900 seconds (15 minutes) at least 1 keys are changed save 300 10 300 seconds (5 minutes) at least 300 keys are changed in Save 60 10000 60 seconds at least 10,000 keys are changed rdbcompression Whether the data is compressed when stored to a local database, the default is the Yesdbfilename local database file name, the default is the Dump.rdbdir local database storage path, and the default value is./slaveof <masterip> <masterport > When this machine is from the service, set the IP and port of the primary service (note) Masterauth <master-password> set the connection password (note) for the primary service when the native is from service Requirepass Connection password (note) MaxClients the maximum number of client connections, by default (note) MaxMemory <bytes> set maximum memory, Redis will first try to clear expired or expiring keys when this method is processed. The maximum memory setting is reached and no further write operations can be made. (note) Whether appendonly is logged after each update operation and, if not turned on, may result in data loss over a period of time when power is lost. Because the Redis itself synchronizes data files in sync with the save conditions above, some data will only exist in memory for a period of time. The default value is noappendfilename update log file name, the default value is appendonly.aof (note) Appendfsync update the log condition, there are 3 optional values. No indicates that the data cache of the operating system is synchronized to disk, always means that the data is written to disk by manually calling Fsync () after each update operation, and EVERYSEC is synchronized once per second (the default value). Vm-enabled whether to use virtual memory, the default value is novm-swap-file virtual memory file path, the default value is/tmp/redis.swap, and multiple Redis instances cannot be shared vm-max-memory All data larger than Vm-max-memory is stored in virtual memory, regardless of how small the vm-max-memory setting is, all index data is in memory (Redis's index data is keys), that is, when Vm-max-memory is set to 0, In fact, all value is present on disk. The default value is 0. #当dump. Rdb database whether to compress data Objects Rdbcompression yes#dump The data saved by the database file name dbfilename Dump.rdb#redis working directory dir/var/lib/redis/##### ###### Replication ##################### #Redis的复制配置 # slaveof <masterip> <masterport># Masterauth < master-password> ############## SECURITY ############ requirepass foobared ############### LIMITS ############### Maximum client connections # maxclients 128# max Memory usage # maxmemory <bytes> ########## APPEND only FILE MODE ######### #是否开启日志功能appendonly N o# Refresh log to disk rule # Appendfsync alwaysappendfsync everysec# appendfsync no################ VIRTUAL MEMORY ############ Whether to turn on VM function vm-enabled no# vm-enabled yesvm-swap-file logs/redis.swapvm-max-memory 0vm-page-size 32vm-pages 134217728vm-maX-threads 4############# Advanced CONFIG ############## #glueoutputbuf yeshash-max-zipmap-entries 64hash-max-zipmap-value 512# whether to reset the hash table activerehashing Yes the Redis official documentation provides some suggestions for using VMS: When your key is small and value is large, The effect of using VMS is better. Because this saves more memory. When your key is small, consider using some very large key to make a big value, for example, you might consider combining key,value into a new value. It is best to use Linux ext3 to support a better file system for sparse files to save your swap files. Vm-max-threads This parameter, you can set the number of threads to access the swap file, and it is best not to exceed the number of cores of the machine. If set to 0, then all operations on swap files are serial. This can result in a long delay, but with good assurance of data integrity.
4. Service-side start-up
[Email protected] redis-2.6.13]$ Src/redis-server
5. Restart a client's SSL window to run the client test
[Email protected] redis-2.6.13]# SRC/REDIS-CLI
Test success with Set and get access commands
The installation process and problems of Redis on Linux