5

Redis单机部署

 1 year ago
source link: https://www.cnblogs.com/stone-blogs/p/17413066.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Redis单机部署

下载最新稳定版Redis https://download.redis.io/redis-stable.tar.gz

# 安装wgetyum install -y wget# 安装gcc环境yum install gcc-c++# 获取安装包wget https://download.redis.io/redis-stable.tar.gztar -xvf redis-stable.tar.gzcd redis-stable

1.1 编译

# 安装包目录下安装: make# gcc编译
1667402-20230518191353678-1317351458.png

1.2 安装至指定目录

# 执行make PREFIX=/opt/redis install

1.3 配置文件

# 创建数据文件夹mkdir -p /opt/redis/data cat >/opt/redis/redis.conf << EOF# redis 密码#requirepass Password123# 保护模式关闭protected-mode no# 后台运行daemonize yes# key 监听器配置# notify-keyspace-events Ex# 配置持久化文件存储路径dir /opt/redis/data# 配置rdb# 15分钟内有至少1个key被更改则进行快照save 900 1# 5分钟内有至少10个key被更改则进行快照save 300 10# 1分钟内有至少10000个key被更改则进行快照save 60 10000# 开启压缩rdbcompression yes# rdb文件名 用默认的即可dbfilename dump.rdb# 设置redis最大内存256m 如果不设置最大内存,会占用系统内存直至内存爆满为止maxmemory 268435456# 开启aofappendonly yes# 文件名appendfilename "appendonly.aof"# 持久化策略,no:不同步,everysec:每秒一次,always:总是同步,速度比较慢# appendfsync alwaysappendfsync everysec# appendfsync noEOF

1.4 启动

cd /opt/redis/bin./redis-server ../redis.conf# 启动成功如下图
1667402-20230518190713995-157772105.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK