redis3.2安装过程分享

转载自我要求索网 redis3.2安装过程分享

去 redis官网  下载对应的版本。下载地址:https://redis.io/download

centos安装redis

[root@localhost application]# tar -zvxf redis-3.2.5.tar.gz

......

[root@localhost application]# cd redis-3.2.5

  • 在解压目录运行make编译

[root@localhost redis-3.2.5]# make
cd src && make all
make[1]: Entering directory `/application/redis-3.2.5/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/application/redis-3.2.5/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/application/redis-3.2.5/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -O2 -g -ggdb   -I../deps/geohash-int -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua geohash-int jemalloc)
make[2]: Entering directory `/application/redis-3.2.5/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-ldflags)
(echo "" > .make-cflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/application/redis-3.2.5/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc:命令未找到
make[3]: *** [net.o] 错误 127
make[3]: Leaving directory `/application/redis-3.2.5/deps/hiredis'
make[2]: *** [hiredis] 错误 2
make[2]: Leaving directory `/application/redis-3.2.5/deps'
make[1]: [persist-settings] 错误 2 (忽略)
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] 错误 127
make[1]: Leaving directory `/application/redis-3.2.5/src'
make: *** [all] 错误 2

发现报错了由于我未安装gcc,下一步安装gcc

[root@localhost redis-3.2.5]# yum install gcc -y

...............

由于输出太多 省略部分输出

Installed:
gcc.x86_64 0:4.4.7-17.el6

Dependency Installed:
cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-17.el6 glibc-devel.x86_64 0:2.12-1.192.el6 glibc-headers.x86_64 0:2.12-1.192.el6 kernel-headers.x86_64 0:2.6.32-642.11.1.el6
libgomp.x86_64 0:4.4.7-17.el6 mpfr.x86_64 0:2.4.1-6.el6 ppl.x86_64 0:0.10.2-11.el6

Dependency Updated:
glibc.x86_64 0:2.12-1.192.el6 glibc-common.x86_64 0:2.12-1.192.el6 libgcc.x86_64 0:4.4.7-17.el6 tzdata.noarch 0:2016j-1.el6

Complete!

安装完成之后,继续运行make,运行之后又发现了错误

[root@localhost redis-3.2.5]# make
cd src && make all
make[1]: Entering directory `/application/redis-3.2.5/src'
CC adlist.o
在包含自 adlist.c:34 的文件中:
zmalloc.h:50:31: 错误:jemalloc/jemalloc.h:没有那个文件或目录
zmalloc.h:55:2: 错误:#error "Newer version of jemalloc required"
make[1]: *** [adlist.o] 错误 1
make[1]: Leaving directory `/application/redis-3.2.5/src'
make: *** [all] 错误 2

查找资料后发现,解决这个问题只需要运行make MALLOC=libc 

[root@localhost redis-3.2.5]# make MALLOC=libc
cd src && make all
make[1]: Entering directory `/application/redis-3.2.5/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
........................
Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/application/redis-3.2.5/src'

 

  • 测试安装是否成功

启动redis服务

[root@localhost redis-3.2.5]# src/redis-server
6169:C 14 Dec 20:27:27.807 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
6169:M 14 Dec 20:27:27.809 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-``    `.  `_.  ''-._           Redis 3.2.5 (00000000/0) 64 bit
.-`` .-```.  ```\/    _.,_ ''-._
(    '      ,       .-`  | `,    )     Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
|    `-._   `._    /     _.-'    |     PID: 6169
`-._    `-._  `-./  _.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |           http://redis.io
`-._    `-._`-.__.-'_.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |
`-._    `-._`-.__.-'_.-'    _.-'
`-._    `-.__.-'    _.-'
`-._        _.-'
`-.__.-'

6169:M 14 Dec 20:27:27.812 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
6169:M 14 Dec 20:27:27.812 # Server started, Redis version 3.2.5
6169:M 14 Dec 20:27:27.812 # 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.
6169:M 14 Dec 20:27:27.812 # 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.
6169:M 14 Dec 20:27:27.813 * The server is now ready to accept connections on port 6379

使用内置的客户端命令redis-cli进行使用:

[root@localhost redis-3.2.5]# src/redis-cli
127.0.0.1:6379> set key value
OK
127.0.0.1:6379> get key
"value"
127.0.0.1:6379>

至此,centOS安装redis成功,为了以后运行命令不必每次进入安装目录,也可以把src绝对目录加入到PATH环境变量。

windows安装redis

Redis 没有官方的Windows版本,但是微软开源技术团队(Microsoft Open Tech group)开发和维护着这个 Win64 的版本。

window发布版本列表地址

https://github.com/MSOpenTech/redis/releases

下载Redis-x64-3.2.100.msi

双击msi文件安装,点击next勾选同意协议,再点击next,选择自定义安装目录,也可以勾选上吧安装目录添加到PATH环境变量,

然后一路下一步,其中还包含有修改默认端口,设置内存最大 限制等可自定义。最后点击install安装。

打开cmd命令行进入安装目录运行redis-server.exe redis.windows.conf

C:\Program Files\Redis>redis-server.exe redis.windows.conf
_._
_.-``__ ''-._
_.-``    `.  `_.  ''-._           Redis 3.2.100 (00000000/0) 64 bit
.-`` .-```.  ```\/    _.,_ ''-._
(    '      ,       .-`  | `,    )     Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
|    `-._   `._    /     _.-'    |     PID: 4292
`-._    `-._  `-./  _.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |           http://redis.io
`-._    `-._`-.__.-'_.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |
`-._    `-._`-.__.-'_.-'    _.-'
`-._    `-.__.-'    _.-'
`-._        _.-'
`-.__.-'

[4292] 26 Dec 17:28:35.496 # Server started, Redis version 3.2.100
[4292] 26 Dec 17:28:35.496 * The server is now ready to accept connections on port 6379

打开另一个cmd命令

C:\Program Files\Redis>redis-cli.exe
127.0.0.1:6379> set key value
OK
127.0.0.1:6379> get key
"value"
127.0.0.1:6379>

至此,window安装redis成功。

转载于:https://my.oschina.net/www51qiuusocom/blog/812654

对于Windows系统上的Redis 3.2安装,你可以按照以下步骤进行操作: 1. 首先,你需要下载Redis 3.2安装文件。你可以在GitHub上找到Redis的发布页面\[1\],在该页面中找到适用于Windows系统的Redis 3.2版本的下载链接。 2. 点击下载链接,将安装文件保存到你的计算机上。 3. 解压下载的安装文件。你可以使用压缩软件(如WinRAR或7-Zip)来解压缩文件。 4. 打开解压后的文件夹,你会看到一些Redis的可执行文件和配置文件。 5. 在解压后的文件夹中,找到redis-server.exe文件,并双击运行它。这将启动Redis服务器。 6. 打开命令提示符(CMD)或PowerShell,并导航到Redis安装文件夹的路径。 7. 在命令提示符或PowerShell中,输入以下命令来启动Redis客户端: ``` redis-cli.exe ``` 8. 现在,你已经成功安装并启动了Redis 3.2。你可以使用Redis客户端来执行各种Redis命令和操作。 请注意,以上步骤仅适用于Redis 3.2安装和启动。如果你需要进行更高版本的Redis安装,请参考相应的文档或指南。 #### 引用[.reference_title] - *1* [windows安装redis3.2.1教程](https://blog.csdn.net/qq_35160479/article/details/120731984)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值