一‘redis单实例安装配置
1.下载redis源码压缩包,并将其上传至服务器/usr/local
2.解压redis源码压缩包
  # tar -xzvf redis-3.2.12.tar.gz
3.进入redis解压缩后的目录进行编译
  # cd redis-3.2.12
  # make
4.编译成功后,再对redis进行安装
  # cd src
  # make install
5.对安装后的redis进行部署
  # mkdir -p /usr/local/redis/
  # mkdir -p /usr/local/redis/etc/
  # mkdir -p /usr/local/redis/bin
  # cd ..
  # cd ..
  # mv redis-3.2.12 redis
  # cd redis
  # cp redis.conf /usr/local/redis/etc/
  # cp mkreleasdhdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server /usr/local/redis/bin/
  # groupadd redis
  # useradd -r -g redis
  # mkdir -p /home/redis
  # chown -R redis.redis /home/redis
  # chmod -R 755 /home/redis
  # passwd redis
  # chown -R redis.redis /usr/local/redis/
  # chmod -R 755 /usr/local/redis/  
  # vi /home/redis/.bash_profile
6.启动redis
  # su - redis
  $ cd /usr/local/redis/bin/
  $ redis-server ../etc/redis.conf
7.连接redis
  $ redis-cli -p 6379
8.关闭redis
  $ redis-cli -p 6379
  或
  $ pkill redis

二、redis集群安装配置
1.创建配置文件
  $ mdkir -p /usr/local/redis/cluster
  $ cd /usr/local/redis/etc/
  $ cp redis.conf ../cluster/redis-6379.conf
  $ cp redis.conf ../cluster/redis-6380.conf
  $ cp redis.conf ../cluster/redis-6381.conf
2.修改配置文件
  $ vi redis-6379.conf
  daemonize yes
  pidfile /var/run/redis6301.pid
  port 6379
  logfile "/usr/local/redis/cluster/6379.log"
  dbfilename dump6379.rdb
  
  $ vi redis-6380.conf
  daemonize yes
  pidfile /var/run/redis6380.pid
  port 6380
  logfile "/usr/local/redis/cluster/6380.log"
  dbfilename dump6380.rdb
  
  $ vi redis-6381.conf
  daemonize yes
  pidfile /var/run/redis6381.pid
  port 6381
  logfile "/usr/local/redis/cluster/6381.log"
  dbfilename dump6381.rdb
3.启动redis cluster
  $ cd /usr/local/redis/bin
  redis-server /usr/local/redis/cluster/redis-6379.conf
  redis-server /usr/local/redis/cluster/redis-6380.conf
  redis-server /usr/local/redis/cluster/redis-6381.conf
4.主从同步
  1)方法一
  $ redis-cli -p 6380
  auth "passwd"
  info replication
  slaveof 127.0.0.1 6379
  
  $ redis-cli -p 6381
  auth "passwd"
  info replication
  slaveof 127.0.0.1 6379
  2)方法二
  将如下行分别加入redis-6380.conf和redis-6381.conf中
  slaveof 127.0.0.1 6379
  
5.验证redis cluster
  $ redis-cli -p 6379
  auth "passwd"
  info replication
  
  $ redis-cli -p 6380
  auth "passwd"
  info replication
  
  $ redis-cli -p 6381
  auth "passwd"
  info replication
  
三、redis集群哨兵模式
1.创建配置文件
  $ mkdir -p /usr/local/redis/sentinel/
  $ cd /usr/local/redis/sentinel/
  
  $ touch sentinel-26379.conf
  $ touch sentinel-26380.conf 
  $ touch sentinel-26381.conf
2.修改配置文件
  $ vi sentinel-26379.conf
  # 后台启动
  daemonize yes
  # 启动目录
  dir "/usr/local/redis/bin"
  # 日志文件
  logfile "/usr/local/redis/sentinel/sentinel-26379.log"
  # 监听Redis主库IP地址及端口
  sentinel monitor host6379 127.0.0.1 6379 2
  
  $ vi sentinel-26380.conf
  # 后台启动
  daemonize yes
  # 启动目录
  dir "/usr/local/redis/bin"
  # 日志文件
  logfile "/usr/local/redis/sentinel/sentinel-26380.log"
  # 监听Redis主库IP地址及端口
  sentinel monitor host6379 127.0.0.1 6379 2
  
  $ vi sentinel-26381.conf
  # 后台启动
  daemonize yes
  # 启动目录
  dir "/usr/local/redis/bin"
  # 日志文件
  logfile "/usr/local/redis/sentinel/sentinel-26381.log"
  # 监听Redis主库IP地址及端口
  sentinel monitor host6379 127.0.0.1 6379 2
 
3.启动哨兵
  $ redis-sentinel /usr/local/redis/sentinel/sentinel-26301.conf
  $ redis-sentinel /usr/local/redis/sentinel/sentinel-26302.conf
  $ redis-sentinel /usr/local/redis/sentinel/sentinel-26303.conf
  
