您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 鄂州分类信息网,免费分类信息发布

Redis启动流程分析

2024/3/17 6:23:51发布16次查看
涉及的组件 redis是基于c语言的,每个c文件对应一个模块,可以认为是一个组件。根据对其源代码的分析可以得出,在redis服务启动的时候涉及到以下几个组件模块和方法。 启动时序图 在redis.c的main函数,主要做三件事情: 1)加载配置包括从命令行或者传入配
涉及的组件redis是基于c语言的,每个c文件对应一个模块,可以认为是一个组件。根据对其源代码的分析可以得出,在redis服务启动的时候涉及到以下几个组件模块和方法。
启动时序图
在redis.c的main函数,主要做三件事情:
1)加载配置包括从命令行或者传入配置文件加载;
2)启动unix和tcp的监听,客户端的列表保存在redisserver的clients中;
3)启动ae事件。
启动完成,ae会定时间去查询各个客户端是否有输入,如果有读取客户端输入并且对命令进行解析。
对命令的解析主要是基于redisserver的rediscommandtable (redis.c)进行,从这个结构体可以看出redis所有的命令列表以及对应的处理函数。
struct rediscommand rediscommandtable[] = { {get,getcommand,2,r,0,null,1,1,1,0,0}, {set,setcommand,-3,wm,0,nopreloadgetkeys,1,1,1,0,0}, {setnx,setnxcommand,3,wm,0,nopreloadgetkeys,1,1,1,0,0}, {setex,setexcommand,4,wm,0,nopreloadgetkeys,1,1,1,0,0}, {psetex,psetexcommand,4,wm,0,nopreloadgetkeys,1,1,1,0,0}, {append,appendcommand,3,wm,0,null,1,1,1,0,0}, {strlen,strlencommand,2,r,0,null,1,1,1,0,0}, {del,delcommand,-2,w,0,nopreloadgetkeys,1,-1,1,0,0}, {exists,existscommand,2,r,0,null,1,1,1,0,0}, {setbit,setbitcommand,4,wm,0,null,1,1,1,0,0}, {getbit,getbitcommand,3,r,0,null,1,1,1,0,0}, {setrange,setrangecommand,4,wm,0,null,1,1,1,0,0}, {getrange,getrangecommand,4,r,0,null,1,1,1,0,0}, {substr,getrangecommand,4,r,0,null,1,1,1,0,0}, {incr,incrcommand,2,wm,0,null,1,1,1,0,0}, {decr,decrcommand,2,wm,0,null,1,1,1,0,0}, {mget,mgetcommand,-2,r,0,null,1,-1,1,0,0}, {rpush,rpushcommand,-3,wm,0,null,1,1,1,0,0}, {lpush,lpushcommand,-3,wm,0,null,1,1,1,0,0}, {rpushx,rpushxcommand,3,wm,0,null,1,1,1,0,0}, {lpushx,lpushxcommand,3,wm,0,null,1,1,1,0,0}, {linsert,linsertcommand,5,wm,0,null,1,1,1,0,0}, {rpop,rpopcommand,2,w,0,null,1,1,1,0,0}, {lpop,lpopcommand,2,w,0,null,1,1,1,0,0}, {brpop,brpopcommand,-3,ws,0,null,1,1,1,0,0}, {brpoplpush,brpoplpushcommand,4,wms,0,null,1,2,1,0,0}, {blpop,blpopcommand,-3,ws,0,null,1,-2,1,0,0}, {llen,llencommand,2,r,0,null,1,1,1,0,0}, {lindex,lindexcommand,3,r,0,null,1,1,1,0,0}, {lset,lsetcommand,4,wm,0,null,1,1,1,0,0}, {lrange,lrangecommand,4,r,0,null,1,1,1,0,0}, {ltrim,ltrimcommand,4,w,0,null,1,1,1,0,0}, {lrem,lremcommand,4,w,0,null,1,1,1,0,0}, {rpoplpush,rpoplpushcommand,3,wm,0,null,1,2,1,0,0}, {sadd,saddcommand,-3,wm,0,null,1,1,1,0,0}, {srem,sremcommand,-3,w,0,null,1,1,1,0,0}, {smove,smovecommand,4,w,0,null,1,2,1,0,0}, {sismember,sismembercommand,3,r,0,null,1,1,1,0,0}, {scard,scardcommand,2,r,0,null,1,1,1,0,0}, {spop,spopcommand,2,wrs,0,null,1,1,1,0,0}, {srandmember,srandmembercommand,-2,rr,0,null,1,1,1,0,0}, {sinter,sintercommand,-2,rs,0,null,1,-1,1,0,0}, {sinterstore,sinterstorecommand,-3,wm,0,null,1,-1,1,0,0}, {sunion,sunioncommand,-2,rs,0,null,1,-1,1,0,0}, {sunionstore,sunionstorecommand,-3,wm,0,null,1,-1,1,0,0}, {sdiff,sdiffcommand,-2,rs,0,null,1,-1,1,0,0}, {sdiffstore,sdiffstorecommand,-3,wm,0,null,1,-1,1,0,0}, {smembers,sintercommand,2,rs,0,null,1,1,1,0,0}, {zadd,zaddcommand,-4,wm,0,null,1,1,1,0,0}, {zincrby,zincrbycommand,4,wm,0,null,1,1,1,0,0}, {zrem,zremcommand,-3,w,0,null,1,1,1,0,0}, {zremrangebyscore,zremrangebyscorecommand,4,w,0,null,1,1,1,0,0}, {zremrangebyrank,zremrangebyrankcommand,4,w,0,null,1,1,1,0,0}, {zunionstore,zunionstorecommand,-4,wm,0,zunionintergetkeys,0,0,0,0,0}, {zinterstore,zinterstorecommand,-4,wm,0,zunionintergetkeys,0,0,0,0,0}, {zrange,zrangecommand,-4,r,0,null,1,1,1,0,0}, {zrangebyscore,zrangebyscorecommand,-4,r,0,null,1,1,1,0,0}, {zrevrangebyscore,zrevrangebyscorecommand,-4,r,0,null,1,1,1,0,0}, {zcount,zcountcommand,4,r,0,null,1,1,1,0,0}, {zrevrange,zrevrangecommand,-4,r,0,null,1,1,1,0,0}, {zcard,zcardcommand,2,r,0,null,1,1,1,0,0}, {zscore,zscorecommand,3,r,0,null,1,1,1,0,0}, {zrank,zrankcommand,3,r,0,null,1,1,1,0,0}, {zrevrank,zrevrankcommand,3,r,0,null,1,1,1,0,0}, {hset,hsetcommand,4,wm,0,null,1,1,1,0,0}, {hsetnx,hsetnxcommand,4,wm,0,null,1,1,1,0,0}, {hget,hgetcommand,3,r,0,null,1,1,1,0,0}, {hmset,hmsetcommand,-4,wm,0,null,1,1,1,0,0}, {hmget,hmgetcommand,-3,r,0,null,1,1,1,0,0}, {hincrby,hincrbycommand,4,wm,0,null,1,1,1,0,0}, {hincrbyfloat,hincrbyfloatcommand,4,wm,0,null,1,1,1,0,0}, {hdel,hdelcommand,-3,w,0,null,1,1,1,0,0}, {hlen,hlencommand,2,r,0,null,1,1,1,0,0}, {hkeys,hkeyscommand,2,rs,0,null,1,1,1,0,0}, {hvals,hvalscommand,2,rs,0,null,1,1,1,0,0}, {hgetall,hgetallcommand,2,r,0,null,1,1,1,0,0}, {hexists,hexistscommand,3,r,0,null,1,1,1,0,0}, {incrby,incrbycommand,3,wm,0,null,1,1,1,0,0}, {decrby,decrbycommand,3,wm,0,null,1,1,1,0,0}, {incrbyfloat,incrbyfloatcommand,3,wm,0,null,1,1,1,0,0}, {getset,getsetcommand,3,wm,0,null,1,1,1,0,0}, {mset,msetcommand,-3,wm,0,null,1,-1,2,0,0}, {msetnx,msetnxcommand,-3,wm,0,null,1,-1,2,0,0}, {randomkey,randomkeycommand,1,rr,0,null,0,0,0,0,0}, {select,selectcommand,2,rl,0,null,0,0,0,0,0}, {move,movecommand,3,w,0,null,1,1,1,0,0}, {rename,renamecommand,3,w,0,renamegetkeys,1,2,1,0,0}, {renamenx,renamenxcommand,3,w,0,renamegetkeys,1,2,1,0,0}, {expire,expirecommand,3,w,0,null,1,1,1,0,0}, {expireat,expireatcommand,3,w,0,null,1,1,1,0,0}, {pexpire,pexpirecommand,3,w,0,null,1,1,1,0,0}, {pexpireat,pexpireatcommand,3,w,0,null,1,1,1,0,0}, {keys,keyscommand,2,rs,0,null,0,0,0,0,0}, {dbsize,dbsizecommand,1,r,0,null,0,0,0,0,0}, {auth,authcommand,2,rsl,0,null,0,0,0,0,0}, {ping,pingcommand,1,r,0,null,0,0,0,0,0}, {echo,echocommand,2,r,0,null,0,0,0,0,0}, {save,savecommand,1,ars,0,null,0,0,0,0,0}, {bgsave,bgsavecommand,1,ar,0,null,0,0,0,0,0}, {bgrewriteaof,bgrewriteaofcommand,1,ar,0,null,0,0,0,0,0}, {shutdown,shutdowncommand,-1,ar,0,null,0,0,0,0,0}, {lastsave,lastsavecommand,1,rr,0,null,0,0,0,0,0}, {type,typecommand,2,r,0,null,1,1,1,0,0}, {multi,multicommand,1,rs,0,null,0,0,0,0,0}, {exec,execcommand,1,sm,0,null,0,0,0,0,0}, {discard,discardcommand,1,rs,0,null,0,0,0,0,0}, {sync,synccommand,1,ars,0,null,0,0,0,0,0}, {replconf,replconfcommand,-1,ars,0,null,0,0,0,0,0}, {flushdb,flushdbcommand,1,w,0,null,0,0,0,0,0}, {flushall,flushallcommand,1,w,0,null,0,0,0,0,0}, {sort,sortcommand,-2,wm,0,null,1,1,1,0,0}, {info,infocommand,-1,rlt,0,null,0,0,0,0,0}, {monitor,monitorcommand,1,ars,0,null,0,0,0,0,0}, {ttl,ttlcommand,2,r,0,null,1,1,1,0,0}, {pttl,pttlcommand,2,r,0,null,1,1,1,0,0}, {persist,persistcommand,2,w,0,null,1,1,1,0,0}, {slaveof,slaveofcommand,3,ast,0,null,0,0,0,0,0}, {debug,debugcommand,-2,as,0,null,0,0,0,0,0}, {config,configcommand,-2,ar,0,null,0,0,0,0,0}, {subscribe,subscribecommand,-2,rpslt,0,null,0,0,0,0,0}, {unsubscribe,unsubscribecommand,-1,rpslt,0,null,0,0,0,0,0}, {psubscribe,psubscribecommand,-2,rpslt,0,null,0,0,0,0,0}, {punsubscribe,punsubscribecommand,-1,rpslt,0,null,0,0,0,0,0}, {publish,publishcommand,3,pfltr,0,null,0,0,0,0,0}, {watch,watchcommand,-2,rs,0,nopreloadgetkeys,1,-1,1,0,0}, {unwatch,unwatchcommand,1,rs,0,null,0,0,0,0,0}, {restore,restorecommand,4,awm,0,null,1,1,1,0,0}, {migrate,migratecommand,6,aw,0,null,0,0,0,0,0}, {dump,dumpcommand,2,ar,0,null,1,1,1,0,0}, {object,objectcommand,-2,r,0,null,2,2,2,0,0}, {client,clientcommand,-2,ar,0,null,0,0,0,0,0}, {eval,evalcommand,-3,s,0,zunionintergetkeys,0,0,0,0,0}, {evalsha,evalshacommand,-3,s,0,zunionintergetkeys,0,0,0,0,0}, {slowlog,slowlogcommand,-2,r,0,null,0,0,0,0,0}, {script,scriptcommand,-2,ras,0,null,0,0,0,0,0}, {time,timecommand,1,rr,0,null,0,0,0,0,0}, {bitop,bitopcommand,-4,wm,0,null,2,-1,1,0,0}, {bitcount,bitcountcommand,-2,r,0,null,1,1,1,0,0}};
鄂州分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录