您的位置:首页 > 数据库 > Redis

linux下redis安装遇到的问题及解决办法

2016-06-25 15:25 926 查看
linux下安装redis:
$ wget http://download.redis.io/releases/redis-3.2.0.tar.gz $ tar xzf redis-3.2.0.tar.gz
$ cd redis-3.2.0
$ make
1. 如果输入make提示 : make: cc:命令未找到
原因:未安装gcc解决方法:安装gcc[ckl@localhost ~]$ yum -y install gcc automake autoconf libtool make结果:安装后再执行make便成功了2. 如果输入make提示:zmalloc.h:50:31: 致命错误:jemalloc/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说关于分配器allocator, 如果有MALLOC  这个 环境变量, 会有用这个环境变量的 去建立Redis。而且libc 并不是默认的 分配器, 默认的是 jemalloc, 因为 jemalloc 被证明 有更少的 fragmentation problems 比libc。但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以加这么一个参数。解决方法:[root@localhost redis-3.2.0]# make MALLOC=libc直到输出结果:这就ok了。make完后 redis-3.2.0目录下会出现编译后的redis服务程序redis-server,还有用于测试的客户端程序redis-cli,两个程序位于安装目录 src 目录下:下面启动redis服务.
$ cd src$ ./redis-server
注意这种方式启动redis 使用的是默认配置。也可以通过启动参数告诉redis使用指定配置文件使用下面命令启动。
$ cd src$ ./redis-server redis.conf
redis.conf是一个默认的配置文件。我们可以根据需要使用自己的配置文件。启动redis服务进程后,就可以使用测试客户端程序redis-cli和redis服务交互了。 比如:
$ cd src$ ./redis-cliredis>set foo barOKredis>get foo"bar"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  redis redis安装问题