CentOS 7 下安裝redis遇到的一些問題

來源:互聯網
上載者:User

一、首先列一下安裝步驟:

1.用winscp將安裝包redis-3.0.6.tar.gz掛載到系統root目錄下

2.解壓:tar zvxf redis-3.2.1.tar.gz 

3.進入目錄: cd redis-3.2.1

4.編譯:make

5. 進入src目錄:cd src, 編譯:make install


二、遇到的問題:

1.沒有安裝gcc和gcc-c++,錯誤如下圖:

  

解決辦法:

 yum install gcc yum install gcc-c++  
有可能還要安裝tcl(如果make test出現You need tcl 8.5 or newer in order to run the Redis test的話)
 yum install tcl

2.zmalloc.h:50:31: 致命錯誤:jemalloc/jemalloc.h:沒有那個檔案或目錄

問題原因:

在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 出錯。

所以加這麼一個參數。


解決方案:

[root@localhost src]# make MALLOC=libc



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.