Linux Redis performance show

We can connect via redis redis-cli, for example: redis-cli -h 127.0.0.1 -p 6379 connected redis, and look at some of the information redis by INFO. INFO we can see some information, such as viewing the redis memory usage: info memory, view the current connections redis client: redis client. 
Which I found a good blog: View http://www.cnblogs.com/mushroom/p/4738170.html#three



redis.conf configuration items as follows: 1. Redis default is not running in daemon mode, you can the configuration item changes, the use of yes to enable daemon daemonize NO 2. when Redis when running in daemon mode, the default Redis will write /var/run/redis.pid pid file, you can specify pidfile pidfile / var / run / redis.pid 3. Redis specified listening port, the default port is 6379, the author explains why the choice of 6379 as the default port number 6379 on the phone because the keys corresponding MERZ in his blog post, but MERZ from Italian showgirl Alessia Merz name Port 6379 4. host address binding the bind 127.0.0.1 5. the connection is closed when the client is idle time period after which, if specified as zero disables this function timeout 300 6. specify logging level, the Redis supports a total of four level: debug, verbose, notice, warning , the default is verbose the LogLevel verbose 7. logging mode, the default is standard output, if configured to run as a daemon Redis way, but here again configured to standard output log, the log will be sent to / dev / null logfile stdout number 8. set the database, the default database is 0, may be used SELECT <dbid> specified database command on the connection ID databases 16 . 9. Specifies how long, how many times the refresh operation, the data will be synchronized to the data file, a plurality of conditions can be fit Save <seconds the> <Changes> the Redis default profile provided three conditions: Save 900. 1 Save 300 10 save 60 10000 respectively have a change within 900 seconds (15 minutes) and 300 seconds (5 minutes) 10 10 000 as well as to change the change within 60 seconds. 10. Specify whether to store compressed data to a local database, the default is yes, Redis using LZF compression, if the CPU in order to save time, you can turn this option off, but will cause the database files become huge rdbcompression yes 11. specify the local database file name, The default value dump.rdb dbfilename dump.rdb 12. The local database storage directory specified ./ the dir 18. A logging specify whether after each update operation, Redis default asynchronous data is written to disk, If you do not turn, may result in data over a period of time when power is lost. Because redis itself to synchronize data file is based on the above criteria to save synchronized, so some data will exist only in the memory for some time. The default is no 13. when the unit is provided slav service, the service master set of IP address and port, at Redis starts, it will automatically be synchronized from the master data slaveof <masterip> <masterport> 14. A master when the service is password-protected, connected to the master service password Slav masterauth <-master password> 15. A connector provided Redis password, if the password is configured connection, the client needs in connection Redis provided by AUTH <password> command password, the default closed requirepass foobared 16. the same time set the maximum number of client connections, unlimited default, the maximum number of file descriptors number of client connections can be opened at the same time as Redis Redis process can be opened, if set maxclients 0, an unlimited amount. When the number of client connections reaches the limit, the new connection is closed Redis returned to the client max number of clients reached error MaxClients 128 17. A Redis specified maximum memory limit, when the boot loader will Redis data into memory, to achieve after the maximum memory, Redis will first try to clear Key has expired or about to expire, when this method worked, still reach the maximum memory setting, can no longer write operations, but can still read operations. Redis vm new mechanism will be stored memory Key, Value will be stored in the swap area maxmemory <bytes> appendOnly NO 19. The update log file name specified, the default is appendonly.aof appendFileName appendonly.aof 20. The update log specified conditions, a total of 3 selectable values: no: represents operating systems such as synchronizing data cache to disk (fast) Always: indicate each update manually call fsync after operation () writes data to disk (slow, safe) everysec: indicate synchronization once per second (a compromise, the default value ) appendfsync everysec 21. the Specifies whether to enable virtual memory mechanism, default is no, a brief look, VM data paging mechanism will be stored by the visit of less Redis page that is cold swap data to disk, access to multiple pages wrap out by the disk into memory (I will carefully analyze the Redis VM mechanism in a later article) vm-Enabled NO 22. the virtual memory file path, default is /tmp/redis.swap, not more than Redis instances share vm File-/tmp/redis.swap -swap 23. a data is greater than all vm-max-memory stored in virtual memory, vm-max-memory no matter how small is provided, all the index data index data are stored in memory (of the Redis that is, keys), that is, when vm-max-memory is set to 0, the fact is that all value are present in the disk. The default value is 0 VM-Memory-max 0 24. A lot of the Redis the swap file into the page, a plurality of objects may be stored in the top page, but a page can not be shared by multiple objects, vm-page-size is to be set according to the size of the stored data given, the authors suggest that if storage is much smaller objects, page size is preferably set to 32 or 64bytes; if the storage lot large objects, you can use a larger page, if in doubt, use the default value vm-page-size 32 25. Set the number of page swap file, since the page table (or a representation of the free page bitmap) is placed in the memory on the disk ,, every eight pages 1byte will consume memory. 134217728-Pages and the vm 26. The set number of threads access the swap file, it is best not to exceed the number of core machine, if set to 0, then all operations on the swap file is serial, it may cause relatively long delays. The default value. 4 VM-max. 4-Threads 27. A disposed upon a response to the client, whether the smaller packets into one packet transmission is enabled by default glueoutputbuf yes designated 28. In the maximum or exceeds a number of elements than when a critical value, using a special hash algorithm the hash entries It-max-64-zipmap the hash-value max-512-zipmap 29. a hash Specifies whether to activate the reset, it is enabled by default (described later in the Redis Ha This section describes the specific algorithm Greek) activerehashing yes 30. the other contains the specified configuration file, you can use the same configuration files between multiple Redis instances on the same host, while each instance has its own specific profile the include /path/to/local.conf

 

