1、包管理器安装:
yum/apt install redis systemctl start redis systemctl enable redis
2、编译安装:
wget http://download.redis.io/releases/redis-7.4.1.tar.gz tar xvf redis-7.4.1.tar.gz cd redis-7.4.1 make make PREFIX=/usr/local/redis install cp redis.conf /usr/local/redis/ useradd -U -r -M -s /bin/false redis cat > /lib/systemd/system/redis.service << "EOF" [Unit] Description=Redis persistent key-value database After=network.target [Service] ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf --daemonize no ExecStop=/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown User=redis Group=redis LimitNOFILE=65536 [Install] WantedBy=multi-user.target EOF ln -sf /usr/local/redis/bin/* /usr/local/bin/ #linux中以unix socket运行redis,提升连接速度 sed -i "s/# unixsocket \/run\/redis.sock/unixsocket \/tmp\/redis.sock/g" /usr/local/redis/redis.conf sed -i "s/# unixsocketperm 700/unixsocketperm 666/g" /usr/local/redis/redis.conf #Failed opening the RDB file dump.rdb问题 mkdir /usr/local/redis/db chown redis:redis /usr/local/redis/db -R sed -i "s/dir .\//dir \/usr\/local\/redis\/db\//g" /usr/local/redis/redis.conf #日志文件 mkdir /usr/local/redis/log sed -i "s/logfile \"\"/logfile \"\/usr\/local\/redis\/log\/redis.log\"/g" /usr/local/redis/redis.conf touch /usr/local/redis/log/redis.log chown redis:redis /usr/local/redis/log/redis.log #The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.问题 echo 511 > /proc/sys/net/core/somaxconn echo "echo 511 > /proc/sys/net/core/somaxconn" >> /etc/rc.local #MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk问题 echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf sysctl -p echo 1 > /proc/sys/vm/overcommit_memory # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel.问题 echo never > /sys/kernel/mm/transparent_hugepage/enabled echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local #注意:使用systemd的发行版,/etc/rc.local或软链接到的/etc/rc.d/rc.local无执行权限,需要处理一下 chmod +x /etc/rc.local systemctl start redis systemctl enable redis #设置密码(如:redis123) sed -i "s/# requirepass foobared/requirepass redis123/g" /usr/local/redis/redis.conf
1、下载地址:https://github.com/zkteco-home/redis-windows
最新版本为:redis-7.4.1
2、解压,命令行进入当前目录,运行“redis-server.exe redis.conf”
© 2016-2024 清风的个人笔记