您好,登錄后才能下訂單哦!
############################
基礎環境
OS: centos 6.6
DB: redis 3.0.7
#############################
1.下載源碼包,穩定版本
http://redis.io/ -->Download it -->download 3.0.7.
2.上傳到服務器/usr/local目錄下,解壓縮
#cd /usr/local
# tar -zxvf redis-3.0.7.tar.gz
3.編譯
# cd redis-3.0.7
# make
#make test --可以省略
4.安裝
# make install
5.安裝數據庫設置,可以設置不同端口,多個實例
# ./utils/install_server.sh --可以運行多次
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
6.驗證
# ps -ef |grep redis
# chkconfig --list |grep redis
redis_6379 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# redis-cli -p 6379
127.0.0.1:6379> info
7.啟停
#service redis_6379 stop
#service redis_6379 start
8.問題總結:
1)安裝gcc、jemalloc
# yum -y install gcc
# rpm -ivh jemalloc-3.6.0-1.el6.x86_64.rpm
2)make時報如下錯誤,一定要用jemalloc
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
原因是jemalloc重載了Linux下的ANSI C的malloc和free函數。解決辦法:make時添加參數。
解決方法:
#make MALLOC=libc
3)make之后,會出現一句提示
Hint: To run 'make test' is a good idea ;)
但是不測試,通常是可以使用的。若我們運行make test ,會有如下提示
#make test
You need tcl 8.5 or newer in order to run the Redis test
make: ***[test] Error_1
解決辦法是用yum安裝tcl8.5(或去tcl的官方網站http://www.tcl.tk/下載8.5版本,并參考官網介紹進行安裝)
#yum install tcl
4)編譯測試報錯
*** [err]: Test replication partial resync: no backlog (diskless: no, reconnect: 1) in tests/integration/replication-psync.tcl
Expected condition '[s -1 sync_partial_err] > 0' to be true ([s -1 sync_partial_err] > 0)
Cleanup: may take some time... OK
make[1]: *** [test] 錯誤 1
make[1]: Leaving directory `/usr/local/redis-3.0.7/src'
make: *** [test] 錯誤 2
解決辦法:
在速度較慢的機器上執行make test可能出現下列錯誤,無影響
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。