Redis installation process:
The first three steps should normally be no problem, the main problem is the time to make the implementation, there has been an exception.
make : cc: Command not found
Abnormal: not installed gcc
Solution: yum install gcc-c ++
zmalloc.h: 51: 31: error: jemalloc / jemalloc.h: No such file or directory
Abnormal: Some compilation dependencies or the original compile legacy problems
Solution: make distclean. Clean up, and then make.
After make successful, we need to make test. In the make test abnormal.
could not execute "tclsh8.5": no such file or directory
Abnormal: not installed tcl
Solution: yum install -y tcl.
Set the memory allocation policy (optional, set according to the actual situation of the server)
/ Proc / sys / vm / overcommit_memory
Available Values: 0,1,2.
0, which means the kernel will check whether there is enough memory available for use by processes use; if you have enough free memory, memory for permission; otherwise, memory allocation fails, and the error back to the application process.
1, that allows the kernel to allocate all of the physical memory, regardless of the current memory status.
2, represents the kernel is allowed to allocate more than the sum of all the physical memory and swap space memory
A point worth noting is, redis in the dump data, will fork a child process, child process theoretically memory occupied and parent is the same, such as the memory of 8G parent, this time must also be assigned to 8G memory to the child, if the memory can not afford, often result in machine down redis server or IO load is too high, decrease efficiency. So here more optimal memory allocation strategy should be set to 1 (indicating the kernel is allowed to allocate all of the physical memory, regardless of the current memory status)
vim / etc / sysconfig / iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
service iptables restart
Modify redis / redis.conf, set as a background daemon process redis: daemonize yes
Many times after this configuration file is modified, mentioned redis problems may arise, so under normal circumstances are redis.conf profile error cause can be found on the Internet right or below is copied directly in, are also available.
save 900 1
save 300 10
save 60 10000
dir / usr / local / redis / var /
$ Redis-server redis.conf
[Root @ Architect redis-2.8.17] # ps -ef | grep redis
root 401 29222 0 18:06 pts / 3 00:00:00 grep redis
root 29258 1 0 16:23? 00:00:00 redis-server /etc/redis.conf
redis> set foo jiu
redis> get foo "jiu"
It is so complete.