1. Whether to run subsequent processes. The default value is nodaemonizeno2. If a later process runs, you must specify a pid. The default value is varrunredis. pidpidfilevarrunredis. pid3: listening port. Default Value: 62.16port62.164. Bind Host IP address. Default Value: 127.0.0.1 (Note) bind127.0.0.15. Timeout time. Default Value: 30.
1. Whether to run the subsequent processes. The default value is no daemonize no 2. If the subsequent processes run, you must specify a pid. The default value is/var/run/redis. pid pidfile/var/run/redis. pid 3: listening port. The default value is 6379 port 6379 4. bind The Host IP address. The default value is 127.0.0.1 (Note) bind 127.0.0.1 5. the timeout value is 30 by default.
1. Whether to run the subsequent processes. The default value is no.
Daemonize no
2. If a later process runs, you must specify a pid. The default value is/var/run/redis. pid.
Pidfile/var/run/redis. pid
3. listening port. The default value is 6379.
Port 6379
4. Bind The Host IP address. The default value is 127.0.0.1 (note)
Bind 127.0.0.1
5. Timeout. The default value is 300 seconds)
Timeout 300
6. log record level, with four optional values: debug, verbose (default), notice, and warning
Loglevel verbose
7. log recording method. The default value is stdout.
Logfile stdout
8. Number of available databases. The default value is 16. The default value is 0.
Databases 16
9. indicates the time in which the data is synchronized to the data file after the number of update operations. This can be used with multiple conditions. For example, three conditions are set in the default configuration file.
At least one key is changed within 900 seconds (15 minutes ).
Save 900 1
At least 10 keys are changed in 300 seconds (5 minutes ).
Save 300 10
10. Whether to compress the data stored in the local database. The default value is yes.
Rdbcompression yes
11. Name of the local database file. The default value is dump. rdb.
Dbfilename/root/redis_db/dump. rdb
12. Local database storage path. The default value is ./
Dir/root/redis_db/
13. When the local machine is a slave service, set the IP address and port of the master service (note)
Slaveof
14. When the local machine is a slave service, set the connection password of the master service (comment)
Masterauth
15. connection password (note)
Requirepass foobared
16. Maximum number of client connections. No limit by default (note)
Maxclients 128
17. After setting the maximum memory to reach the maximum memory setting, Redis will first try to clear expired or expiring keys. After this method is processed, any of them will reach the maximum memory setting, no more write operations can be performed. (Note)
Maxmemory
18. Whether to record the log after each update operation. If it is not enabled, data may be lost for a period of time during power failure. Because redis synchronizes data files according to the save conditions above, some data will only exist in the memory for a period of time. The default value is no.
Appendonly yes
19. Update the log file name. The default value is appendonly. aof (comment)
Appendfilename/root/redis_db/appendonly. aof
20. Update log conditions. There are three optional values. "No" indicates that data is cached and synchronized to the disk by the operating system. "always" indicates that data is manually written to the disk by calling fsync () after each update operation. "everysec" indicates that data is synchronized once per second (default ).
Appendfsync everysec
21. whether to use virtual memory. The default value is no.
Vm-enabled yes
22. virtual memory file path. The default value is/tmp/redis. swap. It cannot be shared by multiple Redis instances.
Vm-swap-file/tmp/redis. swap
23. Store all data greater than vm-max-memory to the virtual memory, no matter how small the vm-max-memory settings are, all index data is stored in memory (Redis index data is keys). That is to say, when vm-max-memory is set to 0, all values are actually stored on the disk. The default value is 0.
Vm-max-memory 0
24. virtual memory files are stored in blocks, each with 32 bytes
Vm-page-size 32
25. Maximum number of virtual internal files
Vm-pages 134217728
26. You can set the number of threads used to access the swap file. It is recommended that the number of server cores not exceed the value. If it is set to 0, all operations on the swap file are serial. it may cause a long delay, but it guarantees data integrity.
Vm-max-threads 4
27. Put the small output cache together so that multiple responses can be sent to the client in a TCP packet. I am not very clear about the specific principle and actual effect. So according to the annotations, you can set it to yes if you are not sure.
Glueoutputbuf yes
28. hash data structure is introduced in redis 2.0. When the hash contains more than the specified number of elements and the maximum number of elements does not exceed the critical value, hash will be stored in a special encoding method (greatly reducing memory usage, the two thresholds can be set here.
Hash-max-zipmap-entries 64
29. Maximum value of an element in hash
Hash-max-zipmap-value 512
30. After it is enabled, redis will use a CPU time of 1 ms every 100 ms to re-hash the redis hash table, which can reduce the memory usage. When your application scenario requires strict real-time performance and you cannot accept Redis's 2 ms latency for requests from time to time, set this parameter to no. If you do not have such strict real-time requirements, you can set it to yes to release the memory as quickly as possible.
Activerehashing yes
Refer to: Redis deployment use documentation http://www.elain.org /? P = 505
========================================================== ======================
Install the Redis extension of PHP
Download the https://github.com/nicolasff/phpredis/downloads first
# Wget https://github.com/nicolasff/phpredis/downloads
# Tar-zxvf nicolasff-phpredis-2.1.3-124-gd4ad907.tar.gz
# Mv nicolasff-phpredis-d4ad907 php-5.3.8/ext/phpredis/
# Cd php-5.3.8/ext/phpredis/
#/Usr/local/php/bin/phpize
#./Configure -- with-php-config =/usr/local/php/bin/php-config
# Make & make install
Configure php. ini
Vi/usr/local/php/lib/php. ini
(Add:
Extension = redis. so
)
First, check whether there is extension_dir = /.......
Restart apache or nginx
#/Usr/local/apache2/bin/apachectl restart
Test code:
[Php]View plaincopy
-
-
- $ Redis = new Redis ();
-
- $ Redis-> connect ('2017. 0.0.1 ', 127 );
-
- $ Redis-> set ('test', 'Hello world! ');
-
- Echo $ redis-> get ('test ');
-
-
- ?>
Refer:
Linux (CentOS 5.5) Redis installation and RedisPHP extended installation Application
Http://www.linuxidc.com/Linux/2011-08/41404.htm
Install the redis and phpredis modules
Http://skandgjxa.blog.163.com/blog/static/14152982011712112933816/
Compile and install Redis and its php extension library in RHEL5
Http://hi.baidu.com/zjstandup/blog/item/9f38b825d379c96c35a80f7f.html