firemail
标题:
Red Hat 4.8.5-39 Redis安装
[打印本页]
作者:
Qter
时间:
2020-4-26 11:10
标题:
Red Hat 4.8.5-39 Redis安装
本帖最后由 Qter 于 2020-4-27 14:17 编辑
redis-cli -v
redis-cli 4.0.11
redis-server -v
Redis server v=4.0.11 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=2b84e7da47892528
卸载4.0.11 版本
ps -ef | grep redis
root 20422 17823 0 23:20 pts/1 00:00:00 grep --color=auto redis
root 21018 1 0 Apr18 ? 00:10:33 /usr/local/bin/redis-server 127.0.0.1:6379
停止redis:
使用客户端
redis-cli shutdown
后台运行pkill redis 或者 kill -9 pid也可以
查看redis是否运行 ps -ef|grep redis
卸载redis 删除所有相关文件夹就可以了,卸载之前先停止服务。
查看redis在哪 whereis redis-server
rm -f /usr/bin/redis-server
rm -f /usr/bin/redis-benchmark
rm -f /usr/bin/redis-check-aof
rm -f /usr/bin/redis-check-rdb
rm -f /usr/bin/redis-cli
rm -f /usr/bin/redis-sentinel
rm -f /usr/local/bin/redis-server
rm -f /usr/local/bin/redis-benchmark
rm -f /usr/local/bin/redis-check-aof
rm -f /usr/local/bin/redis-check-rdb
rm -f /usr/local/bin/redis-cli
rm -f /usr/local/bin/redis-sentinel
rm -f /usr/share/man/man1/redis-benchmark.1.gz
rm -f /usr/share/man/man1/redis-check-rdb.1.gz
rm -f /usr/share/man/man1/redis-sentinel.1.gz
rm -f /usr/share/man/man1/redis-check-aof.1.gz
rm -f /usr/share/man/man1/redis-cli.1.gz
rm -f /usr/share/man/man1/redis-server.1.gz
查看redis在哪 whereis redis
rm -fr /etc/redis
rm -f /etc/redis/redis.conf
rm -f /etc/redis.conf
rm -fr /usr/local/redis
安装
1.获取redis资源
wget
http://download.redis.io/releases/redis-5.0.8.tar.gz
默认下载到当前用户的~根目录下
cd ~
2.解压
tar xzvf redis-5.0.8.tar.gz
3.安装
cd redis-5.0.8
make
cd src
make install PREFIX=/usr/local/redis
4.移动配置文件到安装目录下
cd ../
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
5.配置redis为后台启动
vi /usr/local/redis/etc/redis.conf //将 daemonize no 改成daemonize yes
6.将redis加入到开机启动
vi /etc/rc.local //在里面添加内容:/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf (意思就是开机调用这段开启redis的命令)
7.开启redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
遇到的问题
redis-cli: command not found
# 将redis-cli拷贝到/usr/local/bin/下,让redis-cli指令可以在任意目录下直接使用
cp /usr/local/redis/bin/* /usr/local/bin/
或者
cp /usr/local/redis/bin/redis-cli /usr/local/bin/
cp /usr/local/redis/bin/redis-server /usr/local/bin/
常用命令
redis-server /usr/local/redis/etc/redis.conf //启动redis
pkill redis //停止redis
卸载redis:
rm -rf /usr/local/redis //删除安装目录
rm -rf /usr/bin/redis-* //删除所有redis相关命令脚本
rm -rf /root/download/redis-5.0.8 //删除redis解压文件夹
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3