美文网首页
Redis安装

Redis安装

作者: shallowinggg | 来源:发表于2019-05-23 12:04 被阅读0次

本文是Linux系统下的安装,如果需要在windows下使用,请前往https://github.com/MicrosoftArchive/redis/tags下载windows版本,注意目前win的最高版本只有3.2版本。

前往redis官网下载自己需要的版本:https://redis.io/download

下载完成后按照其教程进行解压编译:

$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make

如果你不是mac系统,此时可能出现下面的问题:

In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: 没有那个文件或目录
 #include <jemalloc/jemalloc.h>
                               ^
compilation terminated.
Makefile:248: recipe for target 'adlist.o' failed
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory '/usr/local/redis-5.0.5/src'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2

此时附加一个参数即可:

make MALLOC=libc

此时即可成功编译:

    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory '/usr/local/redis-5.0.5/src'

接下来启动服务器即可使用:

src/redis-server

然后使用内置的redis-cli:

src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

相关文章

网友评论

      本文标题:Redis安装

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