Redis安装记录
-
进入官网:https://redis.io/download/
-
下载安装包redis-7.2.4.tar.gz,并解压,进入解压后的目录
wget http://download.redis.io/releases/redis-7.2.4.tar.gz tar xzf redis-7.2.4.tar.gz cd redis-5.0.2 make cd src make install PREFIX=/opt/redis make test redis-server
-
虚拟机里部署2个环境,
- Ubuntu :ubuntu-22.04.4-desktop-amd64.iso 版本,
- Linux :CentOS-7-x86_64-Everything-2009.iso版本
遇到的问题
-
执行make提示’make’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。- 原因:redis是C++编写,依赖gcc
- 解决办法:安装gcc。执行yum命令
-
执行yum命令提示’yum’ 不是内部或外部命令,也不是可运行的程序
-
原因:
yum
命令,是一个在Linux发行版上用于包管理的工具 -
办法:Linux安装gcc办法
-
结果:安装gcc之后还是无法执行make。需要继续执行sudo apt install make。成功后执行make解决
-
-
执行make install PREFIX=/opt/redis提示pkg-config: not found 无法创建目录 “/opt/redis”权限不够
- 原因: '‘pkg-config: not found’'是因为pkg包分配错误的原因
- 办法:执行 ”sudo apt-get install pkg-config“
- 结果:执行之后,选择Y提示"无法下载…,文件尺寸不符的问题。您使用的镜像正在同步?" 提示我有几个软件包无法下载,然后我执行“sudo apt-get update" 然后继续执行”sudo apt-get install pkg-config“,就成功了!
-
执行“make test" 提示 couldn’t open “home/mwq/{乱码*}/redis-7.0.15/tests/tmp/server.3572.7/appendonlydir/appendonly.aof.maifest”:no suchfile or directory while executing
-
原因:似乎是安装路径包含中文导致
-
办法:一开始我按照网上办法执行“sudo make distclean” ,然后继续“make test",还是提示失败
然后我自己分析可能是中文路径导致,我马上新建了英文路径转移了redis-7.0.15。继续执行“make test",这次执行了很长时间,过了短时间,我单独开终端执行“redis-server"是提示成功的
-
结果:过了10分钟,还是提示错误,但是redis服务应该是正常开启了???这是啥情况谁能告诉我。
-
-
Redis难以在windows上面安装
- 原因:大部分Redis安装在Linux上面,windows上面要特殊版本
- 办法:
-
Redis查看服务是否成功。
- 办法:找到“redis-cli”所在目录,执行“./redis-cli"查看服务是否成功。执行exit可退出
-
关闭Redis
- 办法:redis-cli shutdown 或者 redis-cli -h 127.0.0.1 -p 6379 shutdown
-
指定配置文件启动redis
- 办法:sudo redis-server /etc/redis/redis.conf
-
查看redis服务器进程
-
办法: ps -ef | grep ps 、 aux | grep redis 注意空格
-
启动redis
- 办法:redis-server、 redis-cli 、 redis-cli -h ip地址 、 redis-cli -p 端口号
-
Redis基础命令集详解
- 办法:链接
-
链接虚拟机里部署的Redis失败,执行“telnet 192.168.239.128 6379",提示
-DENIED Redis is running in protected mode because protected mode is enabled and no password is set for the default user. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a an authentication password for the default user. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.