redis安装--单机

本例基于CentOS7.2系统安装

环境需求:

关闭防护墙,selinux

安装好gcc等编译需要的组件

1 yum -y install gcc c++

到redis官网下载合适版本的redis安装包,上传至系统指定目录,我以3.2.8为例

 1 [root@Node1 app]# tar zxf redis-3.2.8.tar.gz 
 2 [root@Node1 app]# cd redis-3.2.8
 3 00-RELEASENOTES  BUGS  CONTRIBUTING  COPYING  deps  INSTALL  Makefile  MANIFESTO  README.md  redis.conf  runtest  runtest-cluster  runtest-sentinel  sentinel.conf  src  tests  utils
 4 [root@Node1 redis-3.2.8]# make && make install
 5 cd src && make install
 6 make[1]: Entering directory `/app/redis-3.2.8/src'
 7 
 8 Hint: It's a good idea to run 'make test' ;)
 9 
10     INSTALL install
11     INSTALL install
12     INSTALL install
13     INSTALL install
14     INSTALL install
15 make[1]: Leaving directory `/app/redis-3.2.8/src'

至此期间如果报错,一般都是因为缺少依赖包,根据提示对应安装即可

一切正常的话就可以去启动服务了

 1 [root@Node1 src]# ./redis-server 
 2 5129:C 15 May 23:30:33.151 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
 3 5129:M 15 May 23:30:33.153 * Increased maximum number of open files to 10032 (it was originally set to 1024).
 4                 _._                                                  
 5            _.-``__ ''-._                                             
 6       _.-``    `.  `_.  ''-._           Redis 3.2.8 (00000000/0) 64 bit
 7   .-`` .-```.  ```/    _.,_ ''-._                                   
 8  (    '      ,       .-`  | `,    )     Running in standalone mode
 9  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
10  |    `-._   `._    /     _.-'    |     PID: 5129
11   `-._    `-._  `-./  _.-'    _.-'                                   
12  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
13  |    `-._`-._        _.-'_.-'    |           http://redis.io        
14   `-._    `-._`-.__.-'_.-'    _.-'                                   
15  |`-._`-._    `-.__.-'    _.-'_.-'|                                  
16  |    `-._`-._        _.-'_.-'    |                                  
17   `-._    `-._`-.__.-'_.-'    _.-'                                   
18       `-._    `-.__.-'    _.-'                                       
19           `-._        _.-'                                           
20               `-.__.-'                                               
21 
22 5129:M 15 May 23:30:33.155 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
23 5129:M 15 May 23:30:33.155 # Server started, Redis version 3.2.8
24 5129:M 15 May 23:30:33.155 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
25 5129:M 15 May 23:30:33.156 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
26 5129:M 15 May 23:30:33.156 * The server is now ready to accept connections on port 6379

这样我是没有修改redis.conf配置文件,所以各参数都是默认的,实际应用时根据自己需求来调整

o(=•ェ•=)m纸上得来终觉浅,绝知此事要躬行o(=•ェ•=)m
原文地址:https://www.cnblogs.com/occl/p/9041282.html