单个redis(redis3.2.10 centos7.5)搭建
2019-01-04 本文已影响0人
斯文的七_f35e
redis各版本下载地址:http://download.redis.io/releases/
yum -y install gcc-c++&& yum -y install net-tools&& yum -y install wget&& yum -y install tcl
tar -xf redis-3.2.10.tar.gz -C /usr/local/
cd /usr/local/redis-3.2.10
make
make install
make test(可略)
(make会在src目录下创建可执行文件)
#创建相应的目录
mkdir -p /usr/local/redis/
mkdir -p /usr/local/redis/bin/
mkdir -p /usr/local/redis/conf/
mkdir -p /usr/local/redis/logs/
复制文件
cp redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb /usr/local/redis/bin/
cp redis.conf /usr/local/redis/conf/
修改配置文件:
bind 0.0.0.0
daemonize yes
pidfile /usr/local/redis/redis_6379.pid
logfile "/usr/local/redis/logs/redis.log"
# 设置RDB保存位置
dir /usr/local/redis
# 开启AOF
appendonly yes
设置启动
cp /usr/local/redis-3.2.10/utils/redis_init_script /etc/init.d/redis
修改如下位置
# chkconfig:2345 90 10
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/usr/local/redis/redis_${REDISPORT}.pid
CONF="/usr/local/redis/conf/redis.conf"
chmod +x /etc/init.d/redis
chkconfig redis on
service redis start #启动