redis安装全过程
1、 從官網(wǎng)上下載redis。
2、安裝gcc
3、進(jìn)入./redis/src目錄下make MALLOC =libc
4、遇到的問題
?
Redis簡介:
Redis是一個(gè)開源的使用ANSI?C語言編寫、支持網(wǎng)絡(luò)、可基于內(nèi)存亦可持久化的日志型、Key-Value數(shù)據(jù)庫,并提供多種語言的API。從2010年3月15日起,Redis的開發(fā)工作由VMware主持。
redis是一個(gè)key-value存儲系統(tǒng)。和Memcached類似,它支持存儲的value類型相對更多,包括string(字符串)、list(鏈表)、set(集合)、zset(sorted set –有序集合)和hash(哈希類型)。這些數(shù)據(jù)類型都支持push/pop、add/remove及取交集并集和差集及更豐富的操作,而且這些操作都是原子性的。在此基礎(chǔ)上,redis支持各種不同方式的排序。與memcached一樣,為了保證效率,數(shù)據(jù)都是緩存在內(nèi)存中。區(qū)別的是redis會周期性的把更新的數(shù)據(jù)寫入磁盤或者把修改操作寫入追加的記錄文件,并且在此基礎(chǔ)上實(shí)現(xiàn)了master-slave(主從)同步。
安裝所遇問題
下載解壓redis-2.0.4后,執(zhí)行make進(jìn)行編譯,結(jié)果出現(xiàn)下面的錯(cuò)誤:
make: cc: Command not found make: *** [adlist.o] Error 127
這是由于新安裝的Linux系統(tǒng)沒有安裝gcc環(huán)境,需要安裝gcc,為了方便,這里我選擇用yum進(jìn)行安裝。
# yum? install? gcc
驗(yàn)證gcc是否安裝成功
# rpm -qa |grep gcc
重新對redis進(jìn)行編譯安裝
# make ?&& make install?
通過下圖可以看到編譯通過,并成功安裝redis。
總結(jié):在進(jìn)行l(wèi)inux系統(tǒng)安裝時(shí),尤其是進(jìn)行l(wèi)inux服務(wù)器安裝時(shí),系統(tǒng)工程師往往會最小化安裝相應(yīng)的在linux系統(tǒng)。那么,在這樣的linux系統(tǒng)上進(jìn)行源碼文件編譯安裝時(shí),通常都會出現(xiàn)cc: Command not found,這說明系統(tǒng)上沒有安裝C語言環(huán)境,需要安裝,在linux系統(tǒng)上的C環(huán)境是gcc,因此需要安裝gcc。
?
?
Redis 2.8.18 安裝報(bào)錯(cuò) error: jemalloc/jemalloc.h: No such file or directory解決方法
發(fā)布于 2014-12-19 11:19:17 | 24844 次閱讀 | 評論: 8 | 來源: PHPERZ
這里有新鮮出爐的Redis 官方指南,程序狗速度看過來!
?
Redis Key-Value數(shù)據(jù)庫
Redis是一個(gè)開源的使用ANSI C語言編寫、支持網(wǎng)絡(luò)、可基于內(nèi)存亦可持久化的日志型、Key-Value數(shù)據(jù)庫,并提供多種語言的API。
?
本文為大家講解的是Redis 2.8.18 安裝報(bào)錯(cuò) error: jemalloc/jemalloc.h: No such file or directory解決方法,感興趣的同學(xué)參考下。
錯(cuò)誤描述
安裝Redis 2.8.18時(shí)報(bào)錯(cuò):
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
原因分析
在README 有這個(gè)一段話。
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
說關(guān)于分配器allocator, 如果有MALLOC ?這個(gè) 環(huán)境變量, 會有用這個(gè)環(huán)境變量的 去建立Redis。
而且libc 并不是默認(rèn)的 分配器, 默認(rèn)的是 jemalloc, 因?yàn)?jemalloc 被證明 有更少的?fragmentation problems 比libc。
但是如果你又沒有jemalloc 而只有 libc 當(dāng)然 make 出錯(cuò)。 所以加這么一個(gè)參數(shù)。
解決辦法
make MALLOC=libc
?
在安裝成功之后,可以運(yùn)行測試,確認(rèn)Redis的功能是否正常
$ make test出現(xiàn)報(bào)錯(cuò):
hadoop@stormspark:~/workspace/redis2.6.13/src$ make test You need tcl 8.5 or newer in order to run the Redis test make: *** [test] Error 1解決方式
安裝tcl
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/ cd /usr/local/tcl8.6.1/unix/ sudo ./configure sudo make sudo make install成功運(yùn)行test
轉(zhuǎn)載于:https://www.cnblogs.com/zhanglong8681/p/6909610.html
總結(jié)
以上是生活随笔為你收集整理的redis安装全过程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用yum源配合源码包安装openrest
- 下一篇: [BZOJ 1076][SCOI2008