Redis安装步骤
2016-07-11 00:18
465 查看
本文详细介绍Redis的安装步骤。
Redis: 3.0.7
安装环境
操作系统: Centos 6.4 ( cat /etc/redhat-release)Redis: 3.0.7
下载编译
从Redis官网下载:wget http://download.redis.io/releases/redis-3.0.7.tar.gz[/code]
解压:tar -zxvf redis-3.0.7.tar.gz cd redis-3.0.7
编译:make
如果出现找不到gcc编译器错误yum install -y gcc
编译过程出错,找到redis README中的说明:
Allocator
Selecting a non-default memory allocator when building Redis is done by setting theMALLOCenvironment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer
fragmentation problems than libc malloc
To force compiling against libc malloc, use:
% make MALLOC=libc
To compile against jemalloc on Mac OS X systems, use:
% make MALLOC=jemalloc
因此,由于找不到jemalloc导致出错,make的时候指定MALLOC为libcmake MALLOC=libc
做个链接:ln -s redis-3.0.7/src/ bin启动使用
启动redisnohup bin/redis-server > log.out &
启动交互客户端:bin/redis-cli
info命令查看redis的一些基本信息:
试用命令:
set命令设置值,get获取值:
详细命令参考:http://redis.io/commandsRedis配置
从redis发行包目录下拷贝一份默认的redis配置到/etc目录下:cp redis-3.0.7/redis.conf /etc/redis/
启动的时候指定配置文件:redis-server /etc/redis/redis.conf
设置密码:requirepass youpassword
配置数据保存路径:dir /opt/data/redis/
停止redis:
在客户端命令行:shutdown
使用自定义配置重启:nohup bin/redis-server /etc/redis/redis.conf >> log/redis.out & cat log/redis.out
此时使用redis-cli登录客户端之后,需要首先授权:127.0.0.1:6279> auth youpassword
在客户端调用save命令后,数据将被保存在/opt/data/redis/dump.rdb127.0.0.1:6279> save
相关文章推荐
- redis安装问题小结
- 使用 Redis 和 Python 构建一个共享单车的应用程序
- Redis偶发连接失败案例实战记录
- Redis中实现查找某个值的范围
- win 7 安装redis服务【笔记】
- redis的hGetAll函数的性能问题(记Redis那坑人的HGETALL)
- Redis和Memcached的区别详解
- 分割超大Redis数据库例子
- Redis总结笔记(一):安装和常用命令
- Redis sort 排序命令详解
- 用Redis实现微博关注关系
- Redis实现信息已读未读状态提示
- redis中修改配置文件中的端口号 密码方法
- 在Ruby on Rails上使用Redis Store的方法
- Redis和Memcache的区别总结
- 在Node.js应用中使用Redis的方法简介
- Redis服务器的启动过程分析
- web 应用中常用的各种 cache详解
- 利用yum安装Redis的方法详解
- 从MySQL到Redis的简单数据库迁移方法