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

 

重試,以下

相關文章
相關標籤/搜索