centos8 redis 6.2.6源码安装

centos8 redis 6.2.6源码安装

下载解压

cd /data
wget http://download.redis.io/releases/redis-6.2.6.tar.gz
tar xf redis-6.2.6.tar.gz
cd redis-6.2.6/

编译安装

make PREFIX=/usr/local/redis6 install

配置

mkdir /usr/local/redis6/conf

cp redis.conf /usr/local/redis6/conf/

mkdir -p /data/redis6/data
mkdir -p /data/redis6/logs

vi /usr/local/redis6/conf/redis.conf
bind 0.0.0.0
daemonize yes
logfile "/data/redis6/logs/redis.log"
dir /data/redis6/data/
maxmemory 1024MB
io-threads 3
requirepass 123456

配置systemd

vi /lib/systemd/system/redis6.service
[Unit]
Description=Redis
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis6/bin/redis-server /usr/local/redis6/conf/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

服务启停及开机启动

systemctl daemon-reload 
systemctl start redis6
systemctl enable redis6

登录验证

ln -s /usr/local/redis6/bin/redis-cli /usr/bin/redis-cli
redis-cli -h 127.0.0.1 -p 6379 -a 123456
set a 11
get a

你可能感兴趣的:(linux,redis,数据库)