1. 程式人生 > >centos編譯安裝redis

centos編譯安裝redis

我使用的版本是3.0

mv redis-3.0.7 /usr/local/redis
cd /usr/local/redis/
yum -y install gcc-c++
make MALLOC=libc  && make install
redis-server /usr/local/redis/redis.conf

便可以正常啟動

make 過程中需要使用make MALLOC=libc命令,否則會出現以下錯誤

make[1]: Entering directory /usr/local/redis/src'
CC adlist.o
在包含自 adlist.c:34 的檔案中:
zmalloc.h:50:31: 錯誤:jemalloc/jemalloc.h:沒有那個檔案或目錄
zmalloc.h:55:2: 錯誤:#error "Newer version of jemalloc required"
make[1]: *** [adlist.o] 錯誤 1
make[1]: Leaving directory

/usr/local/redis/src’
make: * [all] 錯誤 2

但是我們實際使用的話這樣挺不方便的,一來無法使用service命令進快速啟動, 二來也無法開機自啟動
vim /etc/init.d/redis

#!/bin/sh 
# 
# redis - this script starts and stops the redis-server daemon 
# 
# chkconfig:   - 85 15
# description:  Redis is a persistent key-value database 
# processname: redis-server 
# config: /etc/redis.conf # config: /etc/sysconfig/redis # pidfile: /var/run/redis.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 redis="/usr/local/bin/redis-server"
prog=$(basename $redis) REDIS_CONF_FILE="/etc/redis.conf" [ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis lockfile=/var/lock/subsys/redis start() { [ -x $redis ] || exit 5 [ -f $REDIS_CONF_FILE ] || exit 6 echo -n $"Starting $prog: " daemon $redis $REDIS_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { stop start } reload() { echo -n $"Reloading $prog: " killproc $redis -HUP RETVAL=$? echo } force_reload() { restart } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 2 esac

chmod +x /etc/init.d/redis

mkdir /etc/redis
cp redis.conf /etc/redis.conf
vim /etc/redis.conf
daemonize yes #只有saemonize設定為yes,才會以後臺的方式啟動
chkconfig –add redis
service redis start

[[email protected] redis]# chkconfig –list redis
redis 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉
[[email protected] redis]# ps aux|grep redis
root 2602 0.0 0.3 31000 1904 ? Ssl 00:17 0:00 /usr/local/bin/redis-server *:6379
root 2608 0.0 0.1 103248 872 pts/0 S+ 00:17 0:00 grep redis

看到以上資訊便確定完全成功

生產環境中需要設定Redis最大佔用記憶體,以1GB為例

# In short... if you have slaves attached it is suggested that you set a lower
# limit for maxmemory so that there is some free RAM on the system for slave
# output buffers (but this is not needed if the policy is 'noeviction').
#
# maxmemory <bytes>
maxmemory 1073741824

相關推薦

centos編譯安裝redis

我使用的版本是3.0 mv redis-3.0.7 /usr/local/redis cd /usr/local/redis/ yum -y install gcc-c++ make MALLOC=libc && make insta

Centos編譯安裝Redis

腳本 stdout idf list 配置 files 嘗試 configure 安裝php 文章來源:https://segmentfault.com/a/1190000003084917 安裝環境說明: 操作系統:Centos 6.5 -64bit 安裝路徑

centOS安裝 Redis

路徑 mman tom bugs over ons red enc jpg 之前安裝過了 jdk,mysql,tomcat,這次安裝 Redis, 1 . 首先得安裝 c環境,用來編譯 Redis源碼, [[email protected]/* */ l

Centos 7 安裝redis

included 日誌 edi 3.2 oca ref server http ins 1.下載   wget http://download.redis.io/releases/redis-3.2.3.tar.gz 2.解壓   tar -zxvf redis-3.2.3

Centos安裝Redis

啟動方式 下使用 server running log tcl 系統 amp class 今天介紹一下redis,重點介紹一下redis的安裝。 Redis 是一個基於內存的高性能key-value數據庫,數據都保存在內存中定期刷新到磁盤,以極高的讀寫效率而備受關註。他的特

CentOS 7安裝Redis

edi kcon per 持久 系統 ase local ted 配置 一、下載、解壓並安裝 1 wget http://download.redis.io/releases/redis-4.0.8.tar.gz 2 tar xzf redis-4.0.8.tar.gz

Centos 編譯安裝Apache subversion-1.9.7 + httpd 2.4.32

Subversion HTTPsvn是Subversion的簡稱,是一個開放源代碼的版本控制系統。一、下載安裝Subversion必要的源碼文件Apachewget http://mirrors.shu.edu.cn/apache/httpd/httpd-2.4.32.tar.gzSubversionwge

CentOS 編譯安裝 python 3.5

centos python 源碼安裝 CentOS 6自帶的python是2.6的,下面記錄下CentOS6源碼安裝python 3.5的過程 #wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz #tar xf Python

編譯安裝redis

bsp med alt server mar cst add 宋體 watermark redis官網http://www.redis.cn/download.html 1)安裝詳細步驟[root@liujihaoth ~]# wget http://download.re

centos 7 安裝 redis

lec bind art bubuko strong lease gre etc service 直接yum 安裝的redis 不是最新版本 yum install redis 如果要安裝最新的redis,需要安裝Remi的軟件源,官網地址:http://rpms.fa

CentOS 7上安裝並配置 Python 3.6 環境 超詳細的 Linux CentOS 編譯安裝python3 Linux下編譯安裝python3

前言 按照此方法安裝保證以下報錯什麼的統統都沒有! 基礎環境 系統:centos7.4 軟體:python3 Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connect

CentOS 7 安裝Redis單機版和叢集

Redis下載 http://download.redis.io/releases/redis-4.0.11.tar.gz 一、單機版搭建 1.上傳壓縮包到 /usr/download (我自定義放安裝包的目錄) 2.安裝gcc編譯環境,命令 yum install gcc-c++

centos7編譯安裝redis-4.0.0

編譯安裝 1.下載redis原始碼包 [[email protected] /]# wget http://download.redis.io/releases/redis-4.0.0.tar.gz 2.解壓安裝包 [[email protected] /]# tar

超詳細 Linux 下編譯安裝Redis 以及php配套使用

一、Linux 下安裝Redis 下載地址:http://redis.io/download,下載最新文件版本。 把滑鼠移到上圖的綠色框上,就會顯示下圖提示:(直接右鍵複製連結就好) 本教程使用的舊版,文件版本為 3.2.11,(舊版的連結在同一頁面的下方找的到)下載並安裝:

centos 編譯安裝 mysql5.6

一、編譯安裝 Mysql 前的準備工作 安裝編譯原始碼所需的工具和庫 yum install gcc gcc-c++ ncurses-devel perl 安裝 cmake,從 這裡 下載原始碼並編譯安裝 wget http://www.cmake.org/f

Linux下原始碼編譯安裝Redis和部署

    redis是一個 鍵值 (Key—Value)型別 記憶體資料庫 ,所有的操作都是在記憶體中進行。然後定期地通過非同步操作將資料庫的資料flush到硬碟上。由於是記憶體操作,所以效能非常的出色。但是容易受實體記憶體的影響,如果是海量

Centos7 編譯安裝redis-4.0.1及主從+哨兵模式

一、redis概述及哨兵模式 redis對資料快取到記憶體,實現高效快取,使用持久化模組對資料進行儲存,使用sentinel模式實現redis叢集,提供高可用服務。 下面是在巨集觀層面上哨兵模式的功能列表: ·監控:哨兵不斷的檢查master和slave是否正常的執行。

CentOS安裝Redis的PHP擴充套件[轉]

、安裝Redis的PHP擴充套件 2.1 安裝phpize yum install php-devel 2.2 下載擴充套件原始碼包,直接用wget #wget下載github上的檔案 wget https://github.com/nicolasff/phpredis/arc

在linux通過源碼編譯安裝redis詳細步驟

數據 默認 strong list col name cli tro alt 1.下載源碼包 [root@localhost opt]# wget http://download.redis.io/releases/redis-4.0.10.tar.gz 2

在linux通過原始碼編譯安裝redis詳細步驟

1.下載原始碼包 [[email protected] opt]# wget http://download.redis.io/releases/redis-4.0.10.tar.gz 2.解壓縮redis [[email protected] opt]# tar