Redis SERVER Data Structure

Redis Server 教育
Redis Server Course
Redis 定期点検/技術支援
Redis Technical Support
Redis エンタープライズサーバ
Redis Enterprise Server

Redis SERVER Data Structure

레디스 서버 데이터 구조를 설명한다.

이 문서는 버전 3.2.2을 기준으로 만들었다.


redisServer

초기화 function: initServerConfig()

structure   redisServer

NoData TypeName설명Default
General
1pid_tpidMain process pid.
2char*configfileAbsolute config file path, or NULL
3char*executableAbsolute executable file path.
4char**exec_argvExecutable argv vector (copy).
5inthzserverCron() calls frequency in hertz.
6redisDb*db
7dict*commandsCommand table
8dict*orig_commandsCommand table before command renaming.
9aeEventLoop*el
10unsignedlruclock:LRU_BITSClock for LRU eviction
11intshutdown_asapSHUTDOWN needed ASAP
12intactiverehashingIncremental rehash in serverCron()
13char*requirepassPass for AUTH command, or NULL
14char*pidfilePID file path
15intarch_bits32 or 64 depending on sizeof(long)
16intcronloopsNumber of times the cron function run
17charrunid
[CONFIG_RUN_ID_SIZE+1]
ID always different at every exec.
18intsentinel_modeTrue if this instance is a Sentinel.
Networking
19intportTCP listening port
20inttcp_backlogTCP listen() backlog
21char*bindaddr
[CONFIG_BINDADDR_MAX]
Addresses we should bind to
22intbindaddr_countNumber of addresses in server.bindaddr[]
23char*unixsocketUNIX socket path
24mode_tunixsocketpermUNIX socket permission
25intipfd
[CONFIG_BINDADDR_MAX]
TCP socket file descriptors
26intipfd_countUsed slots in ipfd[]
27intsofdUnix socket file descriptor
28intcfd
[CONFIG_BINDADDR_MAX]
Cluster bus listening socket
29intcfd_countUsed slots in cfd[]
30list*clientsList of active clients
31list*clients_to_closeClients to close asynchronously
32list*clients_pending_writeThere is to write or install handler.
33list*slavesList of slaves
34list*monitorsList of MONITORs
35client*current_clientCurrent client, only used on crash report
36intclients_pausedTrue if clients are currently paused
37mstime_tclients_pause_end_timeTime when we undo clients_paused
38charneterr[ANET_ERR_LEN]Error buffer for anet.c
39dict*migrate_cached_socketsMIGRATE cached sockets
40uint64_tnext_client_idNext client unique ID. Incremental.
41intprotected_modeDon't accept external connections.
RDB / AOF loading information
42intloadingWe are loading data from disk if true
43off_tloading_total_bytes
44off_tloading_loaded_bytes
45time_tloading_start_time
46off_tloading_process_events
_interval_bytes
Fast pointers to often looked up command
47struct
redisCommand
*delCommand
48struct
redisCommand
*multiCommand
49struct
redisCommand
*lpushCommand
50struct
redisCommand
*lpopCommand
51struct
redisCommand
*rpopCommand
52struct
redisCommand
*sremCommand
53struct
redisCommand
*execCommand
Fields used only for stats
54time_tstat_starttimeServer start time
55long longstat_numcommandsNumber of processed commands
56long longstat_numconnectionsNumber of connections received
57long longstat_expiredkeysNumber of expired keys
58long longstat_evictedkeysNumber of evicted keys (maxmemory)
59long longstat_keyspace_hitsNumber of successful lookups of keys
60long longstat_keyspace_missesNumber of failed lookups of keys
61size_tstat_peak_memoryMax used memory record
62long longstat_fork_timeTime needed to perform latest fork()
63doublestat_fork_rateFork rate in GB/sec.
64long longstat_rejected_connClients rejected because of maxclients
65long longstat_sync_fullNumber of full resyncs with slaves.
66long longstat_sync_partial_okNumber of accepted PSYNC requests.
67long longstat_sync_partial_errNumber of unaccepted PSYNC requests.
68list*slowlogSLOWLOG list of commands
69long longslowlog_entry_idSLOWLOG current entry ID
70long longslowlog_log_slower_thanSLOWLOG time limit (to get logged)
71unsigned longslowlog_max_lenSLOWLOG max number of items logged
72size_tresident_set_sizeRSS sampled in serverCron().
73long longstat_net_input_bytesBytes read from network.
74long longstat_net_output_bytesBytes written to network.
The following two are used to track instantaneous metrics,
like number of operations per second, network traffic.
75 struct {
    long long last_sample_time; /* Timestamp of last sample in ms */
    long long last_sample_count;/* Count in last sample */
    long long samples[STATS_METRIC_SAMPLES];
    int idx;
} inst_metric[STATS_METRIC_COUNT];
Configuration
76intverbosityLoglevel in redis.conf
77intmaxidletimeClient timeout in seconds
78inttcpkeepaliveSet SO_KEEPALIVE if non-zero.
79intactive_expire_enabledCan be disabled for testing purposes.
80size_tclient_max_querybuf_lenLimit for client query buffer length
81intdbnumTotal number of configured DBs
82intsupervised1 if supervised, 0 otherwise.
83intsupervised_modeSee SUPERVISED_*
84intdaemonizeTrue if running as a daemon
85clientBufferLimitsConfigclient_obuf_limits
[CLIENT_TYPE_OBUF_COUNT]
AOF persistence
86intaof_stateAOF_(ON|OFF|WAIT_REWRITE)
87intaof_fsyncKind of fsync() policy
88char*aof_filenameName of the AOF file
89intaof_no_fsync_on_rewriteDon't fsync if a rewrite is in prog.
90intaof_rewrite_percRewrite AOF if % growth is > M and...
91off_taof_rewrite_min_sizethe AOF file is at least N bytes.
92off_taof_rewrite_base_sizeAOF size on latest startup or rewrite.
93off_taof_current_sizeAOF current size.
94intaof_rewrite_scheduledRewrite once BGSAVE terminates.
95pid_taof_child_pidPID if rewriting process
96list*aof_rewrite_buf_blocksHold changes during an AOF rewrite.
97sdsaof_bufAOF buffer, written before entering the event loop
98intaof_fdFile descriptor of currently selected AOF file
98intaof_selected_dbCurrently selected DB in AOF
100time_taof_flush
_postponed_start
UNIX time of postponed AOF flush
101time_taof_last_fsyncUNIX time of last fsync()
102time_taof_rewrite
_time_last
Time used by last AOF rewrite run.
103time_taof_rewrite
_time_start
Current AOF rewrite start time.
104intaof_lastbgrewrite
_status
C_OK or C_ERR
105unsigned longaof_delayed_fsyncdelayed AOF fsync() counter
106intaof_rewrite
_incremental_fsync
fsync incrementally while rewriting?
107intaof_last
_write_status
C_OK or C_ERR
108intaof_last
_write_errno
Valid if aof_last_write_status is ERR
109intaof_load
_truncated
Don't stop on unexpected AOF EOF.
AOF pipes used to communicate between parent and child during rewrite.
110intaof_pipe_write_data_to_child
111intaof_pipe_read_data_from_parent
112intaof_pipe_write_ack_to_parent
113intaof_pipe_read_ack_from_child
114intaof_pipe_write_ack_to_child
115intaof_pipe_read_ack_from_parent
116intaof_stop_sending_diffIf true stop sending accumulated diffs to child process.
117sdsaof_child_diffAOF diff accumulator child side.
RDB persistence
118long longdirtyChanges to DB from the last save
119long longdirty_before_bgsaveUsed to restore dirty on failed BGSAVE
120pid_trdb_child_pidPID of RDB saving child
121struct saveparam*saveparamsSave points array for RDB
122intsaveparamslenNumber of saving points
123char*rdb_filenameName of RDB file
124intrdb_compressionUse compression in RDB?
125intrdb_checksumUse RDB checksum?
126time_tlastsaveUnix time of last successful save
127time_tlastbgsave_tryUnix time of last attempted bgsave
128time_trdb_save_time_lastTime used by last RDB save run.
129time_trdb_save_time_startCurrent RDB save start time.
130intrdb_bgsave_scheduledBGSAVE when possible if true.
131intrdb_child_typeType of save by active child.
132intlastbgsave_statusC_OK or C_ERR
133intstop_writes_on
_bgsave_err
Don't allow writes if can't BGSAVE
134intrdb_pipe_write
_result_to_parent
RDB pipes used to return the state
135intrdb_pipe_read
_result_from_child
of each slave in diskless SYNC.
Propagation of commands in AOF / replication
136redisOpArrayalso_propagateAdditional command to propagate.
Logging
137char*logfilePath of log file
138intsyslog_enabledIs syslog enabled?
139char*syslog_identSyslog ident
140intsyslog_facilitySyslog facility
Replication (master)
141intslaveseldbLast SELECTed DB in replication output
142long longmaster_repl_offsetGlobal replication offset
143intrepl_ping_slave_periodMaster pings the slave every N seconds
144char*repl_backlogReplication backlog for partial syncs
145long longrepl_backlog_sizeBacklog circular buffer size
146long longrepl_backlog_histlenBacklog actual data length
147long longrepl_backlog_idxBacklog circular buffer current offset
148long longrepl_backlog_offReplication offset of first byte in the backlog buffer.
149time_trepl_backlog_time_limitTime without slaves after the backlog gets released.
150time_trepl_no_slaves_sinceWe have no slaves since that time. Only valid if server.slaves len is 0.
151intrepl_min_slaves_to_writeMin number of slaves to write.
152intrepl_min_slaves_max_lagMax lag of slaves to write.
153intrepl_good_slaves_countNumber of slaves with lag <= max_lag.
154intrepl_diskless_syncSend RDB to slaves sockets directly.
155intrepl_diskless_sync_delayDelay to start a diskless repl BGSAVE.
Replication (slave)
156char*masterauthAUTH with this password with master
157char*masterhostHostname of master
158intmasterportPort of master
159intrepl_timeoutTimeout after N seconds of master idle
160client*masterClient that is master for this slave
161client*cached_masterCached master to be reused for PSYNC.
162intrepl_syncio_timeoutTimeout for synchronous I/O calls
163intrepl_stateReplication status if the instance is a slave
164off_trepl_transfer_sizeSize of RDB to read from master during sync.
165off_trepl_transfer_readAmount of RDB read from master during sync.
166off_trepl_transfer
_last_fsync_off
Offset when we fsync-ed last time.
167intrepl_transfer_sSlave -> Master SYNC socket
168intrepl_transfer_fdSlave -> Master SYNC temp file descriptor
169char*repl_transfer_tmpfileSlave-> master SYNC temp file name
170time_trepl_transfer_lastioUnix time of the latest read, for timeout
171intrepl_serve_stale_dataServe stale data when link is down?
172intrepl_slave_roSlave is read only?
173time_trepl_down_sinceUnix time at which link with master went down
174intrepl_disable_tcp_nodelayDisable TCP_NODELAY after SYNC?
175intslave_priorityReported in INFO and used by Sentinel.
176intslave_announce_portGive the master this listening port.
177char*slave_announce_ipGive the master this ip address.
178charrepl_master_runid
[CONFIG_RUN_ID_SIZE+1]
Master run id for PSYNC.
179long longrepl_master
_initial_offset
Master PSYNC offset.
Replication script cache.
180dict*repl_scriptcache_dictSHA1 all slaves are aware of.
181list*repl_scriptcache_fifoFirst in, first out LRU eviction.
182unsigned intrepl_scriptcache_sizeMax number of elements.
Synchronous replication.
183list*clients_waiting_acksClients waiting in WAIT command.
184intget_ack_from_slavesIf true we send REPLCONF GETACK.
Limits
185unsigned intmaxclientsMax number of simultaneous clients
186unsigned long longmaxmemoryMax number of memory bytes to use
187intmaxmemory_policyPolicy for key eviction
188intmaxmemory_samplesPricision of random sampling
Blocked clients
189unsigned intbpop_blocked_clientsNumber of clients blocked by lists
190list*unblocked_clientslist of clients to unblock before next loop
191list*ready_keysList of readyList structures for BLPOP & co
Sort parameters - qsort_r() is only available under BSD so we have to take this state global, in order to pass it to sortCompare()
192intsort_desc
193intsort_alpha
194intsort_bypattern
195intsort_store
Zip structure config, see redis.conf for more information
196size_thash_max_ziplist_entries
197size_thash_max_ziplist_value
198size_tset_max_intset_entries
199size_tzset_max_ziplist_entries
200size_tzset_max_ziplist_value
201size_thll_sparse_max_bytes
List parameters
202list_max_ziplist_size
203list_compress_depth
time cache
204time_tunixtimeUnix time sampled every cron cycle.
205long longmstimeLike 'unixtime' but with milliseconds resolution.
Pubsub
206dict*pubsub_channelsMap channels to list of subscribed clients
207list*pubsub_patternsA list of pubsub_patterns
208intnotify_keyspace
_events
Events to propagate via Pub/Sub. This is an xor of NOTIFY_... flags.
Cluster
209intcluster_enabledIs cluster enabled?
210mstime_tcluster_node_timeoutCluster node timeout.
211char*cluster_configfileCluster auto-generated config file name.
212struct
clusterState
State of the cluster
213intcluster_migration
_barrier
Cluster replicas migration barrier.
214intcluster_slave
_validity_factor
Slave max data age for failover.
215intcluster_require
_full_coverage
If true, put the cluster down if there is at least an uncovered slot.
Scripting
216lua_State*luaThe Lua interpreter. We use just one for all clients
217client*lua_clientThe "fake client" to query Redis from Lua
218client*lua_callerThe client running EVAL right now, or NULL
219dict*lua_scriptsA dictionary of SHA1 -> Lua scripts
220mstime_tlua_time_limitScript timeout in milliseconds
221mstime_tlua_time_startStart time of script, milliseconds time
222intlua_write_dirtyTrue if a write command was called during the execution of the current script.
223intlua_random_dirtyTrue if a random command was called during the execution of the current script.
224intlua_replicate_commandsTrue if we are doing single commands repl.
225intlua_multi_emittedTrue if we already proagated MULTI.
226intlua_replScript replication flags for redis.set_repl().
227intlua_timedoutTrue if we reached the time limit for script execution.
228intlua_killKill the script if true.
229intlua_always_replicate_commandsDefault replication type.
Latency monitor
230long longlatency_monitor_threshold
231dict*latency_events
Assert & bug reporting
232char*assert_failed
233char*assert_file
234intassert_line
235intbug_report_startTrue if bug report header was already logged.
236intwatchdog_periodSoftware watchdog period in ms. 0 = off
System hardware info
237size_tsystem_memory_sizeTotal memory in system as reported by OS


structure   clusterLink

NoData TypeName설명Default
1mstime_tctimeLink creation time
2intfdTCP socket file descriptor
3sdssndbufPacket send buffer
4sdsrcvbufPacket reception buffer
5struct clusterNode*nodeNode related to this link if any, or NULL

<< Processes & Threads Redis.conf >>

조회수 :

Email 返事がかかってなれば、メールでお知らせします。