随笔分类 -  redis/memcached/mongodb

上一页 1 2 3 下一页
学习、实践和分析原理
Redis双机热备方案--转
摘要:http://luyx30.blog.51cto.com/1029851/1350832参考资料:http://patrick-tang.blogspot.com/2012/06/redis-keepalived-failover-system.htmlhttp://deidara.blog.51cto.com/400447/302402http://my.oschina.net/guol/blog/182491http://shiguanghui.iteye.com/blog/2001499背景目前,Redis集群的官方方案还处在开发测试中,未集成到稳定版中。且目前官方开发中的Redis C 阅读全文
posted @ 2014-01-18 14:57 一天不进步,就是退步 阅读(16651) 评论(0) 推荐(0)
Redis数据持久化机制AOF原理分析一---转
摘要:http://blog.csdn.net/acceptedxukai/article/details/18136903http://blog.csdn.net/acceptedxukai/article/details/18181563本文所引用的源码全部来自Redis2.8.2版本。Redis AOF数据持久化机制的实现相关代码是redis.c, redis.h, aof.c, bio.c, rio.c, config.c在阅读本文之前请先阅读Redis数据持久化机制AOF原理分析之配置详解文章,了解AOF相关参数的解析,文章链接http://blog.csdn.net/acceptedxu 阅读全文
posted @ 2014-01-15 17:07 一天不进步,就是退步 阅读(3007) 评论(0) 推荐(0)
深入redis内部--初始化服务器
摘要:初始化服务器代码如下:void initServer() { int j; signal(SIGHUP, SIG_IGN); signal(SIGPIPE, SIG_IGN); setupSignalHandlers(); if (server.syslog_enabled) { openlog(server.syslog_ident, LOG_PID | LOG_NDELAY | LOG_NOWAIT, server.syslog_facility); } server.current_client = NULL... 阅读全文
posted @ 2014-01-14 22:44 一天不进步,就是退步 阅读(22252) 评论(0) 推荐(0)
深入redis内部---网络编程
摘要:Redis在anet.h和anet.c中封装了底层套接字实现:1.anetTcpServer,建立网络套接字服务器,完成对socket(),bind(),listen()等操作的封装,返回socket的fd。int anetTcpServer(char *err, int port, char *bindaddr){ int s; struct sockaddr_in sa; //见1.1结构体 if ((s = anetCreateSocket(err,AF_INET)) == ANET_ERR) ... 阅读全文
posted @ 2014-01-12 21:01 一天不进步,就是退步 阅读(1923) 评论(0) 推荐(0)
深入redis内部--事件处理机制
摘要:1. redis事件的定义/* State of an event based program */typedef struct aeEventLoop { int maxfd; /* highest file descriptor currently registered */ int setsize; /* max number of file descriptors tracked */ long long timeEventNextId; /*下一个定时器的id*/ time_t lastTime; /* Used to detect system ... 阅读全文
posted @ 2014-01-05 22:34 一天不进步,就是退步 阅读(611) 评论(0) 推荐(0)
redis虚拟内存---官方文档
摘要:http://redis.io/topics/internals-vmVirtual Memory technical specificationThis document details the internals of the Redis Virtual Memory subsystem. The intended audience is not the final user but programmers willing to understand or modify the Virtual Memory implementation.Keys vs Values: what is sw 阅读全文
posted @ 2014-01-04 22:49 一天不进步,就是退步 阅读(1194) 评论(0) 推荐(0)
深入redis内部--内存管理
摘要:1. Redis内存管理通过在zmalloc.h和zmalloc.c中重写c语言对内存的管理来完成的。 redis内存管理c内存管理原型作用zmallocmallocvoid *malloc(unsigned int num_bytes);分配一块指定大小的内存区域,并返回指向该区域头部的指针,分配失败则返回NULLzcalloccallocvoid *calloc(unsigned n, unsigned size);在内存的动态存储区中分配n个长度为size的连续空间,函数返回一个指向分配起始地址的指针;如果分配不成功,返回NULL。zreallocreallocoid *reall... 阅读全文
posted @ 2014-01-04 22:29 一天不进步,就是退步 阅读(7663) 评论(0) 推荐(0)
深入redis内部--字典实现
摘要:redis的字典定义和实现在dict.h和dict.c文件中。1.字典结构typedef struct dict {dictType *type; //定义了字典需要的函数void *privdata;dictht ht[2]; //哈希表结构int rehashidx; //下一个需要扩容的字典编号,若rehashidx == -1 则不会进行重新散列。int iterators; //当前正在运行的迭代器数目} dict;其中涉及到数据结构,如下所示:1.1 字典类型,包含了一系列字典所需要用到的函数typedef struct dictType {unsigned int (*... 阅读全文
posted @ 2013-12-20 09:10 一天不进步,就是退步 阅读(3005) 评论(0) 推荐(0)
深入redis内部--实现字符串
摘要:redis字符串的定义和实现在Ssd.h和Ssd.c中。1.定义typedef char *sds; //本质是字符char的指针2.字符串的操作sds sdsnew(const char *init) { size_t initlen = (init == NULL) ? 0 : strlen(init); return sdsnewlen(init, initlen);}调用sdsnewlen,看一下该函数的实现sds sdsnewlen(const void *init, size_t initlen) { struct sdshdr *sh; if (init) { sh = zmal 阅读全文
posted @ 2013-12-18 22:33 一天不进步,就是退步 阅读(1679) 评论(0) 推荐(0)
深入redis内部--实现双向链表
摘要:数据结构的应用--Adlist.h定义1.节点结构typedef struct listNode { struct listNode *prev; //前向节点 struct listNode *next; //后向节点 void *value; //该节点的值} listNode;2.双向链表结构typedef struct list { listNode *head; //头节点 listNode *tail; //尾节点 void *(*dup)(void *ptr); //复制函数 void (*free)(void *ptr); //释放函数 int (*match)(void *p 阅读全文
posted @ 2013-12-17 22:04 一天不进步,就是退步 阅读(2354) 评论(0) 推荐(0)
Linux环境进程间通信(二): 信号--转载
摘要:http://www.ibm.com/developerworks/cn/linux/l-ipc/part2/index1.htmlhttp://www.ibm.com/developerworks/cn/linux/l-ipc/part2/index2.html一、信号及信号来源信号本质信号是在软件层次上对中断机制的一种模拟,在原理上,一个进程收到一个信号与处理器收到一个中断请求可以说是一样的。信号是异步的,一个进程不必通过任何操作来等待信号的到达,事实上,进程也不知道信号到底什么时候到达。信号是进程间通信机制中唯一的异步通信机制,可以看作是异步通知,通知接收信号的进程有哪些事情发生了。信号 阅读全文
posted @ 2013-12-04 23:54 一天不进步,就是退步 阅读(326) 评论(0) 推荐(0)
Redis: under the hood---转载
摘要:http://pauladamsmith.com/articles/redis-under-the-hood.html#redis-under-the-hoodHow does theRedisserver work?I was curious to learn more about Redis’s internals, so I’ve been familiarizing myself with the source, largely by reading and jumping around in Emacs. After I had peeled back enough of the o 阅读全文
posted @ 2013-12-01 22:36 一天不进步,就是退步 阅读(633) 评论(0) 推荐(0)
redis 大数据插入
摘要:http://redis.io/topics/mass-inserthttp://blog.nosqlfan.com/html/3537.html 阅读全文
posted @ 2013-11-29 18:06 一天不进步,就是退步 阅读(433) 评论(0) 推荐(0)
redis High Availability---Redis Sentinel翻译
摘要:注意,本文档为最新(11月21日),旧版本的可以参考:http://redis.io/topics/sentinel-old不鼓励使用旧版本的文档。Redis Sentinel是一个用来管理Redis服务器的系统,它主要工作有三种:1. 监控。Sentinel一直检测主从redis服务器是否正常工作。2. 通知。当一个被监控的redis服务器出错时,Sentinel可以通过api来通知系统管理员或者别的系统。3. 自动灾备。当主redis实例不能正常工作时,Sentinel会启动一个灾备进程,从而使一个从redis实例设置为主redis服务器,别的从Redis服务器设置为新的主redis的从服 阅读全文
posted @ 2013-11-29 17:27 一天不进步,就是退步 阅读(983) 评论(0) 推荐(0)
Redis debugging guide---官方
摘要:Redis debugging guideRedis is developed with a great stress on stability: we do our best with every release to make sure you'll experience a very stable product and no crashes. However even with our best efforts it is impossible to avoid all the critical bugs with 100% of success.When Redis cras 阅读全文
posted @ 2013-11-29 09:10 一天不进步,就是退步 阅读(855) 评论(0) 推荐(0)
Redis运行流程源码解析--转载
摘要:http://blog.nosqlfan.com/html/4007.htmlhttp://www.searchdatabase.com.cn/showcontent_62166.htm导读:本文分析源码基于Redis 2.4.7 stable版本,对Redis运行流程,命令处理的内部实现进行了深入讲解。关键词:Redis源码运行流程框架 概述 Redis通过定义一个 struct redisServer 类型的全局变量server 来保存服务器的相关信息(比如:配置信息,统计信息,服务器状态等等)。启动时通过读取配置文件里边的信息对server进行初始化(如果没有指定配置文 件,将使用默.. 阅读全文
posted @ 2013-11-27 18:26 一天不进步,就是退步 阅读(794) 评论(0) 推荐(0)
redis学习资料
摘要:1. 官方网站:http://redis.io/2. 深入分析redis-from-the-ground-up:http://blog.mjrusso.com/2010/10/17/redis-from-the-ground-up.htmlRedis: under the hoodhttp://pauladamsmith.com/articles/redis-under-the-hood.htmlredis cookbook:http://www.rediscookbook.org/redis tutorial:http://simonwillison.net/static/2010/redi 阅读全文
posted @ 2013-11-03 21:51 一天不进步,就是退步 阅读(355) 评论(0) 推荐(0)
Redis configuration
摘要:官方2.6配置如下:# Redis configuration file example# Note on units: when memory size is needed, it is possible to specify# it in the usual form of 1k 5GB 4M and so forth:## 1k => 1000 bytes# 1kb => 1024 bytes# 1m => 1000000 bytes# 1mb => 1024*1024 bytes# 1g => 1000000000 bytes# 1gb => 102 阅读全文
posted @ 2013-10-29 23:29 一天不进步,就是退步 阅读(2058) 评论(0) 推荐(0)
Redis持久化实践及灾难恢复模拟
摘要:Redis持久化实践及灾难恢复模拟源地址:http://heylinux.com/archives/1932.html另一篇:Redis主从自动failoverhttp://ylw6006.blog.51cto.com/470441/1086455/参考资料:Redis Persistence http://redis.io/topics/persistenceGoogle Groups https://groups.google.com/forum/?fromgroups=#!forum/redis-db一、对Redis持久化的探讨与理解目前Redis持久化的方式有两种: RDB 和 AOF 阅读全文
posted @ 2013-10-19 22:51 一天不进步,就是退步 阅读(512) 评论(0) 推荐(0)
centos mongodb安装及简单实例
摘要:1.创建目录并设置写权限的操作如下:$mkdir -p /data/db(创建目录和必要的父目录,若父目录不存在则先创建父目录再创建子目录)$ chown -R $usergroup:$user /data/db2. 下载gz文件并解压 $tar zxvf mongodb-linux-i686-xx... 阅读全文
posted @ 2013-10-01 08:19 一天不进步,就是退步 阅读(324) 评论(0) 推荐(0)

上一页 1 2 3 下一页