1. Redis RPM包下载
RPM包下载地址:https://pkgs.org/
Redis下载地址:https://pkgs.org/download/redis
在上述Redis下载地址中,选择CentOS6下的redis-3.0.7-4.el6.art.x86_64.rpm包连接,进入其下载页面
redis-3.0.7.4下载页面:https://centos.pkgs.org/6/atomic-x86_64/redis-3.0.7-4.el6.art.x86_64.rpm.html
在该页面找到Download标题,右键蓝色部分,选择"复制链接地址",即3.7.0.4的下载地址链接,见下图:
redis-3.0.7.4下载地址/链接:http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/redis-3.0.7-4.el6.art.x86_64.rpm
在linux服务器上通过wget命令来下载RPM包
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/redis-3.0.7-4.el6.art.x86_64.rpm
[root@localhost tools]# wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/redis-3.0.7-4.el6.art.x86_64.rpm
--2019-12-15 18:49:42-- http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/redis-3.0.7-4.el6.art.x86_64.rpm
Resolving www6.atomicorp.com... 46.105.102.32
Connecting to www6.atomicorp.com|46.105.102.32|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 439556 (429K) [application/x-rpm]
Saving to: “redis-3.0.7-4.el6.art.x86_64.rpm”
100%[=================================================================================================================================>] 439,556 3.63K/s in 1m 58s
2019-12-15 18:51:41 (3.65 KB/s) - “redis-3.0.7-4.el6.art.x86_64.rpm” saved [439556/439556]
[root@localhost tools]# ll | grep redis
-rw-r--r--. 1 root root 439556 May 18 2016 redis-3.0.7-4.el6.art.x86_64.rpm
[root@localhost tools]#
如上,成功下载redis-3.0.7-4.el6.art.x86_64.rpm
注:linux上需要提前安装wget命令;若未安装,亦可通过直接在个人PC浏览器访问该下载链接进行下载,然后上传至linux服务器
2. Redis RPM包安装
通过rpm命令进行RPM包安装
rpm -ivh redis-3.0.7-4.el6.art.x86_64.rpm
[root@localhost tools]# rpm -ivh redis-3.0.7-4.el6.art.x86_64.rpm
warning: redis-3.0.7-4.el6.art.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 4520afa9: NOKEY
error: Failed dependencies:
libjemalloc.so.1()(64bit) is needed by redis-3.0.7-4.el6.art.x86_64
[root@localhost tools]#
如上,因为redis安装依赖jemalloc库,因此需要提前通过以下方法进行jemalloc库的安装
起初想通过yum来安装jemalloc库,结果在解决各类报错问题之后依旧无法成功安装jemalloc库;
最终还是放弃了yum的安装方式,直接到https://pkgs.org/搜索了jemalloc的rpm包来下载安装
尝试yum安装的过程见链接:安装jemalloc库的心酸过程
jemalloc包下载链接:http://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/j/jemalloc-3.6.0-1.el6.x86_64.rpm
在linux服务器上通过wget下载jemalloc包
[root@localhost tools]# wget http://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/j/jemalloc-3.6.0-1.el6.x86_64.rpm
--2019-12-15 19:58:51-- http://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/j/jemalloc-3.6.0-1.el6.x86_64.rpm
Resolving download-ib01.fedoraproject.org... 152.19.134.145, 2610:28:3090:3001:dead:beef:cafe:fed6
Connecting to download-ib01.fedoraproject.org|152.19.134.145|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 102624 (100K) [application/x-rpm]
Saving to: “jemalloc-3.6.0-1.el6.x86_64.rpm”
100%[============================================================================================================================================================================================>] 102,624 85.6K/s in 1.2s
2019-12-15 19:58:53 (85.6 KB/s) - “jemalloc-3.6.0-1.el6.x86_64.rpm” saved [102624/102624]
[root@localhost tools]# ll
total 564
-rw-r--r--. 1 root root 102624 Apr 1 2014 jemalloc-3.6.0-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 25532 Apr 7 2017 mysql57-community-release-el6-10.noarch.rpm
-rw-r--r--. 1 root root 439556 May 18 2016 redis-3.0.7-4.el6.art.x86_64.rpm
通过rpm命令安装jemalloc及redis
[root@localhost tools]# rpm -ivh jemalloc-3.6.0-1.el6.x86_64.rpm
warning: jemalloc-3.6.0-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:jemalloc ########################################### [100%]
[root@localhost tools]#
[root@localhost tools]# rpm -ivh redis-3.0.7-4.el6.art.x86_64.rpm
warning: redis-3.0.7-4.el6.art.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 4520afa9: NOKEY
Preparing... ########################################### [100%]
1:redis ########################################### [100%]
[root@localhost tools]#
至此,redis安装完毕
通过rpm -ql redis 查看redis安装情况
[root@localhost tools]# rpm -ql redis
/etc/logrotate.d/redis
/etc/rc.d/init.d/redis # redis服务脚本
/etc/rc.d/init.d/redis-sentinel # redis-sentinel服务脚本
/etc/redis-sentinel.conf # redis-sentinel配置文件
/etc/redis.conf # redis.conf 主配置文件
/etc/security/limits.d/95-redis.conf
/usr/bin/redis-benchmark
/usr/bin/redis-check-aof # check-aof
/usr/bin/redis-check-dump # check-dump
/usr/bin/redis-cli # redis-client
/usr/bin/redis-sentinel # redis-sentinel 在主从架构中实现其高性能的工具
/usr/bin/redis-server # redis-server
/usr/bin/redis-shutdown # 关闭redis的工具
/usr/share/doc/redis-3.0.7
/usr/share/doc/redis-3.0.7/00-RELEASENOTES
/usr/share/doc/redis-3.0.7/BUGS
/usr/share/doc/redis-3.0.7/CONTRIBUTING
/usr/share/doc/redis-3.0.7/COPYING
/usr/share/doc/redis-3.0.7/MANIFESTO
/usr/share/doc/redis-3.0.7/README
/var/lib/redis
/var/log/redis
/var/run/redis
[root@localhost tools]#
3. 到底什么是jemalloc
Redis 2.4版本之后,默认使用jemalloc来做内存管理,因为jemalloc被证明解决fragmentation problems(内存碎片化问题)比libc更好
也就是说,jemalloc是用来代替libc做内存管理的,后续有时间会单独写一篇博客研究一下redis的内存管理机制