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 redis

redis: /etc/redis

[root@localhost ~]#

解压编译redis的软件包需要有gcc环境

总之缺少什么安装什么。

tar -zxvf reids-2.8.13.tar.gz

cd redis-2.8.13

make

sudo make install

#配置开始---

编译完成后在Src目录下有四个可执行文件redis-server、redis-benchmark、redis-cli和redis.conf。然后拷贝到一个目录下。

mkdir /usr/redis

cp redis-server  /usr/redis

cp redis-benchmark /usr/redis

cp redis-cli  /usr/redis

cp redis.conf  /usr/redis

cd /usr/redis

#配置结束--

或者可以这样配置
mkdir /etc/redis
cp redis.conf /etc/redis/redis.conf
mkdir  /var/lib/redis

可从此处下载修改好的 redis.conf 
启动redis
redis-server /etc/redis/redis.conf
#即可在后台启动redis服务确认运行了之后可以用redis-benchmark命令测试看看还可以通过redis-cli命令实际操作一下比如
#install的时候redis的命令会被拷贝到/usr/local/bin下面

3.测试

客户端测试一下是否启动成功

[root@localhost src]# ps -aux|grep redis
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root    23266  0.0  0.7 137356  7768 ?        Sl  00:23  0:04 redis-server *:6379
root    23982  0.0  0.5  19404  5100 pts/0    S+  01:09  0:00 redis-cli
root    24398  0.0  0.0 103244  876 pts/2    S+  01:44  0:00 grep redis
[root@localhost src]# redis-cli
127.0.0.1:6379> set w wang
OK
127.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+j
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> set w 3
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not 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-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> 
[root@localhost redis]# redis-cli
127.0.0.1:6379> set name = wangxin
(error) ERR syntax error
127.0.0.1:6379> set name wangxin
OK
127.0.0.1:6379> set age 26
OK
127.0.0.1:6379> get name age
(error) ERR wrong number of arguments for 'get' command
127.0.0.1:6379> get name
"wangxin"
127.0.0.1:6379> get age
"26"
127.0.0.1:6379>

CentOS 6.5下Redis安装测试的更多相关文章

  1. CentOS 6.6下Redis安装配置记录

    转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/120.html?1455855209 在先前的文章中介绍过redis,以下 ...

  2. CentOS 6.5下Redis安装记录

    Redis简介: Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.从2010年3月15日起,Redis的开发工 ...

  3. CentOS 6.5下Redis安装详细步骤

    Redis简介: Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.从2010年3月15日起,Redis的开发工 ...

  4. (转)CentOS 6.5下Redis安装详细步骤

    Redis简介:Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.从2010年3月15日起,Redis的开发工作 ...

  5. CentOS 6.6下Redis安装

    安装redis的过程非常的简单,具体参考教程官网:http://redis.io/download 1.下载并安装 下载的redis-3.2.5.tar.gz安装包默认在/usr/local/src/ ...

  6. CentOS 下 redis 安装与配置

    CentOS 下 redis 安装与配置   1.到官网上找到合适版本下载解压安装 [root@java src]# wget -c http://redis.googlecode.com/files ...

  7. Redis、Redis+sentinel安装(Ubuntu 14.04下Redis安装及简单测试)

    Ubuntu下Redis安装两种安装方式: 1.apt-get方式 步骤: 以root权限登录,切换到/usr目录下. 接下来输入命令,apt-get install redis-server,如图: ...

  8. windows下Redis安装及利用java操作Redis

    一.windows下Redis安装 1.Redis下载 下载地址:https://github.com/MicrosoftArchive/redis 打开下载地址后,选择版本 然后选择压缩包 下载 R ...

  9. Windows下Redis安装配置和使用注意事项

    Windows下Redis安装配置和使用注意事项 一:下载 下载地址: https://github.com/microsoftarchive/redis/releases 文件介绍: 本文以3.2. ...

随机推荐

  1. android 开发 实现一个activity变成dialog对话框

    效果图: 首先说说为什么需要大费周章的去用activity实现一个dialog,明明android系统已经提供了一个更方便的dialog了.原因如下: 1.activity模式的dialog可以实现更 ...

  2. 关于微信支付接口,curl错误代码58

    微信支付接口,curl错误代码58 之前的微信付款到用户零钱都是好好的,今天运营来找我, 我想了了下,就是进行了网站搬家 看了下 微信支付相关的证书配置文件 知道了,在这个 要改下证书的路径 WxPa ...

  3. 笔记:js疑难复习

    apply 和 call的区别 call 和 apply 的区别只在于这两个函数接受的参数形式不同 var Person = function(name,age){ this.name = name; ...

  4. js代码执行过程

    一:first-blood:任何程序执行的第一步总是会先检查有没有语法错误,如果有,则直接抛出语法错误,直接跳出, 二:second-blood:预编译,预编译呢会有四个执行过程,1:创建执行期上下文 ...

  5. leetcode1009

    class Solution: def bitwiseComplement(self, N: int) -> int: if N==0: return 1 elif N==1: return 0 ...

  6. leetcode987

    public class Solution { private Dictionary<int, List<KeyValuePair<int,int>>> dic = ...

  7. uiautomator:Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

    尝试用android sdk的uiautomatorviewer抓元素的时候报错:Error while obtaining UI hierarchy XML file: com.android.dd ...

  8. 机器学习入门-数值特征-连续数据离散化(进行分段标记处理) 1.hist(Dataframe格式直接画直方图)

    函数说明: 1. .hist 对于Dataframe格式的数据,我们可以使用.hist直接画出直方图 对于一些像年龄和工资一样的连续数据,我们可以对其进行分段标记处理,使得这些连续的数据变成离散化 就 ...

  9. day05-表的三种关系

    表的三种关系 1)一对一 关联方式:foreign key+unique例如1个学生只能有1个学号,1个学号只能对应1个学生 #两张表: 学生表(student)和 学号表(student_id) # ...

  10. centos7 操作记录

    centos7 firewall 命令查看已经开放的端口firewall-cmd --list-ports查看开放的服务firewall-cmd --list-services开启端口firewall ...