<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>爱周末 &#187; redis</title>
	<atom:link href="http://zhoumo123.cn/tag/redis/feed" rel="self" type="application/rss+xml" />
	<link>http://zhoumo123.cn</link>
	<description>知识分享，共同进步。zhoumo123.cn</description>
	<lastBuildDate>Thu, 07 Nov 2019 05:53:49 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.1</generator>
	<item>
		<title>centos7安装redis 命令安装与编译安装</title>
		<link>http://zhoumo123.cn/linux/3248.html</link>
		<comments>http://zhoumo123.cn/linux/3248.html#comments</comments>
		<pubDate>Mon, 31 Aug 2015 01:48:47 +0000</pubDate>
		<dc:creator><![CDATA[zhangc]]></dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[redis]]></category>

		<guid isPermaLink="false">http://zhoumo123.cn/?p=3248</guid>
		<description><![CDATA[方法一：使用命令安装（前提是已经安装了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 &#8211; Redis persistent key-value database Loade ...  <a href="http://zhoumo123.cn/linux/3248.html">  阅读全文 </a>]]></description>
				<content:encoded><![CDATA[<p><strong>方法一：使用命令安装（前提是已经安装了EPEL）。</strong></p>
<p>安装redis:</p>
<p><span style="color: #ff0000;">yum -y install redis</span></p>
<p>启动/停止/重启 Redis<br />
<strong>启动服务：</strong><br />
1<br />
systemctl start redis.service</p>
<p><strong>停止服务：</strong></p>
<p>systemctl stop redis.service</p>
<p><strong>重启服务：</strong></p>
<p>systemctl restart redis.service</p>
<p><strong>检查状态：</strong></p>
<p>[root@idoseek ~]# systemctl status redis.service<br />
redis.service &#8211; Redis persistent key-value database<br />
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled)<br />
Active: active (running) since 二 2014-10-21 21:37:22 EDT; 5h 26min ago<br />
Main PID: 30413 (redis-server)<br />
CGroup: /system.slice/redis.service<br />
└─30413 /usr/bin/redis-server 127.0.0.1:6379</p>
<p>10月 21 21:37:22 idoseek.com systemd[1]: Started Redis persistent key-value database.</p>
<p><strong>随系统启动服务：</strong></p>
<p>[root@idoseek ~]# systemctl enable redis.service<br />
ln -s &#8216;/usr/lib/systemd/system/redis.service&#8217; &#8216;/etc/systemd/system/multi-user.target.wants/redis.service&#8217;</p>
<p><strong>关闭随机启动：</strong></p>
<p>[root@idoseek ~]# systemctl disable redis.service<br />
rm &#8216;/etc/systemd/system/mult(www.111cn.net)i-user.target.wants/redis.service&#8217;</p>
<p><strong>方法二：编译安装</strong></p>
<p><strong>下载安装编译:</strong></p>
<p># wget http://download.redis.io/releases/redis-2.8.17.tar.gz<br />
# tar xzf redis-2.8.17.tar.gz<br />
# cd redis-2.8.17<br />
# make<br />
# make install</p>
<p><strong>设置配置文件路径:</strong></p>
<p># mkdir -p /etc/redis &amp;&amp; cp redis.conf /etc/redis</p>
<p><strong>修改配置文件：</strong></p>
<p># vim /etc/redis/redis.conf<br />
修改为： daemonize yes<br />
<strong>启动Redis:</strong></p>
<p># /usr/local/bin/redis-server /etc/redis/redis.conf<br />
#关闭服务</p>
<p>redis-cli shutdown</p>
<p>或者在cli中执行shutdown</p>
<p>redis 127.0.0.1:6379&gt; shutdown</p>
<p><strong>清除缓存</strong></p>
<p>redis-cli flushall</p>
<p>更多文档请参考软件包内的“README”文件。<br />
查看状态 ：</p>
<p># ss -nlp|grep redis</p>
<p>或者</p>
<p># ps -ef | grep redis</p>
<p>下面介绍为PHP添加redis插件。</p>
<p>从官网下载最新的拓展，地址：http://pecl.php.net/package/redis或者https://github.com/phpredis/phpredis</p>
<p>#wget http://pecl.php.net/get/redis-2.2.5.tgz<br />
#phpize<br />
#./configure &#8211;prefix=/opt/redis &#8211;enable-redis &#8211;with-php-config=/opt/php/bin/php-config<br />
#make &amp;&amp; make install</p>
<p>把拓展添加至php.ini，重启php-fpm：</p>
<p>service php-fpm restart<br />
from:http://www.111cn.net/sys/CentOS/85292.htm</p>
<p><strong>错误描述</strong></p>
<p>安装Redis 2.8.18时报错：</p>
<p>zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory<br />
zmalloc.h:55:2: error: #error &#8220;Newer version of jemalloc required&#8221;<br />
make[1]: *** [adlist.o] Error 1<br />
make[1]: Leaving directory `/data0/src/redis-2.6.2/src&#8217;<br />
make: *** [all] Error 2</p>
<p><strong>原因分析</strong></p>
<p>在README 有这个一段话。</p>
<p>Allocator<br />
&#8212;&#8212;&#8212;</p>
<p>Selecting a non-default memory allocator when building Redis is done by setting<br />
the `MALLOC` environment variable. Redis is compiled and linked against libc<br />
malloc by default, with the exception of jemalloc being the default on Linux<br />
systems. This default was picked because jemalloc has proven to have fewer<br />
fragmentation problems than libc malloc.</p>
<p>To force compiling against libc malloc, use:</p>
<p>% make MALLOC=libc</p>
<p>To compile against jemalloc on Mac OS X systems, use:</p>
<p>% make MALLOC=jemalloc<br />
说关于分配器allocator， 如果有MALLOC 这个 环境变量， 会有用这个环境变量的 去建立Redis。</p>
<p>而且libc 并不是默认的 分配器， 默认的是 jemalloc, 因为 jemalloc 被证明 有更少的 fragmentation problems 比libc。</p>
<p>但是如果你又没有jemalloc 而只有 libc 当然 make 出错。 所以加这么一个参数。</p>
<p>解决办法</p>
<p>make MALLOC=libc</p>
<p>http://my.oschina.net/ifraincoat/blog/499352</p>
]]></content:encoded>
			<wfw:commentRss>http://zhoumo123.cn/linux/3248.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
