Redis数据库基础
非关系型数据库产生的背景
随着技术不断发展,数据量海量的增加
对数据库高并发的读写要求越来越高
对海量数据高效存储与访问的需求
对数据库高可扩展性与高可用性的需求
优点
Redis等非关系型数据库产生了
Redis是基于内存运行并支持持久化,采用key-value(键值对)的存储形式
其优点如下
具有极高的数据读写速度
支持丰富的数据类型
支持数据的持久化
数据的原子性
支持数据备份
Redis的安装部署
安装程序
[root@localhost ~]# tar -zxvf redis-5.0.7.tar.gz -C /opt
[root@localhost ~]# cd /opt/redis-5.0.7/
[root@localhost redis-5.0.7]# yum -y install gcc gcc-c++
[root@localhost redis-5.0.7]# make
[root@localhost redis-5.0.7]# make install
[root@localhost redis-5.0.7]# cd utils/
[root@localhost utils]# ./install_server.sh #配置默认回车即可
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6379 #端口号
Config file : /etc/redis/6379.conf #配置文件
Log file : /var/log/redis_6379.log #日志文件
Data dir : /var/lib/redis/6379 #数据存放目录
Executable : /usr/local/bin/redis-server #可执行文件路径
Cli Executable : /usr/local/