View or set the configuration items through the CONFIG command

Example:

127.0.0.1:6379> config GET the LogLevel 
1) "the LogLevel" 2) "Notice" use * Get all configuration items



127.0.0.1:6379> config get *


redis.conf configuration items as follows: 
1. Redis default is not run as a daemon, you can use yes daemon is enabled by modifying the configuration items 
    daemonize NO 
2. When Redis when running in daemon mode, Redis will default pid write /var/run/redis.pid file can be specified by the PidFile 
    the PidFile /var/run/redis.pid 
3. Redis listen port specified, the default port is 6379, the author explains in his blog post Why choose 6379 as the default port number 6379 on the phone because the keys corresponding to MERZ, Italy and from MERZ Alessia Merz singer name 
    port 6379 
4. host address binding 
    the bind 127.0.0.1 
5. the client when the connection is idle before closing If specified as zero disables this function 
    timeout 300 
6. the logging level specified, the Redis supports a total of four levels: debug, verbose, notice, warning , the default is verbose 
    LogLevel verbose 
7. the logging mode, default to standard output, If you configure Redis to run in daemon mode, but here again configured for logging to standard output, the log will be sent To / dev / null 
    logfile stdout 
number 8. Set the database, the default database is 0, may be used SELECT <dbid> specified database command on the connection ID 
    Databases 16 
9. The specified how long, how many times the refresh operation, the data will be synchronized to the data file, with a plurality of conditions can 
    save <seconds> <changes>
    Redis default profile provided three conditions: 
    Save 900. 1 
    Save 300 10 
    Save 10000 60 
    respectively have a change within 900 seconds (15 minutes) and 300 seconds (five minutes) and has 10 changes within 60 seconds 10000 change. 
 
10. Specify whether to store compressed data to a local database, the default is yes, Redis using LZF compression, if the CPU in order to save time, you can turn this option off, but will cause the database files become huge 
    rdbcompression yes 
11. specify the local database file name, the default value dump.rdb 
    dbfilename dump.rdb 
12. the local database storage directory specified 
    the dir ./ 
13. when the unit is provided slav service, the service master set of IP address and port, when starting the Redis, it automatically from the master data synchronization 
    slaveof <masterip> <masterport> 
14. a master when the service is password-protected, the service connection Slav master password 
    masterauth <-master password>  
15. a connector provided Redis password, if the password is configured connection, the client is connected a password is required by AUTH <password> Redis commands, the default closed 
    requirepass foobared
