zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

【原创】源码安装 redis-2.8.3

Redis安装源码 原创 2.8
2023-09-14 08:59:46 时间
正在解析主机 download.redis.io... 109.74.203.151 Connecting to download.redis.io|109.74.203.151|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 302 Found 位置:http://211.167.105.115:83/1Q2W3E4R5T6Y7U8I9O0P1Z2X3C4V5B/download.redis.io/releases/redis-2.8.3.tar.gz [跟随至新的 URL]
100%[=================================================================================================================== ] 1,046,106   1.11M/s   in 0.9s    2013-12-16 16:28:52 (1.11 MB/s) - `redis-2.8.3.tar.gz saved [1046106/1046106] [root@Betty WGET_DIR]#
-rw-rw-r-- 1 root root  8627 12-11 22:31 00-RELEASENOTES -rw-rw-r-- 1 root root    52 12-11 22:31 BUGS -rw-rw-r-- 1 root root  1439 12-11 22:31 CONTRIBUTING -rw-rw-r-- 1 root root  1487 12-11 22:31 COPYING drwxrwxr-x 6 root root  4096 12-11 22:31 deps -rw-rw-r-- 1 root root    11 12-11 22:31 INSTALL -rw-rw-r-- 1 root root   151 12-11 22:31 Makefile -rw-rw-r-- 1 root root  4223 12-11 22:31 MANIFESTO -rw-rw-r-- 1 root root  4401 12-11 22:31 README -rw-rw-r-- 1 root root 29593 12-11 22:31 redis.conf -rwxrwxr-x 1 root root   271 12-11 22:31 runtest -rw-rw-r-- 1 root root  5661 12-11 22:31 sentinel.conf drwxrwxr-x 2 root root  4096 12-11 22:31 src drwxrwxr-x 8 root root  4096 12-11 22:31 tests drwxrwxr-x 2 root root  4096 12-11 22:31 utils [root@Betty redis-2.8.3]#
Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD. We support big endian and little endian architectures. 支持 Unix-like 平台;支持大端和小端架构 It is as simple as: 直接 make     % make You can run a 32 bit Redis binary using: 编译 32-bit 版本的 Redis     % make 32bit After building Redis is a good idea to test it, using:     % make test Fixing problems building 32 bit binaries 给出了 32-bit 编译时可能遇到的问题和解决办法 --------- Allocator --------- Selecting a non-default memory allocator when building Redis is done by setting the `MALLOC` environment variable. Redis is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc. 允许通过设置环境变量 MALLOC 定制使用的内存分配机制。默认使用 libc 中提供的 malloc 相关函数,除非当前 linux 系统将 jemalloc 作为默然内存分配机制。 这种策略是因为,jemalloc 已经被证明与 libc 的 malloc 内存配置机制相比可以产生更少的内存碎片。 To force compiling against libc malloc, use: 强制使用 libc 中的 malloc 机制,可以执行     % make MALLOC=libc To compile against jemalloc on Mac OS X systems, use: 强制使用 jemalloc 机制,可以执行     % make MALLOC=jemalloc Verbose build 如何产生更多的输出 ------------- Redis will build with a user friendly colorized output by default. If you want to see a more verbose output use the following:     % make V=1 Running Redis 运行 Redis ------------- To run Redis with the default configuration just type: 使用默认配置信息运行     % cd src
line, with exactly the same name. 所有存在于配置文件 redis.conf 中的选项同样可以在命令行上进行执行。 Playing with Redis 如何“玩转”Redis ------------------ You can use redis-cli to play with Redis. Start a redis-server instance, then in another terminal try the following: 可以使用 redis-cli 命令行客户端进行测试。     % cd src
make install 命令仅仅安装二进制文件到你的系统目录中,不会进行 init 脚本的配置,也不会在 某个适当的位置生成配置文件。如果你需要一个用于生产环境的系统配置,可以执行如下命令     % cd utils
The script will ask you a few questions and will setup everything you need to run Redis properly as a background daemon that will start again on system reboots. 这个脚本会对通过向你提问的方式,引导你对系统进行配置,从而实现相应的功能。 Youll be able to stop and start Redis using the script named /etc/init.d/redis_ portnumber , for instance /etc/init.d/redis_6379.
结束上面的操作后,你将可以通过 /etc/init.d/redis_ portnumber 脚本控制 redis 的启动和停止。
-rwxrwxr-x 1 root root 6662 12-11 22:31 install_server.sh -rwxrwxr-x 1 root root  298 12-11 22:31 mkrelease.sh -rw-rw-r-- 1 root root 1277 12-11 22:31 redis-copy.rb -rwxrwxr-x 1 root root 1098 12-11 22:31 redis_init_script -rwxrwxr-x 1 root root  821 12-11 22:31 redis_init_script.tpl -rw-rw-r-- 1 root root 1762 12-11 22:31 redis-sha1.rb -rwxrwxr-x 1 root root 3787 12-11 22:31 speed-regression.tcl -rwxrwxr-x 1 root root  428 12-11 22:31 whatisdoing.sh [root@Betty 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]                                                            
s#^port [0-9]{4}$#port 6379#;s#^logfile .+$#logfile /var/log/redis_6379.log#;s#^dir .+$#dir /var/lib/redis/6379#;s#^pidfile .+$#pidfile /var/run/redis_6379.pid#;s#^daemonize no$#daemonize yes#;
#/bin/sh\n #Configurations injected by install_server below....\n\n EXEC=/usr/local/bin/redis-server\n CLIEXEC=/usr/local/bin/redis-cli\n PIDFILE=/var/run/re dis_6379.pid\n CONF="/etc/redis/6379.conf"\n\n REDISPORT="6379"\n\n ###############\n\n case "$1" in
root     11495  0.0  0.0  95296  1912 ?        Ssl  13:33   0:00 /usr/local/bin/redis-server *:6379             
Redis源码安装 Redis是一个高性能的key-value形数据库,大多数情况下会被用作缓存、排序、去重等各类用途,而且大部分网站都会选择用redis去做一个缓存来提高站点的响应速度