下载
从官方网站下载稳定版本 redis-6.0.8.tar.gz,网址为:http://download.redis.io/releases/
用ftp或sftp工具拷贝redis-6.0.8.tar.gz到linux系统
解压
# 将上述包解压后tar -xvf redis-6.0.8.tar.gz
安装
cd redis-6.0.8# 编译安装到指定目录下makecd src && make PREFIX=/data/redis install# 如果有执行出错,先安装gcc# 若出现【zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录】,# 则运行命令 make MALLOC=libc# 以下命令视情况使用# 编译出错时,清出编译生成的文件make distclean# 卸载make uninstall
修改配置文件
# 配置redis为后台启动# 拷贝配置文件到安装目录下cd ../mkdir /data/redis/confcp redis.conf /data/redis/conf# 配置redis为后台启动vim /data/redis/conf/redis.conf# 将daemonize no改为daemonize yesdaemonize no -> daemonize yes# 如有需要添加reids密码,添加requirepass cloudmas# 如需开启多线程模式,请配置以下配置io-threads-do-reads yesio-threads 4
开机启动
# 将redis加入到开机启动vi /etc/rc.local# 添加内容:/data/redis/bin/redis-server /data/redis/conf/redis.conf# 手动启动# 开启redis:/data/redis/bin/redis-server /data/redis/conf/redis.conf
远程连接
# 远程连接使用工具远程连接redis时,可能会出现连接问题,可使用下方命令查看当前绑定的IP:HOSTps -ef|grep redis如需其他机器连接请修改以下配置:bind 127.0.0.1修改为bind 当前ip或直接注释 bind ,注释后代表绑定本机所有ip