16. a the same time set the maximum number of client connections, default unlimited, can be the Redis At the same time open client connections maximum number of file number Redis process can be opened, if set maxclients 0, an unlimited amount. When the number of clients connected to the limit is reached, Redis closes a new connection back to the client max number of clients reached error
    128 MaxClients 
17. The maximum memory limit specified Redis, Redis data will be loaded at startup into memory, after the maximum memory, Redis will first try to clear Key has expired or about to expire, when this method worked, still arrive the maximum memory settings, will no longer be able to write to, but you can still read operations. Vm Redis new mechanism will Key storage memory, Value will be stored in the swap area 
    MaxMemory <bytes> 
18. A logging specify whether after each update operation, Redis default asynchronous data is written to disk, If you do not turn, may result in data over a period of time when power is lost. Because redis itself to synchronize data file is based on the above criteria to save synchronized, so some data will exist only in the memory for some time. The default is NO 
    appendOnly NO 
19. The update log file name specified, the default is appendonly.aof 
     appendFileName appendonly.aof 
20. The update log specified conditions, there are three possible values: 
    NO: represents operating systems such as synchronizing data cache to disk (fast )  
    Always: indicates that the call after each update manually fsync () writes data to disk (slow, safe) 
    everysec: indicate synchronization once per second (a compromise, the default value)
    appendfsync everysec 
 
21. the Specifies whether to enable virtual memory mechanism, default is no, a brief look, VM data paging mechanism will be stored by the visit of less Redis page that is cold swap data to disk, access to multiple pages wrap out by the disk into memory (in a later article I will carefully analyze the Redis VM mechanism) 
     vm-Enabled NO 
22. the virtual memory file path, default is /tmp/redis.swap, not multiple instances share Redis 
     vm-swap-File /tmp/redis.swap 
23. the data is greater than all vm-max-memory is stored virtual memory, regardless vm-max-memory settings how small, all index data is stored in memory (Redis index data is keys), that is, when vm-max-memory is set to 0, when in fact all value They are present in the disk. The default value is 0 
     VM-Memory-max 0 
24. A lot of the Redis the swap file into the page, a plurality of objects may be stored in the top page, but a page can not be shared by multiple objects, vm-page-size according to the size of the stored data set, the authors suggest that if storage is much smaller objects, page size is preferably set to 32 or 64bytes; if the storage lot large objects, you can use a larger page, if in doubt, use the default value 
     vm size-32 -page 
25. a set number of page swap file, since the page table (or a representation of the free page bitmap) is placed in the memory on the disk ,, every eight pages consumes memory 1byte . 
     134217728-Pages and the vm 
26. The set number of threads access the swap file, it is best not to exceed the number of core machine, if set to 0, then all operations on the swap file is serial, it may cause relatively long delays. The default value is 4
     Threads. 4-max-VM 
27. A disposed upon a response to the client, whether the smaller packets into one packet transmission is enabled by default 
    glueoutputbuf Yes 
28. A specifies the maximum amount or more than a certain element exceeds a critical value when, using a special hash algorithm 
    the hash entries It-max-64-zipmap 
    the hash-value max-512-zipmap 
29. a hash Specifies whether to activate the reset, the default is turned on (hereinafter, particularly when the hashing algorithm described Redis introduction)
    yes activerehashing 
30. The other contains the specified configuration file, you can use the same configuration files between multiple Redis instances on the same host, while each instance has its own specific profile 
    include /path/to/local.conf
Copy the code

You can modify the configuration file by modifying redis.conf or use the command config set

127.0.0.1:6379> config set loglevel 'notice'
OK

How to stop / start / restart services redis

The following content from: http: //outofmemory.cn/code-snippet/37597/how-to-stop-start-restart-redis-server

If it is used apt-getor yum installinstalled redis, stop / start / restart command directly following redis

/etc/init.d/redis-server stop /etc/init.d/redis-server start /etc/init.d/redis-server restart

If the source is through the installation of redis, you can program the redis client redis-cli's shutdownto restart the redis command

redis-cli -h 127.0.0.1 -p 6379 shutdown

If these options are not successful stop redis, you can use the ultimate weapon kill -9                         

https://www.cnblogs.com/mushroom/p/4738170.html#three

Guess you like

Origin www.cnblogs.com/zhuyeshen/p/10950312.html