如何在linux下安装redis3.2

如何在linux下安装redis3.2,第1张

方法/步骤

1

首先在官网下载redis-3.0.3.tar.gz

2

在某一个要安装redis的目录下输入命令

tar xzf redis-3.0.3.tar.gz

实现解压缩

3

进入解压缩后的redis目录

4

输入make命令,在编译的过程中有可能会碰到错误

5

如果报错误make[3]: gcc: Command not found

就调用yum命令安装gcc 命令如下yum install gcc

6

如果报如下错误

zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory

zmalloc.h:55:2: error: #error "Newer version of jemalloc required"

make[1]: *** [adlist.o] Error 1

make[1]: Leaving directory `/root/redis-3.0.3/src'

make: *** [all] Error 2

那么输入

make MALLOC=libc

重新编译

7

安装成功以后,运行redis-server &使用redis数据库在后台运行,如果没有报错,那就证明redis数据库安装成功

8

这时输入命令redis-cli对数据库发起链接,就可以对redis数据库做简单的测试了

9

关闭redis服务的方法,可以采用ps|redis的方式找到pid,然后通过kill -9 pid的方式关闭redis服务

缓存数据库redis安装

中 文网 站 http://redis.cn

官方网 站 http://redis.io

1、从redis.cn 下载最新redis包, 3.0稳定版系 列

放到文件目录下。

tar -zxvf redis-3.2.1.tar.gz

cd redis-3.2.1

sudo ./runtest

尝试环境是否可以正常使用

make test

2、出现

 \o/ All tests passed without errors!

表示redis环境没有问题

3、

sudo make install

4、启动redis

redis-server

如果出现

8652: C 22 Jul 17: 16: 59. 587 # Warning: no config file specified, using the default conf

ig. In order to specify a config file use redis- server /path/to/redis. conf

_. _

_. - ` ` __ ' ' - . _

_

. - ` ` ` . ` _. ' ' - . _ Redis 3. 2. 1 ( 00000000/0) 64 bit

. - ` ` . - ` ` ` . ` ` ` \/ _. , _ ' ' - . _

( ' , . - ` | ` , ) Running in standalone mode

| ` - . _` - . . . - ` __. . . - . ` ` - . _| ' ` _. - ' | Port: 6379

| ` - . _ ` . _ / _. - ' | PID: 8652

` - . _ ` - . _ ` - . / _. - ' _. - '

| ` - . _` - . _ ` - . __. - ' _. - ' _. - ' |

| ` - . _` - . _ _. - ' _. - ' | http: //redis. io

` - . _ ` - . _` - . __. - ' _. - ' _. - '

| ` - . _` - . _ ` - . __. - ' _. - ' _. - ' |

| ` - . _` - . _ _. - ' _. - ' |

` - . _ ` - . _` - . __. - ' _. - ' _. - '

` - . _ ` - . __. - ' _. - '

` - . _ _. - '

` - . __. - '

8652: M 22 Jul 17: 16: 59. 594 # WARNING: The TCP backlog setting of 511 cannot be enforce

d because /proc/sys/net/core/somaxconn is set to the lower value of 128.

8652: M 22 Jul 17: 16: 59. 594 # Server started, Redis version 3. 2. 1

8652: M 22 Jul 17: 16: 59. 594 # WARNING overcommit_memory is set to 0! Background save ma

y 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' f

or this to take effect.

8652: M 22 Jul 17: 16: 59. 594 * The server is now ready to accept connections on port 637

9

表示成功

5、链接redis服务器

6、新开终端

redis-cli

得到

127.0.0.1:6379> 

127.0.0.1:6379>ping pong

表示redis服务器安装正常

详情可查看我的博客:

http://blog.csdn.net/bingo_zq/article/details/52452989

一: redis 的安装与初始配置:

Redis下载 wgethttp://download.redis.io/releases/redis-

3.2.6.tar.gz tar xzf redis-3.2.6.tar.gz

3.     cd  redis-3.2.6

4.     make MALLOC=libc

5.     cd redis-3.2.6/src

6.     makeinstall

mv /usr/local/redis-3.2.6/redis.conf /etc

mv /usr/local/redis-3.2.6/src/mkreleasdhdr.sh redis-benchmark redis-check-aofredis-check-dump redis-cli redis-server /usr/bin

配置后台启动redis服务

a)首先编辑/etc/redis.conf文件,将daemonize属性改为yes(表明需要在后台运行)

b)再次启动redis服务,并指定启动服务配置文件

/usr/bin/redis-server/etc/redis.conf

Yum 安装 redis :

首先为yum添加epel源:yum install epel-release回车

再次:yum install redis回车


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/8676930.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-19
下一篇2023-04-19

发表评论

登录后才能评论

评论列表(0条)

    保存