1.centos7环境编译安装redis5.0.8
cd /usr/local
wget http://download.redis.io/releases/redis-5.0.8.tar.gz
tar xf redis-5.0.8.tar.gz
cd redis-5.0.8
make && make install
# 创建bin目录存放启动文件
mkdir bin
cp src/redis-server bin
cp src/redis-cli bin
2.创建启动脚本
[root@eus-online-video-web01:~]# cat /lib/systemd/system/redis.service
[Unit]
Description=nginx scripts
After=network.target remote-fs.target nss-lookup.target syslog.target
[Service]
Type=forking
Password=pass
PidPort=6379
ExecStart=/usr/local/redis-5.0.8/bin/redis-server /usr/local/redis-5.0.8/redis.conf
ExecStop=/usr/local/redis/bin/redis-cli -a ${Password} -p ${PidPort} shutdown
[Install]
WantedBy=multi-user.target
3.添加配置文件
[root@eus-online-video-web01:/usr/local/redis]# egrep -v '^#|^$' redis.conf
# 绑定本机内网IP
bind 192.168.0.10
protected-mode no
# 端口
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
# 以匿名模式启动
daemonize yes
supervised no
loglevel notice
logfile "/usr/local/redis-5.0.8/logs/redis.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
# 存放数据目录
dir /data/redis_data
# 密码
masterauth pass
requirepass pass
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command shutdown ""
rename-command CONFIG "configx"
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
# 最大使用内存
maxmemory 2GB
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
centos7环境下编译安装redis5.0.8
最新推荐文章于 2024-05-29 10:35:10 发布