关于Redis 安装 官方网站node
$ wget http://download.redis.io/releases/redis-3.0.7.tar.gzredis
$ tar xzf redis-3.0.7.tar.gz数据库
$ cd redis-3.0.7ruby
$ make installapp
这里必定须要 make install 命令进行安装 而不是make 使用make会提示你redis-server命令找不到 而且在 usr/local/bin 这个文件夹下不会生成 redis-server 和 redis-cli网站
安装 启动以及配置ui
http://www.tuicool.com/articles/aQbQ3u线程
redis 配置文件 以及一些关键配置的讲解 全部的配置文件都在 redis-server.conf 这个文件中日志
daemonize yes 设置成是否是使用守护线程来进行操做 (no 非守护线程)server
pidfile 生成的pid 文件的目录
port 6666 端口号
logfile 生成的日志文件,这里配置目录和文件名当redis启动失败,宕机等均可以从这个日志文件中查找到相关信息
dbfilename redis.rdb 生成的数据库文件,由于redis是能够一步把数据写入磁盘的
dir 文件目录 它生成dbfilename的目录 和 在下面配置redis集群的时候 cluster--config-file 的目录
cluster-enabled yes 表示开启集群配置
cluster-config-file 集群的redis节点
cluster-node-timeout 5000节点连接的时间设置
appendonly 是否开启写入日志
appendfilename 记录每次写操做的文件名
配置完了上面的文件以后,复制出来多个配置文件 好比 6666.conf,6667.conf,6668.conf,6669.conf 6670.conf 6671.conf
注意: 搭建redis集群主从 须要配置 6个节点,三主三从
分别启动这些 节点 redis-server 6666.conf ,redis-server 6667.conf ........
以后使用 ruby 来搭建 redis的主从 在redis的src 目录下 有一个 redis-trib.rb
要是本身本机上面没有安装 ruby 要先安装 sudo apt-get install ruby
以后使用 gemp install redis 安装redis的监听端口
一切安装好以后
./redis-trib.rb create --replicas 1 127.0.0.1:6666 127.0.0.1:6667 127.0.0.1:6668 127.0.0.1:6669 127.0.0.1:6670 127.0.0.1:6671
启动的时候出现:
Can I set the above configuration 输入 yes