Non-relational database characteristics:
- The data model is relatively simple, the key corresponds to a value, and the data is stored in memory
- Need a more flexible it system
- Relatively high database performance requirements
- No need for high data consistency
- For a given key, it is easier to map a complex environment
Redis features
It is stored in the form of key_value, which is different from traditional relational databases, and does not necessarily follow some basic requirements of traditional databases (non-relational, distributed, open source and horizontally scalable)
advantage:
- High concurrent reading and writing of data, one is memory level read and write and the other is hard disk level read and write
- Efficient storage and access to massive data
- Scalability and high availability of data
Disadvantages:
- redis (ACID processing is very simple)
- Can't do too complicated relational database
The redis key can contain String strings, hashes, list linked lists, set collections, zset ordered collections, these data collections all support push/pop, add/remove, intersection and union, and richer operations. Redis supports various Sorting in different ways, in order to ensure efficiency, the data is cached in the memory, or the updated data can be periodically written to the disk, and the modification operation can be written and appended to the file.
redis installation:
yum install -y wget gcc
systemctl stop firewalld.service
systemctl disable firewalld.service
cd /usr/local
下载redis
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
解压
tar zxvf redis-5.0.3.tar.gz
cd redis-5.0.3.tar.gz
编译
make
cd src
安装
make install
建立两个文件夹用来存放redis的命令和配置文件
mkdir -p /usr/local/redis/etc
mkdir -p /usr/local/redis/bin
把redis.conf 移动到etc下
cd /usr/local/redis/etc
cp /usr/local/redis-5.0.3/redis.conf .
把redis/src里的 mkreleasehdr.sh redis-benchmark redis-check-aof redis-cli redis-server复制到bin
启动redis
redis-server /usr/local/redis/etc/redis.conf
ctrl + c 退出redis
Background start
Modify redis.conf and find the following value no change to yes
daemonize yes
restart
redis client operation redis
keys * View data
Set value to get value
Stop redis server
/usr/local/redis/bin/redis-cli shutdown
The file where redis stores data is .rdb