建站服務(wù)器
127.0.0.1:7001
紅河哈尼網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,紅河哈尼網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為紅河哈尼上1000+提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的紅河哈尼做網(wǎng)站的公司定做!安裝報(bào)錯(cuò) error: jemalloc/jemalloc.h: No such file or directory解決方法
錯(cuò)誤描述
安裝Redis 2.8.18時(shí)報(bào)錯(cuò):
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 有這個(gè)一段話。
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
說關(guān)于分配器allocator,如果有MALLOC 這個(gè)環(huán)境變量,會(huì)有用這個(gè)環(huán)境變量的去建立Redis。
而且libc并不是默認(rèn)的分配器,默認(rèn)的是 jemalloc,因?yàn)?jemalloc 被證明有更少的fragmentation problems比libc。
但是如果你又沒有jemalloc 而只有 libc 當(dāng)然 make 出錯(cuò)。 所以加這么一個(gè)參數(shù)。
解決辦法
make MALLOC=libc
3.創(chuàng)建集群需要的目錄
mkdir-p/usr.local/cluster
cd/usr.local/cluster
4.修改配置文件redis.conf
cp /usr/local/redis3.0/redis.conf /usr.local/cluster/
vimredis.conf
###需要修改的內(nèi)容##
port 7000
daemonize yes
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
##修改完redis.conf配置文件中的這些配置項(xiàng)之后把這個(gè)配置文件分別拷貝到7000/7001/7002/7003/7004/7005目錄下面
##注意:拷貝完成之后要修改7001/7002/7003/7004/7005目錄下面redis.conf文件中的port參數(shù),分別改為對(duì)應(yīng)的文件夾的名稱
5.分別啟動(dòng)這6個(gè)redis實(shí)例
cd /usr/local/cluster/7000
redis-server redis.conf
cd /usr/local/cluster/7001
redis-server redis.conf
cd /usr/local/cluster/7002
redis-server redis.conf
cd /usr/local/cluster/7003
redis-server redis.conf
cd /usr/local/cluster/7004
redis-server redis.conf
cd /usr/local/cluster/7005
redis-server redis.conf
##啟動(dòng)之后使用命令查看redis的啟動(dòng)情況ps -ef|grep redis
[root@localhost ~]# ps -ef|grep redis
root 2495 1 0 20:09 ? 00:00:04 redis-server *:7000 [cluster]
root 2505 1 0 20:10 ? 00:00:05 redis-server *:7001 [cluster]
root 2510 1 0 20:10 ? 00:00:04 redis-server *:7002 [cluster]
root 2520 1 0 20:13 ? 00:00:04 redis-server *:7003 [cluster]
root 2528 1 0 20:14 ? 00:00:04 redis-server *:7004 [cluster]
root 2534 1 0 20:14 ? 00:00:04 redis-server *:7005 [cluster]
root 2878 1477 0 20:54 pts/0 00:00:00 grep redis
6.執(zhí)行redis的創(chuàng)建集群命令創(chuàng)建集群
安裝創(chuàng)建集群所需要的環(huán)境及插件
yuminstall -y ruby
yum install -y rubygems
gem install redis(redis和ruby的接口,使用gem安裝)(本次實(shí)驗(yàn)環(huán)境可上網(wǎng))
cd /usr/local/redis3.0/src/
./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
分享標(biāo)題:redis3.0.0集群環(huán)境部署
文章地址:http://weahome.cn/article/cpsjop.html