Installed after several twists and turns
1. Download
Wget http://download.redis.io/releases/redis-2.8.7.tar.gz
The downloaded file is redis-2.8.7.tar.gz in the current directory
2. Compile and install
Tar xf redis-2.8.7.tar.gz
CD redis-2.8.7
Make
Make install
If GCC is not installed, the system prompts GCC not found. Therefore, you need to install GCC:
Yum-y install gcc
Because at the beginning, I switched the yum source to 163, But I was forced to switch back to the original one. As a result, I backed up the built-in system at the beginning, visible backup configuration file benefits in fact the best way should be set to add third-party source and default selection of the fastest, can refer to
After installation, execute the preceding
3. Create a configuration file
Mkdir/etc/redis
CP redis. CONF/etc/redis. conf
4. Adjust the memory allocation usage and make it take effect.
Echo "VM. overcommit_memory = 1">/etc/sysctl. conf
# The available values of this parameter are 0, 1, and 2.
#0 indicates that when the user space requests more memory, the kernel attempts to estimate the available memory.
#1 indicates that the kernel allows excessive memory usage until the memory is used up.
#2 indicates that the whole memory address space cannot exceed the ram value of swap + (VM. overcommit_ratio) %
Sysctl-P
5. Modify redis Configuration
VI/etc/redis. conf
Daemonize yes # redis runs as a daemprocess,
# No indicates not running as a daemon (a terminal will be occupied)
Timeout 300 # how long the client is idle before it is disconnected. The default value is 0.
Loglevel verbose # Set the redis Log Level
Logfile stdout # Set the log file output mode. If you run redis as a daemon
# If the log output is set to stdout, the log information is output to/dev/null.
6. Start redis
Redis-server/etc/redis. conf
7. Test redis
[Root @ localhost redis] # redis-cli
127.0.0.1: 6379> Set Name Wayne
OK
127.0.0.1: 6379> get name
"Wayne"
Wagner. 0.0.1: 6379>
Article source, my blog: http://www.cnwsjs.cn /? P = 172