软件包下载
wget https://github.com/redis/redis/archive/7.0.7.tar.gz
tar -zxvf 7.0.7.tar.gz
编译安装
make && make install
/usr/local/bin
redis-server
redis-cli
redis-cli -h host -p port -a password
redis-cli -u password shutdown
配置Redis服务
- 配置参考 服务管理
- 步骤1 在
/etc/systemd/system/
新建文件 nginx.service
- 步骤2 编辑文件
vim /etc/systemd/system/redis.service
[Unit]
Description=redis
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /usr/local/etc/redis.conf
ExecStop=/bin/kill -s QUIT $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable redis.service
配置文件详解
cp redis.conf /usr/local/etc/
redis-server /usr/local/etc/redis.conf
bind 127.0.0.1
protected-mode yes
port 6379
timeout 0
daemonize no
pidfile /var/run/redis_6379.pid
logfile ""
dir ./
databases 16
always-show-logo no
requirepass 142857
maxmemory 512mb