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

 

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