当前位置: 首页 > Linux

Redis安装

时间:2023-04-07 02:08:17 Linux

标题:Redis安装分类:[Redis]标签:[数据库]日期:2021/01/04作者:hackett微信公众号:超时猿1.Linux源码安装去官网下载最新的6.0.9版本,下载地址:https://redis.io/downloadDownload,解压编译Redis用:wgethttps://download.redis.io/releases/redis-6.0.9.tar.gztarxzfredis-6.0.9.tar.gz//解压cdredis-6.0.9//进入源码目录make//直接make安装可能有以下内容make过程中的错误make:***[server.o]Error1//make安装错误的原因是:gcc版本太低,centosyum安装的gcc是4.8.5。因此,需要升级gcc。升级过程如下:yum-yinstallcentos-release-sclyum-yinstalldevtoolset-9-gccdevtoolset-9-gcc-c++devtoolset-9-binutilssclenabledevtoolset-9bashecho"source/opt/rh/devtoolset-9/enable">>/etc/profilegcc-v2.Ubuntuapt命令安装使用apt命令安装sudoapt-getupdatesudoapt-getinstallredis-server3.启动服务并测试进入src目录并启动后台redis服务cdsrc./redis-server&//后台运行使用客户端程序redis-cli与redis服务进行交互./redis-cli//启动redis客户端我们来测试下面(127.0.0.1是本机IP,6397是redis的服务端口号)[root@VM-0-11-centossrc]#./redis-cli127.0.0.1:6379>127.0.0.1:6379>setfoobarOK127.0.0.1:6379>getfoo"bar"127.0.0.1:6379>redis配置(通过修改redis.conf文件127.0.0.1:6379>CONFIGsetloglevel"notice"OK127.0.0.1:6379>CONFIGgetloglevel1)"loglevel"2)"notice"觉得文章还不错记得点赞关注我的微信【加班猿】获取更多内容