redis单节点编译部署

1. 安装准备

# 创建目录

mkdir /server/tools -p

cd /server/tools

wget http://download.redis.io/releases/redis-5.0.5.tar.gz

mkdir /home/redis -p

2. 安装redis

#1,使用指令进入tools目录

cd /server/tools/

#2,使用指令解压缩

tar -zxvf redis-5.0.5.tar.gz

#3,使用指令进入目录

cd /server/tools/redis-5.0.5/

#4,使用指令编译redis

make MALLOC=libc

make PREFIX=/home/redis install

#5,使用指令进入目录

cd /home/redis/bin/

#6,使用指令查看是否安装成功,

./redis-server --version

#7,结果如下:

# Redis server v=5.0.5 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=d84647458df2f328

3.配置redis

#1,使用指令将配置文件拷贝

cp /server/tools/redis-5.0.5/redis.conf /home/redis/bin/ 

#2,使用指令配置redis.conf

mkdir /home/redis/log

mkdir /home/redis/db

sed -i 's/# requirepass foobared/requirepass redisspass/g' /home/redis/bin/redis.conf

sed -i 's/requirepass redisspass/requirepass RGw3e7St7TgHXV7f/g' /home/redis/bin/redis.conf

#sed -i 's#6379#7499#g' /home/redis/bin/redis.conf

sed -i 's#^dir ./#dir /home/redis/db/#g' /home/redis/bin/redis.conf

sed -i 's/bind 127.0.0.1/bind 0.0.0.0/g' /home/redis/bin/redis.conf

sed -i 's/daemonize no/daemonize yes/g' /home/redis/bin/redis.conf

sed -i 's#logfile ""#logfile "/home/redis/log/redis.log"#g' /home/redis/bin/redis.conf

#3,配置环境变量

vim /etc/profile #添加下面的内容

export REDIS_HOME=/home/redis

export PATH=$REDIS_HOME/bin:$REDIS_HOME/bin:$PATH

 

source /etc/profile # 生效

redis-server --version # 查看版本号

 

posted @ 2020-10-27 19:11  ld_001  阅读(130)  评论(0编辑  收藏  举报