Introduction to Redis Services && redis.conf configuration file

Source: Internet
Author: User

Introduction to #一 and Redis services

Redis a key-value storage system. Similar to memcached, it supports storing more value types (memcached does not support value types, only key), including string (string), list (linked list), set (set), and Zset (ordered collections). These data types support Push/pop, Add/remove, and intersection-set and difference sets, and richer operations, and these operations are atomic. Based on this,Redis supports sorting in a variety of different ways. As with memcached, data is cached in memory to ensure efficiency. The difference is that Redis periodically writes the updated data to disk or writes the modified operation to the appended record file, and Master-slave (Master-Slave) synchronization is implemented on this basis . So Redis can still save the user session cache in the power outage, but the session cache is lost after the memcached power outage.


Session Cache Function: Session is mainly used to store the user's login information, the user logon request, as long as the query to the session has a record, that is, to determine the logged in state, no additional login operation, if the user information is not in the session, If you want to enter a user name password to log in, log in the submitted data, you must first go to the database to match the query, if the user information is found to return the results of the database, and the corresponding user information written to the session, as the next user logon status judgment.

Primary storage Session Database: Redis, memcached (NoSQL database)


Redis&memcached comparison:

Redis writes data to disk and keeps the data in sync, so you can save the session after a power outage. But memcached, just keep the user login information in the cache, if the power outage, the session information is lost, need to new database query. It is because the data is only available for caching and does not require a master-slave synchronization with the disk to keep the data consistent, so the user's login status is very fast.

In addition, Redis supports Key,value and other types of data storage, while memcached only supports key. So Redis has more scope to apply.


Redis is a non-relational data storage tool, which differs from the traditional relational database (like MySQL, etc.), similar to Memcache, and its internal integration of the list (linked list), set (set) operations, can be very convenient and fast processing of data (like inserting, deleting the list intersection and set difference sets, which greatly reduces the pressure on the underlying database and gives the user faster response times.


#二,/etc/redis.conf configuration file

daemonize          whether the next process runs, the default is nopidfile             If the next process runs, you need to specify a PID, which defaults to/var/run/redis.pidbind                bind host IP, default value is 127.0.0.1 (note) port                listening port, default is 6379timeout             Timeout, default is 300 (seconds) loglevel           logging level, with 4 selectable values, Debug,verbose (default),notice,warninglogfile            logging mode, the default value is stdoutdatabases          number of available databases, The default value is 16, and the default database is 0save <seconds> <changes>                     points out how many times the update operation will synchronize the data to the data file. This can be a combination of multiple conditions, such as the default configuration file settings, set three conditions. save At least 1 keys in 900 1        900 seconds (15 minutes) are changed save 300 10  At least 300 keys in       300 seconds (5 minutes) are changed save 60 10000     At least 10,000 keys in  60 seconds are changed rdbcompression      whether the data is compressed when stored to the local database, the default is yesdbfilename           Local database file name, default value is dump.rdbdir                  Local Database storage path, default value is  ./slaveof <masterip > <masterport>                      set the IP and port (note) of the main service when this machine is from service masterauth <master-password>                       Set the connection password (note) for the Master service when this machine is from service requirepass         Connection password (note) Maxclients          Maximum number of client connections, no Limit by default (note) maxmemory <bytes>                      set the maximum memory to the maximum memory setting, Redis will first attempt to clear expired or expiring keys, and when this method is processed, it will no longer be able to write until it reaches the maximum memory setting. (note) Whether appendonly          is logged after each update operation and, if not turned on, may result in data loss over a period of time when power is lost. Because the Redis itself synchronizes data files in sync with the save conditions above, some data will only exist in memory for a period of time. The default value is noappendfilename      update log file name, default is appendonly.aof (note) appendfsync          Update log conditions, a total of 3 optional values.                          no indicates that the operating system is synchronizing data cache to disk,                          Always represents a manual call to Fsync () to write data to disk after each update operation,               &The nbsp;         everysec represents a synchronization once per second (the default value). vm-enabled         whether to use virtual memory, the default value is novm-swap-file        virtual memory file path, default value is/tmp/redis.swap, cannot be shared by multiple Redis instances vm-max-memory      All data larger than Vm-max-memory is stored in virtual memory, regardless of how small the vm-max-memory is, all index data is in memory (Redis index data   is keys), which means When Vm-max-memory is set to 0, all value is actually present on the disk. The default value is 0.


Introduction to Redis Services && redis.conf configuration file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.