CentOS6.5 下Redis 安装

测试redis需要tcl的支持,如果没安装,需要安装,除非跳过测试。

#yum install tcl -y

 

编译安装redis

#cd /usr/local/src

#wget http://download.redis.io/releases/redis-2.8.17.tar.gz

#tar zxfv redis-2.8.17.tar.gz

# cd redis-2.8.17

#make MALLOC=jemalloc

# make test

 

#当出现All tests passedwithout errors!时,表示测试没问题。有个测试是多个链接并发的,需要打开多个socket,如果系统配置的文件打开数太小,会导致测试失败。

安装编译好的程序到指定目录

# make PREFIX=/usr/local/redis/2.8.17 install

 

1.1.1.1      将Redis配置成系统服务

 

在redis的源码目录下

# utils/install_server.sh

第一个选端口:默认6379,选默认的。

第二个选配置文件:输入配置文件将存放的位置,自动生成,没其它情况选默认。

第三个选日志文件:输入日志文件将存放的位置,没其它情况选默认。

第四个选存放数据的目录:输入数据的目录,建议指定专门的目录,这里指定/data/redis/6379。

第五个输入redis服务端的可执行文件,服务端的可执行文件在安装目录的bin下,输入:/usr/local/redis/2.8.17/bin/redis-server

查看redis服务状态

# service redis_6379 status

关闭redis

# service redis_6379 stop

启动redis

# service redis_6379 start

重启redis

# service redis_6379 restart





主从同步设置:


只需要在slave 上修改 redis.conf


################################# REPLICATION #################################


# Master-Slave replication. Use slaveof to make a Redis instance a copy of
# another Redis server. Note that the configuration is local to the slave
# so for example it is possible to configure the slave to save the DB with a
# different interval, or to listen to another port, and so on.
#


slaveof 120.25.148.194 6379


# If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the slave to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the slave request.
#
masterauth      youpasswd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值