redis集群安装踩过的坑

redis安装方式一

1.安装gcc命令:yum install -y gcc

复制代码
#安装gcc
[root@localhost src]# yum install -y gcc

#出现如下信息则安装成功
Installed:
gcc.x86_64 0:4.4.7-17.el6

Dependency Installed:
cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-17.el6 mpfr.x86_64 0:2.4.1-6.el6 ppl.x86_64 0:0.10.2-11.el6

Complete

#查看gcc方式1
[root@localhost src]# gcc -v 
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info......
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

#查看gcc方式2
[root@localhost src]# rpm -q gcc 
gcc-4.4.7-17.el6.x86_64
复制代码

2.下载网址

redis官网地址:http://www.redis.io/

redis下载地址:http://download.redis.io/releases/

3.以centos6.5系统,redis3.2.4版本为例,把下载好的redis压缩包传到linxu系统中,进行解压.

[root@localhost redis]# tar zxvf redis-3.2.8.tar.gz

4.编译安装,执行命令 make

复制代码
#执行命令
[root@localhost redis-3.2.8]# make

#出现以下信息则表示安装完成
Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/usr/redis/redis-3.2.8/src'
复制代码

5.启动redis

[root@localhost 6000]# redis-server redis.conf

6.安装出现错误情况

(1)执行make命令出现如下错误,则没有安装gcc,按照上面安装方法安装gcc

复制代码
[root@localhost redis]# cd redis-3.2.8/
[root@localhost redis-3.2.8]# make
cd src && make all
sh: ./mkreleasehdr.sh: Permission denied
make[1]: Entering directory `/usr/redis/redis-3.2.8/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/usr/redis/redis-3.2.8/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/usr/redis/redis-3.2.8/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -O2 -g -ggdb   -I../deps/geohash-int -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua geohash-int jemalloc)
make[2]: Entering directory `/usr/redis/redis-3.2.8/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-ldflags)
(echo "" > .make-cflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/usr/redis/redis-3.2.8/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/usr/redis/redis-3.2.8/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/usr/redis/redis-3.2.8/deps'
make[1]: [persist-settings] Error 2 (ignored)
    CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/usr/redis/redis-3.2.8/src'
make: *** [all] Error 2
复制代码

 (2)执行maker出现如下错误,则没有权限执行命令,要在 /src 目录执行授权命令:chmod 777 mkreleasehdr.sh

复制代码
#1.执行make报错,则没有权限执行命令
[root@localhost redis-3.2.8]# make
cd src && make all
sh: ./mkreleasehdr.sh: Permission denied
make[1]: Entering directory `/usr/redis/redis-3.2.8/src'
    CC adlist.o
In file included from adlist.c:34:
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 `/usr/redis/redis-3.2.4/src'
make: *** [all] Error 2

#2.授权
[root@localhost src]# chmod 777 mkreleasehdr.sh
复制代码

 (3)执行make出现如下错误,则要配置变量

复制代码
#1.错误信息
make[1]: Entering directory `/usr/redis/redis-3.2.8/src'
    CC adlist.o
In file included from adlist.c:34:
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 `/usr/redis/redis-3.2.8/src'
make: *** [all] Error 2

#2.添加变量
[root@localhost src]# make MALLOC=libc
复制代码

(4)执行 make MALLOC=libc 命令报错 或 还有其他错误,建议删除redis所有文件重新装,或者按照下面的方式安装.

猜你喜欢

转载自blog.csdn.net/ahzxj2012/article/details/73479847