show
top

linux redis 4.x 安装和配置启动详解

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

tar xzf redis-4.0.9.tar.gz

mv redis-4.0.9 /data/mine_redis

cd /data/mine_redis

make 需要gcc 如果报错make MALLOC=libc

make install

redis-server 测试下

//细化配置 建立redis用户
groupadd redis
useradd -s /sbin/nologin -M -g redis redis

mkdir /etc/redis 配置目录
mkdir /data/redis_mine/logs 日记目录
mkdir /data/redis_mine/data 数据目录

设置权限
chmod -R 755 /etc/redis
chmod -R 755 /data/redis_mine/

chown -R redis:redis /etc/redis
chown -R redis:redis /data/redis_mine/

copy份默认的
cp redis.conf /data/redis_mine/logs/6379.conf

修改

logfile /data/redis_mine/logs/6379.log
dir /data/redis_mie/data
dbfilename 6379.rdb
requirepass 123456 redis 密码
maxclients 1024
maxmemory 1gb
如果要让工具直接访问 注释掉bind

redis-server /etc/redis/6379.conf & 以后台方式启动

redis-cli

keys * 没权限

auth 123456

keys * 这次可以

开机自动

conf
daemonize yes 对应forking
supervised auto # or systemd
pidfile /var/run/redis/redis_6379.pid

[Unit]
Description=Redis

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf
ExecStop=/usr/local/bin/redis-cli -p 6379-a 123456 shutdown
PrivateTmp=true
User=redis
Group=redis

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl start redis_6379

systemctl enable redis_6379

redis-cli 检查

127.0.0.1:6379> set haha nola
OK
127.0.0.1:6379> get haha
"nola"
[参考](http://o.inchiki.jp/obbr/308)
工具
RedisDesktopManager 注意mac要收钱 用brew cast装

jetBrains 系列 plugins -> iedis

posted @ 2018-04-08 20:05  蓝波大人  阅读(860)  评论(0编辑  收藏  举报