I. Introduction to REDIS:
NOSQL and no only SQL, is high concurrency, large data exists, different from relational database. Owned: Non-relational, distributed, open source, can be horizontally expanded.
Redis is a key-value storage system. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), Zset (sorted set-ordered collection), and hash (hash type). 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.
Second, the application of Redis scenarios:
1. High concurrency for data read and write.
2. Efficient storage and access to massive amounts of data.
3. High scalability and high availability for massive amounts.
Third, the development of applications for Redis:
1. Take the latest n data operation.
2. Leaderboard app, get top n operations
3. Applications that need to set the expiration time accurately
4. Counter Application
5. Unique operation, get all data in a certain period of time the value of the row
6. Real-time system, anti-spam system
7. Pub/sub building a real-time messaging system
8. Build a queue system
9. Cache data
Iv. deployment of Redis in Ubuntu
Downloads for related redis: Http://redis.io/download
Deployment
Download compilation: Wget http://download.redis.io/releases/redis-2.8.19.tar.gz
Tar xzvf redis-2.8.19.tar.gz
CD redis-2.8.19
Make
installation, enter the SRC installation of redis-2.8.19:
CD src
sudo make install
Under/usr/local, create the Redis/bin (hold executable file) directory and redis/etc (store config file):
sudo mkdir-p/usr/local/redis/bin
sudo mkdir-p/usr/local/redis/etc
Move the redis.conf under the redis-2.8.19 to the/USR/LOCAL/REDIS/ETC directory:
sudo mv./redis.conf/usr/local/redis/etc/
Move all green executable commands under SRC to the/usr/local/redis/bin/directory:
sudo mv mkreleasehdr.sh redis-cli redis-benchmark redis-check-aof redis-check-dump redis-server redis-sentinel/usr/ local/redis/bin/
Start Redis
Cd/usr/local/redis/bin
Redis-server/usr/local/redis/etc/redis.conf
Close Reids
Pkill redis-server or Kill-pid (Redis's process ID)
Client-side shutdown
/USR/LOCAL/REDIS/BIN/REDIS-CLI shutdown
See if Redis starts
1 PS-EF | grep Redis
2 NETSTAT-TUNPL | grep 6379
3 Connecting/USR/LOCAL/REDIS/BIN/REDIS-CLI with Client
The opening effect is as follows:
V. Configuration of Redis
Daemonize If you need to run in the background, set Yes
Pidfile Configure multiple PID addresses, default in Var/run/redis.pid
Bind bind IP, set only to accept requests from IP
Port Listening ports default 6379
Timeout setting time-out for client connections in seconds
LogLevel Log level has 4 levels, debug verbose notice warning
LogFile Configuring the log file address
Databases set the number of databases, the default is to use a database of 0, altogether 16 from 0-15
Save sets how often Redis makes database mirroring
Rdbcompression whether to compress during a mirrored backup
Dbfilename image backup File placement path
Slaveof setting a database as a database for another database
Masterauth The authentication password required for the primary database link
Requirepass setting the password required for login
MaxClients setting the number of simultaneous clients connected
MaxMemory set the maximum memory that Redis can use
AppendOnly Open Append Only mode
NoSQL database Redis's deployment using in Ubuntu