lichaoyue888 发表于 2018-11-5 09:54:34

CentOS6 安装Redis

  打开Reids的官网,看看有没quick install之类的文档,一看傻眼了,啥都没有,关于安装的,只字未提。这点让我不爽,不如oracle。
  解包3.0.7版本,里面有个INSTALL,嘿嘿,打开一看,呵呵--->look README.
  好吧,移步README。里面好详细啊,给个赞!
  首先进入解压后的目录,make 一下,make之前确定你已经安装了make,gcc,等组件。
  果然报错了:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory  
    zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
  需要这个东西,按照以往的惯例,可以yum install 啊!网上一搜,千篇一律,在make的时候加参数:
  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
  Verbose build
  看见了吗?说的很清楚了吧?我决定不用上面的参数:MALLOC=libc人家告诉你可能错误会很多,你还傻乎乎的去用吗?生产环境下坚决不用,平时也不用,养成良好习惯PS:开发者自动忽略。
  这个软件可以用yum安装只是在EPEL源里。
  yum install jemalloc-devel
  如果你没有epel 那么先装上:yum install epel-release
  这是方法1。
  另外还有方法2:
  进入deps在里面make jemalloc
  --------------------------以上是错误1------------------------
  错误2:
$ make  
clang: error: no such file or directory: '../deps/hiredis/libhiredis.a'
  
clang: error: no such file or directory: '../deps/lua/src/liblua.a'
  
make: *** Error 1
  
make: *** Error 2
  
方法:
  
cd deps
  
make lua hiredis linenoise
  

  

  
---------------------------错误3-------------------------
You need tcl 8.5 or newer in order to run the Redis testmake: *** Error 1  
方法:
  
yum installtcl
  

  

  
官网这么说的:http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html
  

  

  

  

  
好了,make test 一下,如果开始报错了,再make test一下,卧槽,错误没了。真是奇葩啊!
  

  

  
makePREFIX=/usr/lcoal/redisinstall
  

  
指定安装目录。
  

  
/usr/local/redis/bin/redis-server/path/redis.conf
  

  
指定配置文件启动服务
  

  
默认端口6379
  

  

  
可以这样:nohup   /usr/local/redis/bin/redis-server/path/redis.conf $
  

  
启动之后按照提试改改内核参数即可。
  

  
---------------------------------关于用户和密码---------------------------
  http://www.iyunv.com/database/201412/365757.html
  ====================以下每个进程对应一个配置文件(转载)===================================================
  需要启动多个Redis实例:
  一台Redis服务器,分成多个节点,每个节点分配一个端口(6380,6381…),默认端口是6379。
  每个节点对应一个Redis配置文件,如:redis6380.conf、redis6381.conf
  #cp redis.confredis6380.conf
  #vi redis6380.conf
  pidfile : pidfile/var/run/redis/redis_6380.pid
  port 6380
  logfile : logfile/var/log/redis/redis_6380.log
  rdbfile : dbfilenamedump_6380.rdb
  (其他配置文件类似修改)
  启动多个redis实例:
  #redis-server/usr/local/redis/redis6380.conf
  #redis-server/usr/local/redis/redis6381.conf


页: [1]
查看完整版本: CentOS6 安装Redis