redis 在Linux下的安装与配置

redisLinux下的安装与配置redis

 

by:授客  QQ1033553122ide

测试环境

redis-3.0.7.tar.gz测试

下载地址:ui

http://redis.io/downloadidea

http://pan.baidu.com/s/1slh5YbVspa

 

CentOS 6.5-x86_64orm

 

安装配置redis

[root@localhost mnt]# tar xzf redis-3.0.7.tar.gzblog

[root@localhost local]# cd redis-3.0.7/ci

[root@localhost redis-3.0.7]# lsget

00-RELEASENOTES  COPYING  Makefile   redis.conf       runtest-sentinel  tests

BUGS             deps     MANIFESTO  runtest          sentinel.conf     utils

CONTRIBUTING     INSTALL  README     runtest-cluster  src

[root@localhost redis-3.0.7]# make MALLOC=libc

cd src && make all

make[1]: Entering directory `/usr/local/redis-3.0.7/src'

    LINK redis-check-dump

    CC redis-check-aof.o

    LINK redis-check-aof

 

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

 

注意:

1Linux平台下执行make命令时,必须加MALLOC=libc,不然会报错

 

zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory

zmalloc.h:55:2: error: #error "Newer version of jemalloc required"

 

2、须要安装gcc,不然会报相似以下的错误

/bin/sh: cc: command not found

……

make[1]: *** [adlist.o] Error 127

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

make: *** [all] Error 2

 

运行测试

[root@localhost ~]# yum install tcl.x86_64

 

注意:若是未安装tcl可能报错,以下

[root@localhost redis-3.0.7]# make test

cd src && make test

make[1]: Entering directory `/usr/local/redis-3.0.7/src'

You need tcl 8.5 or newer in order to run the Redis test

make[1]: *** [test] Error 1

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

make: *** [test] Error 2

 

 

[root@localhost redis-3.0.7]# make test

  56 seconds - unit/memefficiency

  70 seconds - unit/hyperloglog

  130 seconds - integration/replication-4

  137 seconds - integration/replication-3

  130 seconds - integration/replication-psync

  98 seconds - unit/obuf-limits

 

\o/ All tests passed without errors!

 

Cleanup: may take some time... OK

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

 

启动redis服务

[root@localhost redis-3.0.7]# cd src/

 

 



 

测试下

[root@localhost src]# ./redis-cli

127.0.0.1:6379> set foo bar

OK

127.0.0.1:6379> get foo

"bar"

127.0.0.1:6379> exit

成功了

 

 

如上,启动时出来了一堆警告,咋办?进行以下配置

[root@localhost ~]# echo 511 > /proc/sys/net/core/somaxconn

[root@localhost ~]# echo vm.overcommit_memory=1 > /etc/sysctl.conf

[root@localhost ~]# sysctl vm.overcommit_memory=1

vm.overcommit_memory = 1

[root@localhost ~]#

[root@localhost ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled

[root@localhost ~]# echo never > /etc/rc.local

 

重试,以下

相关文章
相关标签/搜索