4.查看哨兵
  $ tail -f /usr/local/redis/sentinel/sentinel-26379.log
  $ tail -f /usr/local/redis/sentinel/sentinel-26380.log
  $ tail -f /usr/local/redis/sentinel/sentinel-26381.log

Redis for linux安装配置之—-源码安装的更多相关文章

  1. 004-nginx简介、安装配置【源码安装和mac安装】、基本使用

    一.概述 1.1.Nginx是什么 Nginx是一款轻量级的Web服务器,也是一款轻量级的反向代理服务器[常用]. 1.2.Nginx能干什么 Nginx能干的事情很多,这里简要罗列一些: 1:直接支 ...

  2. Mysql for Linux安装配置之—— 源码安装

    1.安装 --假设已经有mysql-5.5.10.tar.gz以及cmake-2.8.4.tar.gz两个源码压缩文件1)先安装cmake(mysql5.5以后是通过cmake来编译的)   # ta ...

  3. Kali Linux 下安装配置MongoDB数据库 ubuntu 下安装配置MongoDB源码安装数据库

    Kali Linux 下安装配置MongoDB数据库   1.下载mongodb.tgz 压缩包: 2.解压到:tar -zxvf mongodb.tgz /usr/local/mongodb 3.创 ...

  4. CentOS Linux release 7.3源码安装zabbix

    CentOS Linux release 7.3安装zabbix 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 前言: 我去年用用centos6的环境搭建了一下 zabbix3.0 ...

  5. 【SystemTap】 Linux下安装使用SystemTap源码安装SystemTap

    转自 http://blog.csdn.net/zklth/article/details/6248558 文章 http://blog.csdn.net/zklth/archive/2010/09/ ...

  6. Red hat Linux 安装Node.js 源码安装

    1. 下载源码包 http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz 2.准备安装环境,>python2.6, gcc, g++ pytho ...

  7. nginx安装,手动源码安装

    什么是Nginx? Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Ra ...

  8. linux下mysql的源码安装

    mysql有多中安装方法,本文只涉及编译安装,对其他方法感兴趣的可以自行百度. 1.首先获取mysql软件安装包,这里用wget下载 [root@localhost ~]# wget http://d ...

  9. linux下无root源码安装软件

    先进入源码文件夹下指定安装路径 ./configure --prefix=/public/home/ztu/usr/samtools 编译 make 安装 make install 写入环境变量 vi ...

随机推荐

  1. java框架之SpringBoot(10)-启动流程及自定义starter

    启动流程 直接从 SpringBoot 程序入口的 run 方法看起: public static ConfigurableApplicationContext run(Object source, ...

  2. group_concat的使用

    1.场景 仓库使用系统实现了先进先出,给仓库的备货单原先设计如下模式: tx3表: 不同的批次分开行显示,仓库从这个备货单可以知道这个货品需要备货哪些批次,多少数量 用了几天,仓库对此备货单样式提出如 ...

  3. [js]js中4种无节操的预解释情况

    js中4种无节操的预解释情况 - 1. if语句即使条件不成立,条件里的表达式也会进行预解释. - 2. 匿名函数的预解释: 只对等号左边与解释 - 3. 自执行函数的预解释: 不进行预就解释, 执行 ...

  4. python进阶(四) windows下虚拟环境使用

    虚拟环境作用: 1. 通常开发一个项目,会安装很多的第三方包,这时第三方包我们是安装在本机环境的.那么如果项目进行部署或移植的时候是不是要重新安装这些包???? 2.开发环境,同时在做两相项目,同时要 ...

  5. ArchLinux安装Sublime Text 3

    安装方法: 在 /etc/pacman.conf中添加 [archlinuxcn] SigLevel = Optional TrustAll Server = http://repo.archlinu ...

  6. consul 集群

    主机运行 : consul agent -server -bootstrap-expect 2  -data-dir D:\consul  -node=winyh -bind=192.168.10.1 ...

  7. 零基础快速入门web学习路线(含视频教程)

    下面小编专门为广大web学习爱好者汇总了一条完整的自学线路:零基础快速入门web学习路线(含视频教程)(绝对纯干货)适合初学者的最新WEB前端学习路线汇总! 在当下来说web前端开发工程师可谓是高福利 ...

  8. 使用hector-slam和Kinect V1建图

    一.建图实际操作 下载源码测试源码,depthimage_to_laserscan,参考https://blog.csdn.net/u010925447/article/details/5649468 ...

  9. flutter 常用插件

    audio_recorder: any #录音.播放 flutter_sound: ^1.1.5#录音 dropdown_menu: ^1.1.0#下拉菜单 simple_permissions:#权 ...

  10. 值得收藏:一份非常完整的 MySQL 规范

    一.数据库命令规范 所有数据库对象名称必须使用小写字母并用下划线分割. 所有数据库对象名称禁止使用 MySQL 保留关键字(如果表名中包含关键字查询时,需要将其用单引号括起来). 数据库对象的命名要能 ...