Catalog
One .nosql database
1. Trends in website development
2.NOSQL database
Two .redis An introduction to the
3、 … and redis Basic operation of
5、 … and .redis Basic operation
1. Information addition
2. Information Service
3.help Use
One .nosql database
1. Trends in website development
The trend of website development Massive users and high concurrency
Relational database Performance bottlenecks exist : disk io Poor performance , Data relationships are complex , Expandability of , Not conducive to large-scale clusters .
Related solutions : Lower the disk io Number of reads and writes , 1. Data is in memory ,2 Do not store data relationships , Store only data
2.NOSQL database
NOSQL:not-onlySql( Non relational database ) As a supplement to relational databases
effect : Deal with the premise of massive users and massive data
features : Telescopic , Expandable
High performance with large amount of data
Flexible data model
High availability
frequently-used nosql database :
redis memcache hbase mongpDB
Two .redis An introduction to the
Concept :Redis (REmote DIctionary Server) Remote dictionary server Yes, it is c High performance key value pairs for language development (key-value) database
features :1. There is no necessary correlation between data
2. Internal use single thread mechanism to work
3. High performance
Official test data :5 Individual concurrent execution 100000 Requests , The speed of reading is zero 110000 Time / second (11 Million times per second )
4. Multiple data types support
String type string
List the type list
Hash type hash
Collection types set
Ordered set type sorted-set
5. Persistence supports data disaster recovery
application :
1. Accelerate queries for hot data ( Main scene ), Hot goods such as , hot news , Hot news , Promotion class and other high traffic information
2. Task queue : Such as second kill and rush purchase , Queuing up for tickets, etc
3. Instant messaging : Ranking List , All kinds of website visit statistics , Arrival bus information , Number of people online ( The chat room ), Equipment signals, etc
4. Time effective information control : Captcha control , Voting control, etc
5. Distributed information sharing : Such as in the distributed cluster architecture session Separate , Message queue , Distributed lock
3、 … and redis Basic operation of
redis-server.exe Server start command
redis-cli.exe Command line – client
redis.conf redis Core profile
redis-benchmark.exe Performance testing tools
redis-check-aof.exe aof File repair tool
redis-check-dump.exe RDB File checking tool
Example :redis Installation (2020 year 1103 edition )
Problems need to be corrected dns The configuration file
vim /etc/resolv.conf
Download successful
Unzip the file
Enter file , perform make command
There’s another problem :
The reason for this :
centos7 default gcc Version is
redis The new version needs to be upgraded gcc
Upgrade to gcc 9.3:
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
It should be noted that scl Command activation is only temporary , sign out shell Or restart will restore the original system gcc edition .
If you want to use it for a long time gcc 9.3 Words :
echo “source /opt/rh/devtoolset-9/enable” >>/etc/profile
Exit like this shell Reopening is a new version of gcc 了 The same is true of the other versions below , modify devtoolset Version number is enough
Updated completely
again make, Wait for success , Get into src Folder
Start the program
Start client
If the remote client cannot access , You can set the password through the client
5、 … and .redis Basic operation
1. Information addition
function : Set up key-value data
command set key value
Example
2. Information Service
function : according to key Query corresponding value, If it doesn’t exist , Return empty (nil)
command : get key
Example :
3.help Use
help Command name
help @ Group name
summary Function description
since Version appears
group Group