首先下載redis軟件,官網是下載頁面時http://www.redis.io/download,下載完畢後進入下載的目錄執行web
tar zxvf redis-2.6.5.tar.gz
cd redis-2.6.5redis
make
若是是32位系統,須要執行vi src/.make-settings將OPT=-O2修改成OPT=-O2 -march=i686
make
cd src
make installapp
建立配置文件目錄和命令目錄並拷貝對應的文件,請根據實際狀況建立
mkdir -p /usr/local/webserver/redis/etc
mkdir -p /usr/local/webserver/redis/bin
cp redis* /usr/local/webserver/redis/bin/
cp mkreleasehdr.sh /usr/local/webserver/redis/bin/測試
cp ../redis.conf /usr/local/webserver/redis/etc/
設置後臺啓動vi /usr/local/webserver/redis/etc/redis.conf
daemonize no 修改成daemonize yes
啓動redis
/usr/local/webserver/redis/bin/redis-server /usr/local/webserver/redis/etc/redis.conf命令行
進入命令行測試/usr/local/webserver/redis/bin/redis-cliserver
中止redis的命令是/usr/local/webserver/redis/bin/redis-cli shutdown
使用過memcache的朋友應該不陌生,設置一個值set key1 100get
獲取get key1hash
追加值append key1 11io
刪除del key1class
查看長度strlen key1
hash表設置姓名和郵箱
hset users user zhangsan
hset users email aaa@ff.com
獲取hash表中某個值hget users email
獲取hash中全部值hgetall users
本站redis安裝包下載 redis-2.6.5.tar.gz
也能夠點此下載redis相關軟件