yesn 发表于 2018-11-5 09:15:46

CentOS 6.5下Redis安装详细步骤

Redis简介:
  Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。从2010年3月15日起,Redis的开发工作由VMware主持。
  redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set –有序集合)和hash(哈希类型)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且这些操作都是原子性的。在此基础上,redis支持各种不同方式的排序。与memcached一样,为了保证效率,数据都是缓存在内存中。区别的是redis会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,并且在此基础上实现了master-slave(主从)同步。
安装环境:
  CentOS 6.5
  Redis 2.8.13
下载安装:
  下载文件到 /opt/ 目录下
  wget http://download.redis.io/releases/redis-2.8.13.tar.gz
  解压文件
  tar zxvf redis-2.8.13.tar.gz
  切换目录到 redis-2.8.13 目录下
  cd redis-2.8.13
  执行make命令,最后几行的输出结果
  Hint: To run ‘make test’ is a good>
  make: Leaving directory `/opt/redis-2.8.13/src’
  执行安装命令
  make install
  提示:
cd src && make install  
make: Entering directory `/opt/redis-2.8.13/src'
  

  
Hint: To run 'make test' is a good idea
  

  
    INSTALL install
  
    INSTALL install
  
    INSTALL install
  
    INSTALL install
  
    INSTALL install
  
make: Leaving directory `/opt/redis-2.8.13/src'
  根据提示,执行:cd src && make install
  提示:
Hint: To run 'make test' is a good idea  

  
    INSTALL install
  
    INSTALL install
  
    INSTALL install
  
    INSTALL install
  
    INSTALL instal
  按照提示执行:make test
  提示:
You need tcl 8.5 or newer in order to run the Redis test  
make: *** Error 1
  解决方法参考:http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html
  也可以使用:yum install tcl 命令安装
  后来经搜索发现不需要安装,直接到src目录下执行 ./redis-server 就可以
  可以使用类似 ./redis-server /path/to/redis.conf 命令指定配置文件;
  Server started, Redis version 2.8.13
  The server is now ready to accept connections on port 6379
  服务启动成功,服务已经在6379端口上监听连接请求。
  你可以使用内置的客户端连接Redis:http://www.redis.cn/download.html
$ src/redis-cli  
redis> set foo bar
  
OK
  
redis> get foo
  
"bar"
注意事项:
  要远程访问它,还需要开启防。
  不要使用Ctrl+C,这样会使程序退出。


页: [1]
查看完整版本: CentOS 6.5下Redis安装详细步骤