CentOS 6.6安裝單節點Redis 3.0.3

zhenghaishu發表於2017-05-23


1、下載redis-3.0.3並解壓縮

# cd /usr/local

# wget

# tar -zxvf redis-3.0.3.tar.gz


2、安裝redis

# cd redis-3.0.3

# make

# make test


這裡可能會報缺少tcl的錯誤

解決方法:下載並安裝tcl

# cd /usr/local/

# wget 

# tar -zxvf tcl8.5.10-src.tar.gz

# cd /tcl8.5.10-src/unix

# ./configure

# make

# make install


接著重新對redis進行make test

# cd /usr/local/redis3.0.3/

# make test


執行make install後,發現在/usr/local/bin/下生成了六個跟redis相關的可執行檔案

# make install

# ls /usr/local/bin/

redis-benchmark  redis-check-dump  redis-sentinel  tclsh8.5

redis-check-aof  redis-cli         redis-server


這六個可執行檔案在/usr/local/redis-3.0.3/src/下也有,make install的作用應該就是把這六個檔案從/usr/local/redis-3.0.3/src/複製到/usr/local/bin/下


部分檔案的作用如下

redis-server:Redis伺服器的daemon啟動程式

redis-cli:Redis客戶端命令列操作工具.你也可以用telnet根據其純文字協議來操作

redis-benchmark:Redis效能測試工具,測試Redis在你的系統及你的配置下的讀寫效能.


3、修改配置檔案

# cd /usr/local/redis-3.0.3/

# vi redis.conf

一般需要把daemonize no改為 daemonize yes,其他的看需要修改。


4、啟動redis

# redis-server redis.conf


5、檢視是否啟動

# netstat -antp | grep redis

tcp        0      0 0.0.0.0:6379                0.0.0.0:*                   LISTEN      78499/redis-server 

tcp        0      0 :::6379                     :::*                        LISTEN      78499/redis-server

上面顯示的結果,表示redis正常啟動。


6、測試

# redis-cli

127.0.0.1:6379> ping

PONG

127.0.0.1:6379> set name feicuisenlin

OK

127.0.0.1:6379> get name

"feicuisenlin"

127.0.0.1:6379>

上面顯示的結果,表示redis部署成功。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29485627/viewspace-2139764/,如需轉載,請註明出處,否則將追究法律責任。

相關文章