Redis安装

本文是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"
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容