server_data_structure
Redis SERVER Data Structure
Redis Server Course | Redis Technical Support | Redis Enterprise Server |
---|
Redis SERVER Data Structure
레디스 서버 데이터 구조를 설명한다.
이 문서는 버전 3.2.2을 기준으로 만들었다.
redisServer
초기화 function: initServerConfig()
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
General | ||||
1 | pid_t | pid | Main process pid. | |
2 | char | *configfile | Absolute config file path, or NULL | |
3 | char | *executable | Absolute executable file path. | |
4 | char | **exec_argv | Executable argv vector (copy). | |
5 | int | hz | serverCron() calls frequency in hertz. | |
6 | redisDb | *db | ||
7 | dict | *commands | Command table | |
8 | dict | *orig_commands | Command table before command renaming. | |
9 | aeEventLoop | *el | ||
10 | unsigned | lruclock:LRU_BITS | Clock for LRU eviction | |
11 | int | shutdown_asap | SHUTDOWN needed ASAP | |
12 | int | activerehashing | Incremental rehash in serverCron() | |
13 | char | *requirepass | Pass for AUTH command, or NULL | |
14 | char | *pidfile | PID file path | |
15 | int | arch_bits | 32 or 64 depending on sizeof(long) | |
16 | int | cronloops | Number of times the cron function run | |
17 | char | runid [CONFIG_RUN_ID_SIZE+1] | ID always different at every exec. | |
18 | int | sentinel_mode | True if this instance is a Sentinel. | |
Networking | ||||
19 | int | port | TCP listening port | |
20 | int | tcp_backlog | TCP listen() backlog | |
21 | char | *bindaddr [CONFIG_BINDADDR_MAX] | Addresses we should bind to | |
22 | int | bindaddr_count | Number of addresses in server.bindaddr[] | |
23 | char | *unixsocket | UNIX socket path | |
24 | mode_t | unixsocketperm | UNIX socket permission | |
25 | int | ipfd [CONFIG_BINDADDR_MAX] | TCP socket file descriptors | |
26 | int | ipfd_count | Used slots in ipfd[] | |
27 | int | sofd | Unix socket file descriptor | |
28 | int | cfd [CONFIG_BINDADDR_MAX] | Cluster bus listening socket | |
29 | int | cfd_count | Used slots in cfd[] | |
30 | list | *clients | List of active clients | |
31 | list | *clients_to_close | Clients to close asynchronously | |
32 | list | *clients_pending_write | There is to write or install handler. | |
33 | list | *slaves | List of slaves | |
34 | list | *monitors | List of MONITORs | |
35 | client | *current_client | Current client, only used on crash report | |
36 | int | clients_paused | True if clients are currently paused | |
37 | mstime_t | clients_pause_end_time | Time when we undo clients_paused | |
38 | char | neterr[ANET_ERR_LEN] | Error buffer for anet.c | |
39 | dict | *migrate_cached_sockets | MIGRATE cached sockets | |
40 | uint64_t | next_client_id | Next client unique ID. Incremental. | |
41 | int | protected_mode | Don't accept external connections. | |
RDB / AOF loading information | ||||
42 | int | loading | We are loading data from disk if true | |
43 | off_t | loading_total_bytes | ||
44 | off_t | loading_loaded_bytes | ||
45 | time_t | loading_start_time | ||
46 | off_t | loading_process_events _interval_bytes | ||
Fast pointers to often looked up command | ||||
47 | struct redisCommand | *delCommand | ||
48 | struct redisCommand | *multiCommand | ||
49 | struct redisCommand | *lpushCommand | ||
50 | struct redisCommand | *lpopCommand | ||
51 | struct redisCommand | *rpopCommand | ||
52 | struct redisCommand | *sremCommand | ||
53 | struct redisCommand | *execCommand | ||
Fields used only for stats | ||||
54 | time_t | stat_starttime | Server start time | |
55 | long long | stat_numcommands | Number of processed commands | |
56 | long long | stat_numconnections | Number of connections received | |
57 | long long | stat_expiredkeys | Number of expired keys | |
58 | long long | stat_evictedkeys | Number of evicted keys (maxmemory) | |
59 | long long | stat_keyspace_hits | Number of successful lookups of keys | |
60 | long long | stat_keyspace_misses | Number of failed lookups of keys | |
61 | size_t | stat_peak_memory | Max used memory record | |
62 | long long | stat_fork_time | Time needed to perform latest fork() | |
63 | double | stat_fork_rate | Fork rate in GB/sec. | |
64 | long long | stat_rejected_conn | Clients rejected because of maxclients | |
65 | long long | stat_sync_full | Number of full resyncs with slaves. | |
66 | long long | stat_sync_partial_ok | Number of accepted PSYNC requests. | |
67 | long long | stat_sync_partial_err | Number of unaccepted PSYNC requests. | |
68 | list | *slowlog | SLOWLOG list of commands | |
69 | long long | slowlog_entry_id | SLOWLOG current entry ID | |
70 | long long | slowlog_log_slower_than | SLOWLOG time limit (to get logged) | |
71 | unsigned long | slowlog_max_len | SLOWLOG max number of items logged | |
72 | size_t | resident_set_size | RSS sampled in serverCron(). | |
73 | long long | stat_net_input_bytes | Bytes read from network. | |
74 | long long | stat_net_output_bytes | Bytes 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 | ||||
76 | int | verbosity | Loglevel in redis.conf | |
77 | int | maxidletime | Client timeout in seconds | |
78 | int | tcpkeepalive | Set SO_KEEPALIVE if non-zero. | |
79 | int | active_expire_enabled | Can be disabled for testing purposes. | |
80 | size_t | client_max_querybuf_len | Limit for client query buffer length | |
81 | int | dbnum | Total number of configured DBs | |
82 | int | supervised | 1 if supervised, 0 otherwise. | |
83 | int | supervised_mode | See SUPERVISED_* | |
84 | int | daemonize | True if running as a daemon | |
85 | clientBufferLimitsConfig | client_obuf_limits [CLIENT_TYPE_OBUF_COUNT] | ||
AOF persistence | ||||
86 | int | aof_state | AOF_(ON|OFF|WAIT_REWRITE) | |
87 | int | aof_fsync | Kind of fsync() policy | |
88 | char | *aof_filename | Name of the AOF file | |
89 | int | aof_no_fsync_on_rewrite | Don't fsync if a rewrite is in prog. | |
90 | int | aof_rewrite_perc | Rewrite AOF if % growth is > M and... | |
91 | off_t | aof_rewrite_min_size | the AOF file is at least N bytes. | |
92 | off_t | aof_rewrite_base_size | AOF size on latest startup or rewrite. | |
93 | off_t | aof_current_size | AOF current size. | |
94 | int | aof_rewrite_scheduled | Rewrite once BGSAVE terminates. | |
95 | pid_t | aof_child_pid | PID if rewriting process | |
96 | list | *aof_rewrite_buf_blocks | Hold changes during an AOF rewrite. | |
97 | sds | aof_buf | AOF buffer, written before entering the event loop | |
98 | int | aof_fd | File descriptor of currently selected AOF file | |
98 | int | aof_selected_db | Currently selected DB in AOF | |
100 | time_t | aof_flush _postponed_start | UNIX time of postponed AOF flush | |
101 | time_t | aof_last_fsync | UNIX time of last fsync() | |
102 | time_t | aof_rewrite _time_last | Time used by last AOF rewrite run. | |
103 | time_t | aof_rewrite _time_start | Current AOF rewrite start time. | |
104 | int | aof_lastbgrewrite _status | C_OK or C_ERR | |
105 | unsigned long | aof_delayed_fsync | delayed AOF fsync() counter | |
106 | int | aof_rewrite _incremental_fsync | fsync incrementally while rewriting? | |
107 | int | aof_last _write_status | C_OK or C_ERR | |
108 | int | aof_last _write_errno | Valid if aof_last_write_status is ERR | |
109 | int | aof_load _truncated | Don't stop on unexpected AOF EOF. | |
AOF pipes used to communicate between parent and child during rewrite. | ||||
110 | int | aof_pipe_write_data_to_child | ||
111 | int | aof_pipe_read_data_from_parent | ||
112 | int | aof_pipe_write_ack_to_parent | ||
113 | int | aof_pipe_read_ack_from_child | ||
114 | int | aof_pipe_write_ack_to_child | ||
115 | int | aof_pipe_read_ack_from_parent | ||
116 | int | aof_stop_sending_diff | If true stop sending accumulated diffs to child process. | |
117 | sds | aof_child_diff | AOF diff accumulator child side. | |
RDB persistence | ||||
118 | long long | dirty | Changes to DB from the last save | |
119 | long long | dirty_before_bgsave | Used to restore dirty on failed BGSAVE | |
120 | pid_t | rdb_child_pid | PID of RDB saving child | |
121 | struct saveparam | *saveparams | Save points array for RDB | |
122 | int | saveparamslen | Number of saving points | |
123 | char | *rdb_filename | Name of RDB file | |
124 | int | rdb_compression | Use compression in RDB? | |
125 | int | rdb_checksum | Use RDB checksum? | |
126 | time_t | lastsave | Unix time of last successful save | |
127 | time_t | lastbgsave_try | Unix time of last attempted bgsave | |
128 | time_t | rdb_save_time_last | Time used by last RDB save run. | |
129 | time_t | rdb_save_time_start | Current RDB save start time. | |
130 | int | rdb_bgsave_scheduled | BGSAVE when possible if true. | |
131 | int | rdb_child_type | Type of save by active child. | |
132 | int | lastbgsave_status | C_OK or C_ERR | |
133 | int | stop_writes_on _bgsave_err | Don't allow writes if can't BGSAVE | |
134 | int | rdb_pipe_write _result_to_parent | RDB pipes used to return the state | |
135 | int | rdb_pipe_read _result_from_child | of each slave in diskless SYNC. | |
Propagation of commands in AOF / replication | ||||
136 | redisOpArray | also_propagate | Additional command to propagate. | |
Logging | ||||
137 | char | *logfile | Path of log file | |
138 | int | syslog_enabled | Is syslog enabled? | |
139 | char | *syslog_ident | Syslog ident | |
140 | int | syslog_facility | Syslog facility | |
Replication (master) | ||||
141 | int | slaveseldb | Last SELECTed DB in replication output | |
142 | long long | master_repl_offset | Global replication offset | |
143 | int | repl_ping_slave_period | Master pings the slave every N seconds | |
144 | char | *repl_backlog | Replication backlog for partial syncs | |
145 | long long | repl_backlog_size | Backlog circular buffer size | |
146 | long long | repl_backlog_histlen | Backlog actual data length | |
147 | long long | repl_backlog_idx | Backlog circular buffer current offset | |
148 | long long | repl_backlog_off | Replication offset of first byte in the backlog buffer. | |
149 | time_t | repl_backlog_time_limit | Time without slaves after the backlog gets released. | |
150 | time_t | repl_no_slaves_since | We have no slaves since that time. Only valid if server.slaves len is 0. | |
151 | int | repl_min_slaves_to_write | Min number of slaves to write. | |
152 | int | repl_min_slaves_max_lag | Max lag of | |
153 | int | repl_good_slaves_count | Number of slaves with lag <= max_lag. | |
154 | int | repl_diskless_sync | Send RDB to slaves sockets directly. | |
155 | int | repl_diskless_sync_delay | Delay to start a diskless repl BGSAVE. | |
Replication (slave) | ||||
156 | char | *masterauth | AUTH with this password with master | |
157 | char | *masterhost | Hostname of master | |
158 | int | masterport | Port of master | |
159 | int | repl_timeout | Timeout after N seconds of master idle | |
160 | client | *master | Client that is master for this slave | |
161 | client | *cached_master | Cached master to be reused for PSYNC. | |
162 | int | repl_syncio_timeout | Timeout for synchronous I/O calls | |
163 | int | repl_state | Replication status if the instance is a slave | |
164 | off_t | repl_transfer_size | Size of RDB to read from master during sync. | |
165 | off_t | repl_transfer_read | Amount of RDB read from master during sync. | |
166 | off_t | repl_transfer _last_fsync_off | Offset when we fsync-ed last time. | |
167 | int | repl_transfer_s | Slave -> Master SYNC socket | |
168 | int | repl_transfer_fd | Slave -> Master SYNC temp file descriptor | |
169 | char | *repl_transfer_tmpfile | Slave-> master SYNC temp file name | |
170 | time_t | repl_transfer_lastio | Unix time of the latest read, for timeout | |
171 | int | repl_serve_stale_data | Serve stale data when link is down? | |
172 | int | repl_slave_ro | Slave is read only? | |
173 | time_t | repl_down_since | Unix time at which link with master went down | |
174 | int | repl_disable_tcp_nodelay | Disable TCP_NODELAY after SYNC? | |
175 | int | slave_priority | Reported in INFO and used by Sentinel. | |
176 | int | slave_announce_port | Give the master this listening port. | |
177 | char | *slave_announce_ip | Give the master this ip address. | |
178 | char | repl_master_runid [CONFIG_RUN_ID_SIZE+1] | Master run id for PSYNC. | |
179 | long long | repl_master _initial_offset | Master PSYNC offset. | |
Replication script cache. | ||||
180 | dict | *repl_scriptcache_dict | SHA1 all slaves are aware of. | |
181 | list | *repl_scriptcache_fifo | First in, first out LRU eviction. | |
182 | unsigned int | repl_scriptcache_size | Max number of elements. | |
Synchronous replication. | ||||
183 | list | *clients_waiting_acks | Clients waiting in WAIT command. | |
184 | int | get_ack_from_slaves | If true we send REPLCONF GETACK. | |
Limits | ||||
185 | unsigned int | maxclients | Max number of simultaneous clients | |
186 | unsigned long long | maxmemory | Max number of memory bytes to use | |
187 | int | maxmemory_policy | Policy for key eviction | |
188 | int | maxmemory_samples | Pricision of random sampling | |
Blocked clients | ||||
189 | unsigned int | bpop_blocked_clients | Number of clients blocked by lists | |
190 | list | *unblocked_clients | list of clients to unblock before next loop | |
191 | list | *ready_keys | List 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() | ||||
192 | int | sort_desc | ||
193 | int | sort_alpha | ||
194 | int | sort_bypattern | ||
195 | int | sort_store | ||
Zip structure config, see redis.conf for more information | ||||
196 | size_t | hash_max_ziplist_entries | ||
197 | size_t | hash_max_ziplist_value | ||
198 | size_t | set_max_intset_entries | ||
199 | size_t | zset_max_ziplist_entries | ||
200 | size_t | zset_max_ziplist_value | ||
201 | size_t | hll_sparse_max_bytes | ||
List parameters | ||||
202 | list_max_ziplist_size | |||
203 | list_compress_depth | |||
time cache | ||||
204 | time_t | unixtime | Unix time sampled every cron cycle. | |
205 | long long | mstime | Like 'unixtime' but with milliseconds resolution. | |
Pubsub | ||||
206 | dict | *pubsub_channels | Map channels to list of subscribed clients | |
207 | list | *pubsub_patterns | A list of pubsub_patterns | |
208 | int | notify_keyspace _events | Events to propagate via Pub/Sub. This is an xor of NOTIFY_... flags. | |
Cluster | ||||
209 | int | cluster_enabled | Is cluster enabled? | |
210 | mstime_t | cluster_node_timeout | Cluster node timeout. | |
211 | char | *cluster_configfile | Cluster auto-generated config file name. | |
212 | struct clusterState | State of the cluster | ||
213 | int | cluster_migration _barrier | Cluster replicas migration barrier. | |
214 | int | cluster_slave _validity_factor | Slave max data age for failover. | |
215 | int | cluster_require _full_coverage | If true, put the cluster down if there is at least an uncovered slot. | |
Scripting | ||||
216 | lua_State | *lua | The Lua interpreter. We use just one for all clients | |
217 | client | *lua_client | The "fake client" to query Redis from Lua | |
218 | client | *lua_caller | The client running EVAL right now, or NULL | |
219 | dict | *lua_scripts | A dictionary of SHA1 -> Lua scripts | |
220 | mstime_t | lua_time_limit | Script timeout in milliseconds | |
221 | mstime_t | lua_time_start | Start time of script, milliseconds time | |
222 | int | lua_write_dirty | True if a write command was called during the execution of the current script. | |
223 | int | lua_random_dirty | True if a random command was called during the execution of the current script. | |
224 | int | lua_replicate_commands | True if we are doing single commands repl. | |
225 | int | lua_multi_emitted | True if we already proagated MULTI. | |
226 | int | lua_repl | Script replication flags for redis.set_repl(). | |
227 | int | lua_timedout | True if we reached the time limit for script execution. | |
228 | int | lua_kill | Kill the script if true. | |
229 | int | lua_always_replicate_commands | Default replication type. | |
Latency monitor | ||||
230 | long long | latency_monitor_threshold | ||
231 | dict | *latency_events | ||
Assert & bug reporting | ||||
232 | char | *assert_failed | ||
233 | char | *assert_file | ||
234 | int | assert_line | ||
235 | int | bug_report_start | True if bug report header was already logged. | |
236 | int | watchdog_period | Software watchdog period in ms. 0 = off | |
System hardware info | ||||
237 | size_t | system_memory_size | Total memory in system as reported by OS |
No | Data Type | Name | 설명 | Default |
---|---|---|---|---|
1 | mstime_t | ctime | Link creation time | |
2 | int | fd | TCP socket file descriptor | |
3 | sds | sndbuf | Packet send buffer | |
4 | sds | rcvbuf | Packet reception buffer | |
5 | struct clusterNode | *node | Node related to this link if any, or NULL |
<< Processes & Threads | Redis.conf >> |
---|
조회수 :
Email
답글이 올라오면 이메일로 알려드리겠습니다.