Redis3.2.6安裝

安裝包

redis-3.2.6.tar.gz

 

解壓

tar -xzvf redis-3.2.6.tar.gz

 

安裝gcc和make

yum install -y gcc
yum install -y make

 

編譯(在根目錄執行)

make

如下所示: 

    CC slowlog.o
    CC scripting.o
    CC bio.o
    CC rio.o
    CC rand.o
    CC memtest.o
    CC crc64.o
    CC bitops.o
    CC sentinel.o
    CC notify.o
    CC setproctitle.o
    CC blocked.o
    CC hyperloglog.o
    CC latency.o
    CC sparkline.o
    CC redis-check-rdb.o
    CC geo.o
geo.c: In function ‘membersOfAllNeighbors’:
geo.c:355:13: warning: missing initializer for field ‘longitude’ of ‘GeoHashArea’ [-Wmissing-field-initializers]
             GeoHashArea myarea = {{0}};
             ^
In file included from ../deps/geohash-int/geohash_helper.h:36:0,
                 from geo.c:32:
../deps/geohash-int/geohash.h:78:18: note: ‘longitude’ declared here
     GeoHashRange longitude;
                  ^
    LINK redis-server
    INSTALL redis-sentinel
    CC redis-cli.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    CC redis-check-aof.o
    LINK redis-check-aof

Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/root/redis-3.2.6/src'

如果編譯出現問題,需要先清理再編譯(make clean)

 

安裝到opt(在跟目錄執行)

make install PREFIX=/opt/redis3.2.6

 如下所示: 

 [root@VM_167_204_centos redis-3.2.6]# make install PREFIX=/opt/redis-3.2.6
cd src && make install
make[1]: Entering directory `/root/redis-3.2.6/src'

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]: Leaving directory `/root/redis-3.2.6/src'

 

複製配置文件

cp redis.conf /etc/redis.conf 

 

修改配置文件

vim /etc/redis.conf

# 後臺啓動
daemonize yes

# 註釋(綁定IP)
bind 127.0.0.1 192.168.2.200

# 端口
port 6379

# 密碼
requirepass root

# aof操作備份
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec

# 數據目錄
dir /opt/redis-3.2.6/db

# 主從複製
# slaveof <masterip> <masterport>

 

配置環境變量

export REDIS_HOME=/opt/redis-3.2.6
export PATH=$PATH:$REDIS_HOME/bin

 

啓動服務

redis-server /etc/redis.conf

 

停止服務

redis-cli shutdown

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章