纯净CentOS中安装redis遇到的坑

来源:互联网 发布:经纬切割机软件下载 编辑:程序博客网 时间:2024/05/22 14:33

CentOS中安装redis遇到的坑

1.首先要编译就需要安装 Make 和 GCC。

如果没有安装过 GCC 和 Make,那么就使用 yum 安装

yum install gccmake

2.有可能会遇到一个坑,[Errno -1] 软件包与预期下载的不符

就是g++安装失败

尝试单独安装gcc和g++

yum install gccyum install gcc-c++结果g++还是安装不上,则到win7下去安装路径去下载gcc-c++-4.8.5-11.el7.x86_64.rpm文件,然后再安装。gcc -v和g++ -v去看一下版本,如果正常则安装成功。3.编译redis可以先用make test,遇到的坑是You need tcl 8.5 or newer in order to run the Redis test,这个其实仅仅是make test的坑,可以解决下载最新的tcl,也可以忽略,因为你接下来去make时,时可以成功的。
4.测试redis的成功,进入redis/src目录然后看到redis-server和redis-cli是可执行文件,基本就成功了。

5.执行./redis-server /usr/local/redis-4.0.0/redis.conf,启动

17693:M 22 Aug 14:55:25.629 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.0 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 17693
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

17693:M 22 Aug 14:55:26.001 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
6.然后用客户端连接./redis-cli,连接上
root@localhost local]# cd redis-4.0.0/src/
[root@localhost src]# ./redis-cli
127.0.0.1:6379> set demo1 demo1
OK
127.0.0.1:6379> get demo1
"demo1"
127.0.0.1:6379> exit

原创粉丝点击