zoukankan      html  css  js  c++  java
  • Linux下安装Redis5.0.2

    1、下载redis 地址 http://download.redis.io/releases/redis-5.0.2.tar.gz

    2、解压tar -zxf redis-5.0.2.tar.gz

    3、make编译

    3.1 缺少gcc环境需要yum install gcc

    3.2 报错:

    [root@lang redis-5.0.2]# make
    cd src && make all
    make[1]: Entering directory `/usr/local/redis-4.0.10/src'
        CC adlist.o
    In file included from adlist.c:34:
    zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
    zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
    make[1]: *** [adlist.o] Error 1
    make[1]: Leaving directory `/usr/local/redis-4.0.10/src'
    make: *** [all] Error 2

    redis解压目录下有个README.md文件中有如下一段话:

    Selecting a non-default memory allocator when building Redis is done by setting the `MALLOC` environment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc.

    To force compiling against libc malloc, use:

        % make MALLOC=libc

    To compile against jemalloc on Mac OS X systems, use:

        % make MALLOC=jemalloc

    4、编译加上MALLOC=libc 即可

       #make MALLOC=libc

    5、运行redis

     

    修改配置文件 redis.conf

    daemonize no 改为 yes 后台运行:

    protected-mode yes 改为no 可以不用输入密码登陆

    bind 127.0.0.1  表示只可以本机访问,要是远程访问需要注释掉(前面加#号)

    6、带配置文件后台启动

     

    [root@lang redis-5.0.2]# src/redis-server redis.conf
    7897:C 06 Dec 2018 06:25:57.484 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    7897:C 06 Dec 2018 06:25:57.484 # Redis version=5.0.2, bits=64, commit=00000000, modified=0, pid=7897, just started
    7897:C 06 Dec 2018 06:25:57.484 # Configuration loaded
    [root@lang redis-5.0.2]# ps -ef | grep redis
    root       7898      1  4 06:25 ?        00:00:00 src/redis-server *:6379   
    root       7903   2880  0 06:25 pts/1    00:00:00 grep redis
    [root@lang redis-5.0.2]#

  • 相关阅读:
    ABC065D Built[最小生成树]
    loj2718 「NOI2018」归程[Kruskal重构树+最短路]
    BZOJ1821 部落划分[最小生成树]
    BZOJ4777 [Usaco2017 Open]Switch Grass[最小生成树+权值线段树套平衡树]
    CF888G Xor-MST[最小生成树+01trie]
    Atcoder CODE FESTIVAL 2016 Final G
    BZOJ4883 [Lydsy1705月赛]棋盘上的守卫[最小基环树森林]
    BZOJ3714 [PA2014]Kuglarz[最小生成树]
    BZOJ1601 [Usaco2008 Oct]灌水[最小生成树]
    CF892E Envy[最小生成树]
  • 原文地址:https://www.cnblogs.com/langgj/p/10074109.html
Copyright © 2011-2022 走看看