千家信息网

Redis 4.0源码安装的示例分析

发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,这篇文章主要介绍了Redis 4.0源码安装的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。去官网下载软件https://re
千家信息网最后更新 2026年10月31日Redis 4.0源码安装的示例分析

这篇文章主要介绍了Redis 4.0源码安装的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

去官网下载软件
https://redis.io/download

最新稳定版本是4.0
上传到服务器

解压软件
[root@MySQL01 ~]# cd /install/
[root@MySQL01 install]# tar xvfz redis-4.0.2.tar.gz

编译安装
[root@MySQL01 install]# cd redis-4.0.2
[root@MySQL01 redis-4.0.2]# make
...
CC module.o
CC evict.o
CC expire.o
CC geohash.o
CC geohash_helper.o
CC childinfo.o
CC defrag.o
CC siphash.o
CC rax.o
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
INSTALL redis-check-aof

Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory `/install/redis-4.0.2/src'

启动redis
[root@MySQL01 redis-4.0.2]# src/redis-server &
[1] 48741
[root@MySQL01 redis-4.0.2]# 48741:C 03 Nov 19:29:48.941 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
48741:C 03 Nov 19:29:48.941 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=48741, just started
48741:C 03 Nov 19:29:48.941 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
48741:M 03 Nov 19:29:48.944 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.2 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 48741
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'


48741:M 03 Nov 19:29:48.950 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
48741:M 03 Nov 19:29:48.950 # Server initialized
48741:M 03 Nov 19:29:48.950 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
48741:M 03 Nov 19:29:48.950 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
48741:M 03 Nov 19:29:48.950 * DB loaded from disk: 0.000 seconds
48741:M 03 Nov 19:29:48.950 * Ready to accept connections

通过内置的客户端工具连接到redis
[root@MySQL01 redis-4.0.2]# src/redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar

查看进程
[root@MySQL01 redis-4.0.2]# ps -ef|grep redis
root 48741 1 0 Nov03 ? 00:00:25 src/redis-server *:6379

为Python 3.6.1语言安装Redis客户端库
[root@MySQL01 redis-4.0.2]# pip3 install redis hiredis
Collecting redis
Downloading redis-2.10.6-py2.py3-none-any.whl (64kB)
100% |████████████████████████████████| 71kB 107kB/s
Collecting hiredis
Downloading hiredis-0.2.0.tar.gz (46kB)
100% |████████████████████████████████| 51kB 501kB/s
Installing collected packages: redis, hiredis
Running setup.py install for hiredis ... done
Successfully installed hiredis-0.2.0 redis-2.10.6

通过Python 3登录Redis
[root@MySQL01 redis-4.0.2]# python
Python 3.6.1 (default, Oct 2 2017, 06:28:48)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> conn = redis.Redis()
>>> conn.set('hello', 'world')
True
>>> conn.get('hello')
b'world'

感谢你能够认真阅读完这篇文章,希望小编分享的"Redis 4.0源码安装的示例分析"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!

篇文章 源码 示例 分析 客户 客户端 软件 价值 兴趣 同时 工具 更多 朋友 服务器 版本 知识 编带 行业 语言 资讯 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 上海卓越科技互联网 互联网科技工作委员会毛军 互联网下的科技发展 喔噻互联网科技 互联网科技公司怎么样 互联网科技缩写 上海致骋互联网科技 国外互联网科技网站 哈尔滨新华互联网科技 汉立互联网科技有限公司联系电话 速维有品互联网信息科技(苏州)有限公司 米聚互联网科技南京有限公司排面 国大互联网教育科技有限公司工作 互联网行业科技股 烟台灵鸽互联网科技有限公司 上海同邻互联网科技有限公司规模 抖集互联网科技技术咨询 艺电能源互联网科技有限公司招聘 东风日产互联网科技公司叫什么 互联网科技创新方面的资料 耶加雪菲 互联网科技卖菜 互联网金融 金融科技 智网互联网科技 互联网与医疗科技 互联网5g黑科技有哪些 徐州市互联网科技有限公司 科技互联网的核心竞争力 电子商务与互联网科技的关系 济南小医互联网科技有限公司招聘
0