NoSQL之Redis - CentOS 6.5安装测试
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,1.下载redis可以在线安装或者下载 redis①在线安装前需要检测是否存在rpm包不存在的话查看yum在线是否存在rpm包不存在的话就只能手动下载或者用别的方式下载[root@localhost
千家信息网最后更新 2025年11月07日NoSQL之Redis - CentOS 6.5安装测试
1.下载redis
可以在线安装或者下载 redis
①在线安装前需要检测是否存在rpm包不存在的话查看yum在线是否存在rpm包不存在的话就只能手动下载或者用别的方式下载
[root@localhost ~]# rpm -qa|grep redis[root@localhost ~]# yum list|grep redis
说明不存在。
②去官网下载或者在线下载
wget http://redis.googlecode.com/files/redis-2.2.13.tar.gz
官网下载好的 redis 已经存在博客中了点击下载 redis。
2.安装
由于是tar.gz格式的所以需要解压安装
下载好之后查找下载文件所在路径
[root@localhost ~]# whereis redisredis: /etc/redis[root@localhost ~]#
解压编译redis的软件包需要有gcc环境
总之缺少什么安装什么。
tar -zxvf reids-2.8.13.tar.gzcd redis-2.8.13makesudo make install#配置开始---编译完成后在Src目录下有四个可执行文件redis-server、redis-benchmark、redis-cli和redis.conf。然后拷贝到一个目录下。mkdir /usr/rediscp redis-server /usr/rediscp redis-benchmark /usr/rediscp redis-cli /usr/rediscp redis.conf /usr/rediscd /usr/redis#配置结束--
或者可以这样配置
mkdir /etc/rediscp redis.conf /etc/redis/redis.confmkdir /var/lib/redis
可从此处下载修改好的 redis.conf
启动redisredis-server /etc/redis/redis.conf#即可在后台启动redis服务确认运行了之后可以用redis-benchmark命令测试看看还可以通过redis-cli命令实际操作一下比如#install的时候redis的命令会被拷贝到/usr/local/bin下面
3.测试
客户端测试一下是否启动成功
[root@localhost src]# ps -aux|grep redisWarning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQroot 23266 0.0 0.7 137356 7768 ? Sl 00:23 0:04 redis-server *:6379root 23982 0.0 0.5 19404 5100 pts/0 S+ 01:09 0:00 redis-cliroot 24398 0.0 0.0 103244 876 pts/2 S+ 01:44 0:00 grep redis[root@localhost src]# redis-cli127.0.0.1:6379> set w wangOK127.0.0.1:6379> get w"wang"127.0.0.1:6379>
4.关闭服务
redis-cli shutdown如果端口变化可以指定端口:redis-cli -p 6379 shutdown
127.0.0.1:6379> i+jCould not connect to Redis at 127.0.0.1:6379: Connection refusednot connected> set w 3Could not connect to Redis at 127.0.0.1:6379: Connection refusednot connected>
5.启动服务
[root@localhost src]# redis-server[24502] 28 Oct 01:54:35.784 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf[24502] 28 Oct 01:54:35.784 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.13 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 24502 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [24502] 28 Oct 01:54:35.786 # Server started, Redis version 2.8.13[24502] 28 Oct 01:54:35.786 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.[24502] 28 Oct 01:54:35.786 * DB loaded from disk: 0.000 seconds[24502] 28 Oct 01:54:35.786 * The server is now ready to accept connections on port 6379
启动之后最好重新打开个窗口运行redsi-cli进入控制台
否则可能出现连接错误。和windows下cmd运行tomcat类似。
[root@localhost redis]# redis-cliCould not connect to Redis at 127.0.0.1:6379: Connection refusednot connected> redis-cliCould not connect to Redis at 127.0.0.1:6379: Connection refusednot connected> [root@localhost redis]# redis-cli127.0.0.1:6379> set name = wangxin(error) ERR syntax error127.0.0.1:6379> set name wangxinOK127.0.0.1:6379> set age 26OK127.0.0.1:6379> get name age(error) ERR wrong number of arguments for 'get' command127.0.0.1:6379> get name"wangxin"127.0.0.1:6379> get age"26"127.0.0.1:6379>
在线
测试
命令
服务
运行
配置
拷贝
文件
目录
端口
编译
成功
下有
博客
可以通过
后台
在线下载
实际
客户
客户端
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
国内软件开发各个环节
网络技术部门工作流程图
网络安全攻击技术最新
物流数据库需求分析与设计
电脑倒计时软件开发
网络安全法运营者角度
2k20生涯模式服务器
山西联想服务器虚拟化价格
盗版我的世界服务器
网络安全项目包括什么
使用数据库管理档案
歙县网络安全费用
猿宝互联网科技有限公司
软件开发应届生试用期多久
多盟智胜网络技术官网
塔城地区公安局网络安全保卫支队
小学生上网课网络安全
对象图在软件开发中的作用
数据库管理岗面试题
网络技术科 主管职责
寻仙手游点亮服务器
ug如何导入扫描数据库
自己可以搭建邮箱服务器吗
一汽解放网络安全
武汉售后完善的计算机软件开发
找网络技术员上门的平台
有哪些软件开发的单位
潍坊物流报价软件开发公司
网络安全漏洞教学
nosql注入服务器攻击