centos7安装redis
方法一:使用命令安装(前提是已经安装了EPEL)。
安装redis:
yum -y install redis
启动/停止/重启 Redis
启动服务:
1
systemctl start redis.service
停止服务:
systemctl stop redis.service
重启服务:
systemctl restart redis.service
检查状态:
[root@idoseek ~]# systemctl status redis.service
redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled)
Active: active (running) since 二 2014-10-21 21:37:22 EDT; 5h 26min ago
Main PID: 30413 (redis-server)
CGroup: /system.slice/redis.service
└─30413 /usr/bin/redis-server 127.0.0.1:6379
10月 21 21:37:22 idoseek.com systemd[1]: Started Redis persistent key-value database.
随系统启动服务:
[root@idoseek ~]# systemctl enable redis.service
ln -s '/usr/lib/systemd/system/redis.service' '/etc/systemd/system/multi-user.target.wants/redis.service'
关闭随机启动:
[root@idoseek ~]# systemctl disable redis.service
rm '/etc/systemd/system/mult(www.111cn.net)i-user.target.wants/redis.service'
方法二:编译安装
下载安装编译:
# wget http://download.redis.io/releases/redis-2.8.17.tar.gz
# tar xzf redis-2.8.17.tar.gz
# cd redis-2.8.17
# make
# make install
设置配置文件路径:
# mkdir -p /etc/redis && cp redis.conf /etc/redis
修改配置文件:
# vim /etc/redis/redis.conf
修改为: daemonize yes
启动Redis:
# /usr/local/bin/redis-server /etc/redis/redis.conf
#关闭服务
redis-cli shutdown
或者在cli中执行shutdown
redis 127.0.0.1:6379> shutdown
清除缓存
redis-cli flushall
更多文档请参考软件包内的“README”文件。
查看状态 :
# ss -nlp|grep redis
或者
# ps -ef | grep redis
下面介绍为PHP添加redis插件。
从官网下载最新的拓展,地址:http://pecl.php.net/package/redis或者https://github.com/phpredis/phpredis
#wget http://pecl.php.net/get/redis-2.2.5.tgz
#phpize
#./configure --prefix=/opt/redis --enable-redis --with-php-config=/opt/php/bin/php-config
#make && make install
把拓展添加至php.ini,重启php-fpm:
service php-fpm restart
from:http://www.111cn.net/sys/CentOS/85292.htm
错误描述
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 `/data0/src/redis-2.6.2/src'
make: *** [all] Error 2
原因分析
在README 有这个一段话。
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.
To force compiling against libc malloc, use:
% make MALLOC=libc
To compile against jemalloc on Mac OS X systems, use:
% make MALLOC=jemalloc
说关于分配器allocator, 如果有MALLOC 这个 环境变量, 会有用这个环境变量的 去建立Redis。
而且libc 并不是默认的 分配器, 默认的是 jemalloc, 因为 jemalloc 被证明 有更少的 fragmentation problems 比libc。
但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以加这么一个参数。
解决办法
make MALLOC=libc
centos7安装redis的更多相关文章
- CentOS7 安装Redis Cluster集群
上一篇中已经讲到了如何安装单击版Redis,这一篇我们来说下如何安装Cluster,关于哨兵模式这里我就不写文章安装了,有兴趣的同学可以自己去研究,哨兵模式可以在主从模式下在创建三台机器的哨兵集群监控 ...
- CentOS7安装redis数据库及php-redis扩展
redis 首先把redis安装到服务器中 1.wget http://download.redis.io/redis-stable.tar.gz 下载redis源码 2. tar xvzf redi ...
- [ 搭建Redis本地服务器实践系列一 ] :图解CentOS7安装Redis
上一章 [ 搭建Redis本地服务器实践系列 ] :序言 作为开场白介绍了下为什么要写这个系列,从这个章节我们就开始真正的进入正题,开始搭建我们本地的Redis服务器.那么关于Redis的基本概念,什 ...
- centos7 安装redis服务及phpredis扩展
闲话少说 服务器版本:centos7.6 64位 软件包:https://pan.baidu.com/s/1Gb4iz5mqLqNVWvvZdBiOMQ 提取码: xrhx 一.安装redis 放在/ ...
- vmware安装centos7 安装redis windows7访问redis
1.在windows7中安装vmware 2.在vmware中安装centos7 3.禁用centos7自带的firewalld.service 4.安装iptables防火墙 5.安装Redis 3 ...
- CentOS7 安装Redis和PHP-redis扩展
aemonize yes Redis是一个key-value存储系统,属于我们常说的NoSQL.它遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的AP ...
- Centos7 安装redis
1.下载redis安装包 wget http://download.redis.io/releases/redis-4.0.9.tar.gz 2.检查及下载gcc gcc -v yum -y inst ...
- Centos7 安装 Redis
关闭防火墙:systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启 ...
- Centos7安装Redis 3.2.8
关闭防火墙和SELinx 关闭防火墙 [root@node1 ~]# systemctl stop firewalld 开启防火墙 [root@node1 ~]# systemctl enable f ...
随机推荐
- 161229、SpringMVC的各种参数绑定方式
1. 基本数据类型(以int为例,其他类似): Controller代码: @RequestMapping("saysth.do") public void test(int co ...
- 使用jquery-qrcode生成二维码
一.使用jquery-qrcode生成二维码 先简单说一下jquery-qrcode,这个开源的三方库(可以从https://github.com/jeromeetienne/jquery-qrcod ...
- 搭建基于Jenkins salt-api的运维工具
1. 安装salt-master和salt-minion 安装过程不再赘述,请参考http://docs.saltstack.com/en/latest/topics/installation/ind ...
- NodeJS 调试工具(node-inspector)
node-inspector是基于Chrome的调试工具. 安装: npm install -g node-inspector 1.启动node-inspector来监听node.js的debug调试 ...
- mac_snailSVN
作者:潘捷链接:https://www.zhihu.com/question/19705164/answer/119484169来源:知乎著作权归作者所有,转载请联系作者获得授权. Mac下之前也有类 ...
- list中的中文转换编码显示
for i in range(1,sheet.nrows): row=sheet.row_values(i,0,sheet.ncols) row=str(row).replace('u\'','\'' ...
- [Machine-Learning] 熟悉Matlab
浮点数取整的几个函数 floor: 向下取整 ceil: 向上取整 round: 取最接近的整数 fix: 向0取整 不等于 Matlab 中,使用~=表示不等于. 数组相关操作 使用 [] 命名数组 ...
- Android项目架构之业务组件化
前言: 从个人经历来说的话,从事APP开发这么多年来,所接触的APP的体积变得越来越大,业务的也变得越来越复杂,总来来说只有一句话:这是一个APP臃肿的时代!所以为了告别APP臃肿的时代,让我们进入一 ...
- JAVA-小青蛙跳石头游戏
游戏摘自微信传的手机网页版小游戏,我拿来做成了JAVA的界面版,但是没有去做素材,,直接拿方块代替小青蛙.游戏原址就不分享了,只能在手机上打开. 下面是源码: /* * Main.java * */ ...
- 安装软件时出现error 1337 【添加权限】
Error 1317 An error occurred while attempting to create the directory Drive Name:\Folder Name https: ...