redis部署安装
1.安装依赖
yum -y install gcc automake autoconf libtool make
2.编译安装
tar -xvf redis-6.2.8.tar.gz cd redis-6.2.8 make && make install PREFIX=/usr/local/redis
3.配置环境变量
vim /etc/profile #redis env export REDIS_HOME=/usr/local/redis export PATH=$PATH:$REDIS_HOME/bin source /etc/profile
4.修改配置
mkdir /usr/local/redis/{data,logs,conf} cp redis.conf /usr/local/redis/conf/ vim /usr/local/redis/conf/redis.conf # 绑定服务器域名或IP地址 bind 192.168.9.251
# 设置端口 port 6379 # 后台运行 daemonize yes # pid进程文件名,以端口号命名 pidfile /var/run/redis_6379.pid # 日志文件名称,以端口号为目录来区分 logfile "/usr/local/redis/logs/redis.log" # 数据文件存放地址,以端口号为目录名来区分 dir /usr/local/redis/data # 启动AOF增量持久化策略 appendonly yes # 发生改变,则记录日志 appendfsync always
5.启动redis
cd /usr/local/redis/conf
#设置redis密码
sed -i "s/# requirepass foobared/requirepass password/g" redis.conf
#启动redis服务
redis-server /usr/local/redis/conf/redis.conf