首页 > 其他 > 详细

redis安装

时间:2019-12-20 15:09:38      阅读:90      评论:0      收藏:0      [点我收藏+]

redis = remote + dictionary + server

去官网下载:
https://redis.io
解压缩
tar -xzf redis-5.0.7.tar.gz
修改名字
mv redis-5.0.7 redis
编译
make

提示缺少gcc
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc: Command not found


安装gcc编译器
yum install gcc

再次编译make,出现以下提示
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"



可是看了下目录deps\jemalloc 存在jemalloc目录,虽然没有jemalloc.h,
但是jemalloc.c也没有引用jemalloc.h,而且附带那么大一个文件显然是准备了代码的,只是编译为什么通不过呢?

看了看README,有这样一段话,关于内存分配器的
Allocator
---------
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
这个可以避免出现找不到内存分配器的错误,但是总觉得这样的配置用于生产环境不妥,
已经明确说了用jemalloc是最佳的,用libc会有更多的碎片.

再往下看,里面有这么一段
When you update the source code with `git pull` or when code inside the
dependencies tree is modified in any other way, make sure to use the following
command in order to really clean everything and rebuild from scratch:
    make distclean
就是有任意的变动必须清空重新编译,因为之前经过一次失败的make,必定有一些文件(这个是马后炮,当时的心态是死马当活马医).
再次清空重新编译
make distclean
make

竟然成功了
Hint: It‘s a good idea to run ‘make test‘ ;)
make[1]: Leaving directory `/software/redis/src‘

redis安装

原文:https://www.cnblogs.com/cquccy/p/12072968.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!