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 ...
随机推荐
- MySQL的create table as 与 like区别
对于MySQL的复制相同表结构方法,有create table as 和create table like 两种,区别是什么呢? ? 1 create table t2 as select * fro ...
- 正则提取 html 里<input> 标记的value 值
获取html 标记的值: :年月日 结果:您选择的是2014年1月22日 使用了Regex 对象,得到一个 MatchCollection,然后进行处理. string mes = @"&l ...
- java 线程返回值
1.传统方式需要新建一个接口类,然后在接口类中将结果在方法中作为参数进行处理 package de.bvb.test3; public class Test3 { public static void ...
- 数据终端设备与无线通信模块之间串行通信链路复用协议(TS27.010)在嵌入式系统上的开发【转】
转自:http://blog.csdn.net/hellolwl/article/details/6164449 目录(?)[-] 协议介绍 模块协议介绍 1 命令包格式 2 ...
- Python—sqlalchemy
SQLAlchemy SQLAlchemy是Python编程语言下的一款ORM框架,该框架建立在数据库API之上,使用关系对象映射进行数据库操作. #Dialect用于和数据API进行交流,根据配置文 ...
- cmd 下切换目录
隔了段时间没用cmd 工作台,发现不会切换目录了,感觉特sb,为避免再次出现sb情况,记下来在说 1.切换磁盘(磁盘字母) d: 2.切换到指定目录 cd d:\www 在cmd下执行php文件 c: ...
- PV、UPV、UV简介
1.PV: PV的全称是Pageview,中文的意思是:综合浏览量. 浏览量.页面的浏览次数,衡量网站用户访问的网页数量,用户每打开/刷新一次页面就记录一次,多 次打开会累计. 2.UPV: UPV的 ...
- Android分包方案multidex
对于功能越来越复杂的app的两大问题 问题一:当项目越来越大,方法数超过65536,编译时会出错(为什么是65536,参考下面关于dexopt对方法id检索存储介绍),这个所说的方法数包含用到的框架, ...
- winform 对话框,保存,另存为,还有打印控件
学习的对话框的种类: 1.打开文件对话框(OpenFileDialog) 2.保存文件对话框(SaveFileDialog) 3.字体对话框(FontDialog) 4.颜色对话框(ColorDial ...
- js 为字符串添加样式
<html><body> <script type="text/javascript"> var txt="Hello World!& ...