In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Complete solution of redis configuration file and common commands
1. Basic configuration
Whether daemonize no is started as a background process
Number of database created by databases 16 (database 0 is selected by default)
When save 9001 # refreshes the snapshot to the hard drive, both requirements must be met before it will be triggered, that is, at least 1 keyword will change after 900 seconds.
Save 30010 # must be at least 10 keywords changed after 300 seconds.
Save 60 10000 # must be at least 10000 keywords changed after 60 seconds.
Stop-writes-on-bgsave-error yes # background storage error stops writing.
Rdbcompression yes # uses LZF to compress rdb files.
Rdbchecksum yes # verifies when storing and loading rdb files.
Dbfilename dump.rdb # sets the rdb file name.
Dir. / # sets the working directory to which the rdb file is written.
two。 Master-slave configuration
Slaveof is set as a slave server for a machine
Password for masterauth to connect to the primary server
Slave-serve-stale-data yes # whether the slave server answers when the master / slave is disconnected or is in the process of replication
Slave-read-only yes # read-only from the server
Time interval between repl-ping-slave-period 10 # slave ping master (in seconds)
Repl-diskless-sync no does not use diskless synchronization by default
Repl-diskless-sync-delay 5 diskless diskless mode has a time delay before data transfer, so that the slave side can get to the destination queue to be transferred. The default time is 5 seconds.
Repl-timeout 60 # master-slave timeout (the timeout is considered to be disconnected), which is larger than period
Slave-priority 100 # if master can no longer work properly, the slave with the lowest priority value will be selected among multiple slave to be promoted to master, and a priority value of 0 means that it cannot be promoted to master.
Whether the master end of repl-disable-tcp-nodelay no # merges data or not, send large chunks to slave
Slave-priority 100Slave server priority, when the master server dies, it will automatically pick the one with the lowest slave priority as the master server`
3. Safety
Requirepass foobared # requires a password
Rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 # if you have a public environment, you can rename some sensitive commands such as config
4. Limit
Maxclients 10000 # maximum connections
Maxmemory # maximum memory usage
Maxmemory-policy volatile-lru # memory processing after reaching the limit
Volatile-lru-> LRU algorithm deletes expired key
Allkeys-lru-> LRU algorithm deletes key (does not distinguish or expire)
Volatile-random-> randomly delete expired key
Allkeys-random-> randomly delete key (indistinguishable and non-expired)
Volatile-ttl-> Delete a key that is about to expire
Noeviction-> do not delete, error message is returned
Explain that LRU ttl is an approximate algorithm, you can choose N, and then compare the data that are most suitable for T kick.
Maxmemory-samples 3
5. Log mode
Appendonly no # whether only logs are required
Appendfilename "appendonly.aof" sets the file name of the AOF record
Appendfsync no # system buffering, unified writing, high speed
Appendfsync always # system does not buffer, direct write, slow, less data loss
Appendfsync everysec # compromise, write once per second
No-appendfsync-on-rewrite no # when the main process is writing to disk, it will block other fsync calls; if yes, the data of other threads will be stored in memory and merged to write (faster and easier to lose)
Auto-AOF-rewrite-percentage 100th current aof file is overridden when the last override is large N%
At least the size of auto-AOF-rewrite-min-size 64mb aof rewriting
Whether aof-load-truncated yes loads incomplete aof files for startup
6.LUA SCRIPTING
Lua-time-limit 5000 sets the maximum run time of lua scripts in milliseconds
7. Slow query
Slowlog-log-slower-than 10000 # records slow queries with response time greater than 10000 microseconds
Slowlog-max-len 128 # record up to 128 entries
8.LATENCY MONITOR
Latency-monitor-threshold 0 delay monitoring is used to record operations that are equal to or exceed a specified time. The default is off status, that is, a value of 0.
9. Server command
Time returns timestamp + microsecond
The number of key returned by dbsize
Bgrewriteaof rewrites aof
Bgsave background starts child process dump data
Save blocking process dump data
The lastsave command returns the last time Redis successfully saved data to disk, expressed in UNIX timestamp format
Slaveof host port acts as a slave server for host port (data emptying, copying new master content)
Slaveof no one becomes the master server (the original data is not lost, which is usually used after the failure of the main server)
Flushdb clears all data in the current database * *
Flushall clears all data in all databases (what if misused?) * *
Shutdown [save/nosave] shut down the server, save data, and modify AOF (if set)
Slowlog get acquires slow query log
Slowlog len acquires the number of slow query log entries
Slowlog reset empties slow query
Info []
Config get option (supports * wildcards)
Config set option valu
Config rewrite writes values to the configuration file
Config restart updates information for the info command
Debug object key # debugging options, depending on a key
Debug segfault # impersonation segment error, causing the server to crash
Object key (refcount | encoding | idletime)
Monitor # Open the console and observe the commands (for debugging)
Client list # lists all connections
Client kill # kills a connection CLIENT KILL 127.0.0.1 43501
Client getname # get the name of the connection default nil
Client setname "name" # sets the connection name for debugging
10. Connection command
Auth password # password login (if there is a password)
Ping # Test whether the server is available
Echo "some content" # Test whether the server interacts properly
Select 0/1/2... # Select a database
Quit # exit the connection
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.