美文网首页
安装Redis教程

安装Redis教程

作者: Gallrax | 来源:发表于2017-07-14 16:01 被阅读0次

一、安装wget

    [root@localhost redis-3.2.9]# yum install wget

二、获取redis压缩包

    [root@localhost redis-3.2.9]# wget http://download.redis.io/releases/redis-3.2.9.tar.gz

三、解压压缩包

    [root@localhost redis-3.2.9]# tar -xzf redis-3.2.9.tar.gz

四、编译

   [root@localhost redis-3.2.9]# cd redis-3.2.9

    [root@localhost redis-3.2.9]# make

    make[3]: gcc:命令未找到
报错:gcc:命令未找到

五、安装gcc

    [root@localhost redis-3.2.9]# yum install gcc
    [root@localhost redis-3.2.9]# make
    make[1]: Entering directory `/usr/document/program/redis-3.2.9/src'CC adlist.o
    在包含自 adlist.c:34 的文件中:
    zmalloc.h:50:31: 错误:jemalloc/jemalloc.h:没有那个文件或目录
    zmalloc.h:55:2: 错误:#error "Newer version of jemalloc required"
原因:libc 并不是默认的 分配器, 默认的是 jemalloc。但是又没有jemalloc 而只有 libc 当然 make 出错

解决方案:make MALLOC=libc

六、编译

[root@localhost redis-3.2.9]# make MALLOC=libc
cd src && make all
make[1]: Entering directory `/usr/document/program/redis-3.2.9/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/usr/document/program/redis-3.2.9/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)

七、启动

[root@localhost src]# ./redis-server 
1987:C 15 Jul 00:03:35.527 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
1987:M 15 Jul 00:03:35.532 * Increased maximum number of open files to 10032 (it was originally set to 1024).
1987:M 15 Jul 00:03:35.535 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.2.9 (00000000/0) 32 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1987
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

1987:M 15 Jul 00:03:35.539 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1987:M 15 Jul 00:03:35.539 # Server started, Redis version 3.2.9

八、允许外网访问

修改redis.conf

1.将bind 127.0.0.1注释
2.将protected-mode yes改为no
3../redis-server ../redis.conf

相关文章

网友评论

      本文标题:安装Redis教程

      本文链接:https://www.haomeiwen.com/subject/hkqohxtx.html