I. Database
1. Relational database: Mysql,sqlserver,oracle
2. Non-relational database (NoSQL): Key-value Storage Database (Redis)
List Store Database
Document-based database (MONGODB)
Graphics database
Two. Redis Overview
Redis is an open-source NoSQL database that is written in C and stores data in key-value form. Its data is stored in memory, and Redis can periodically synchronize the memory data to disk, that is, the data can be persisted . and it supports more data types than memcached . supports master-slave synchronization. (the difference from memcached)
Key value
1 {name: Zhang San, age:22} JSON
String
List lists, queues, and stacks
Set
Zset ordered Collection
Hash
Redis supports master-slave synchronization. Data can be synchronized from the primary server to any number of slave servers, from the server to the primary server that is associated with other slave servers.
Three. Redis Advantage
1. Run in memory, fast. Although the data is in memory, it can be persisted.
2. Deal with high concurrency, big data performance pressure.
The 3.redis supports multiple data types.
4.redis supports master-slave synchronization. Use Redis for caching or session sharing.
6. Support the subscription Publishing feature.
Four. Why can't redis replace a relational database?
1. Complex data structures are poorly maintained.
2. The memory is fast, but the relationship is not reflected.
3. High storage costs .
Four. Installation and use under Windows.
Java Client Hello,world
Client jar package Address Http://cloud.github.com/downloads/alphazero/jredis/jredis-1.0-rc2.jar. The version is currently a bit old and supports Redis 1.2.6. The latest version of 2.0 hasn't been release yet.
Create a new Java project in Eclipse and add the Jredis package reference. Here's a hello,world program.
Package jredisstudy;
Import org.jredis.*;
Import org.jredis.ri.alphazero.JRedisClient;
public class App {
public static Voidmain (string[] args) {
try {
Jredis Jr = New Jredisclient ("192.168.56.55", 6379); Redis service address and port number
String key = "Mkey";
Jr.set (Key, "hello,redis!");
String v = new String (Jr.get (key));
String K2 = "Count";
JR.INCR (K2);
JR.INCR (K2);
System.out.println (v);
System.out.println (NewString (Jr.get (K2)));
} catch (Exception e) {
Todo:handle exception
}
}
}
Okay, the REDIS environment is ready. The various types and types of Redis related commands and specific scenarios are written later.
Five. Installation and use under Linux.
Speed up-redis for large websites