redis基础
1.安装redis
wget http://download.redis.io/releases/redis-4.0.6.tar.gz tar xzf redis-4.0.6.tar.gz cd redis-4.0.6 make src/redis-server src/redis-cli #测试 redis> set foo bar OK redis> get foo "bar"
2.报错
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 `/data0/src/redis-2.6.2/src' make: *** [all] Error 2
原因是jemalloc重载了Linux下的ANSI C的malloc和free函数。解决办法:make时添加参数。
make MALLOC=libc # 继续编译,make之后,会出现一句提示 To run 'make test' is a good ide make