简介
redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。
安装步骤
1.下载依赖
# yum -y install centos-release-scl
# yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
# scl enable devtoolset-9 bash
# echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
2.下载redis安装包
# wget https://download.redis.io/releases/redis-6.0.9.tar.gz?_ga=2.245330565.1654305974.1603887728-936199213.1603887728
3.改名
# mv mv redis-6.0.9.tar.gz?_ga=2.245330565.1654305974.1603887728-936199213.1603887728 redis
4.解压
# tar -zxvf redis
5.进入redis目录
# cd redis-6.0.9
6.编译安装
# make
# make install
7.启动Redis服务,指定Redis配置文件启动
# redis-server /redis-6.0.9/redis.conf
8710:C 02 Jan 2022 16:51:17.407 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
8710:C 02 Jan 2022 16:51:17.407 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=8710, just started
8710:C 02 Jan 2022 16:51:17.407 # Configuration loaded
8710:M 02 Jan 2022 16:51:17.408 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.0.9 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 8710
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
连接测试
# redis-cli -h localhost
localhost:6379>
若遇问题,解决方案
1.问题:linux中yum 时出现进程睡眠 解决:rm -f /var/run/yum.pid
2.问题:刚开始装yum install -y gcc-c++后执行make出现没有指明目标并且找不到 makefile 解决:可能是gcc版本过低,执行安装步骤中gcc即可
|