redis的简介和简单安装
来源:互联网 发布:投资知乎 编辑:程序博客网 时间:2024/05/20 13:05
redis简介
redis使用场景
在新浪微博Redis的部署场景很多,大概分为如下两种:
1应用程序直接访问redis服务器。
2 应用程序直接先访问redis,只有当redis访问失败时才会去访问MySQL。
redis集群和mysql集群是同步的
redis的安装
下载,解压,编译:
redis中文网下载
$ wget http://download.redis.io/releases/redis-3.0.6.tar.gz $ tar xzf redis-3.0.6.tar.gz $ cd redis-3.0.6 $ make $ wget http://download.redis.io/releases/redis-3.0.6.tar.gz $ tar xzf redis-3.0.6.tar.gz $ cd redis-3.0.6 $ make
二进制文件是编译完成后在src目录下. 运行如下:
$ src/redis-server
例如:
root@ubuntu:/home/ysy/redis-3.2.3# src/redis-server7790:C 24 Sep 11:40:22.443 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf7790:M 24 Sep 11:40:22.444 * Increased maximum number of open files to 10032 (it was originally set to 1024).7790:M 24 Sep 11:40:22.446 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now. _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.2.3 (00000000/0) 32 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 7790 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 7790:M 24 Sep 11:40:22.489 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.7790:M 24 Sep 11:40:22.490 # Server started, Redis version 3.2.37790:M 24 Sep 11:40:22.490 # 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.7790:M 24 Sep 11:40:22.490 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.7790:M 24 Sep 11:40:22.490 * DB loaded from disk: 0.000 seconds7790:M 24 Sep 11:40:22.490 * The server is now ready to accept connections on port 6379
此时无法进行其他操作,会占用窗口
如果需要后台启动,则需要将redis.conf中的daemonize 改为yes,并且启动时指明配置文件,例如:
root@ubuntu:/home/ysy/redis-3.2.3# src/redis-server redis.conf root@ubuntu:/home/ysy/redis-3.2.3#
查看有没有启动成功
root@ubuntu:/home/ysy/redis-3.2.3# ps -ef | grep redisroot 5251 1 0 10:38 ? 00:00:02 src/redis-server 127.0.0.1:6379root 6317 5023 0 10:57 pts/1 00:00:00 grep --color=auto redis
查看6379端口
root@ubuntu:/home/ysy/redis-3.2.3# netstat -tunpl | grep 6379tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 5251/redis-server 1
如何关闭redis服务
root@ubuntu:/home/ysy/redis-3.2.3# pkill redis-server
或者
root@ubuntu:/home/ysy/redis-3.2.3# src/redis-cli 127.0.0.1:6379> shutdownnot connected> quit
redis的配置
2 0
- redis的简介和简单安装
- Redis简介和安装
- Redis 简介和安装
- redis简介安装简单使用
- Redis简介和简单应用
- Redis简介和简单应用
- 【Redis安装】redis简介和安装
- redis的安装和简单的使用
- redis入门简单的安装和测试
- Redis的安装和简单使用
- Redis简介、安装和使用说明
- Redis简介、安装和使用说明
- (1)Redis简介与简单安装
- Linux下redis的安装和配置简介
- Redis简介和Linux环境下的安装
- redis的简介和安装笔记(1)
- Redis的简介及安装
- redis安装和简单例子
- Lisp programming style and coding efficiency
- 数据结构之矩阵的乘法运算
- 项目09-23
- 问题记录一:有关使用函数崩溃问题
- 学习笔记之String源码
- redis的简介和简单安装
- Flex 布局教程:语法篇
- OC-手势&变形&坐标系bounds、frame、center
- 向Eclipse 中导入WorkSpace已有Android项目
- 微信小程序把玩(一)Hello WeApp
- SVN主干发布与分支发布的区别
- 每个程序员必看:如何在40岁后继续做软件开发?
- LeetCode141—Linked List Cycle
- VS2013 QT可以编译通过但是头文件有红线