redis配置(2)

3个独立的master 三台主机都需要如下操作

[root@server5 redis]# redis-cli 
127.0.0.1:6379> SLAVEOF no one
OK
127.0.0.1:6379> info
# Replication
role:master
connected_slaves:0
master_replid:c43f6e8ed4f1509f3b03ef20dff6293d4b1d91bd
master_replid2:e78d78cd05f8108cde5a77ca78e1d10509113eae

在开一台主机作为twemproxy
下载twemproxy-master.zip的压缩包

yum install unzip -y //安装解压工具
unzip  twemproxy-master.zip
cd twemproxy-master
[root@server4 ~]# cd twemproxy-master
[root@server4 twemproxy-master]# ls
aclocal.m4      conf      config.h.i     libtool  Makefile     man     README.md  stamp-h1
autom4te.cache  config    config.log     configure.ac  LICENSE  Makefile.am  notes   scripts    tests
ChangeLog       config.h  config.status  contrib       m4       Makefile.in  NOTICE  src        travis.sh
//没有这个configure 所以我们根据twemproxy-master的文档 需要automake 和 libtool 两个工具 然后我们需要安装这两个工具 
[root@server4 twemproxy-master]# yum install -y automake libtool autoconf //安装完成后
[root@server4 twemproxy-master]#autoreconf -fvi
[root@server4 twemproxy-master]# ls
aclocal.m4      conf      config.h.in    configure     libtool  Makefile     man     README.md  stamp-h1
autom4te.cache  config    config.log     configure.ac  LICENSE  Makefile.am  notes   scripts    tests
ChangeLog       config.h  config.status  contrib       m4       Makefile.in  NOTICE  src        travis.sh //configure 有了
[root@server4 twemproxy-master]# ./configure
[root@server4 twemproxy-master]# make
[root@server4 twemproxy-master]#make install
[root@server4 etc]# cat /etc/tweproxy.yml 
alpha:
  listen:172.25.16.4:22121
  hash:fnv1a_64
  distribution:ketama
  auto_eject_hosts:true
  redis:true
  server_retry_timeout:20000
  server_failure_limit:1
  servers:
   - 172.25.16.2:6379:1
   - 172.25.16.5:6379:1
   - 172.25.16.20:6379:1

//在此文件中写入如下配置
[root@server4 etc]# nutcracker -d -c /etc/tweproxy.yml//打入后台 文件读取  --help获取更多的用法
[root@server4 twemproxy-master]# netstat -antlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 172.25.16.4:22121       0.0.0.0:*               LISTEN      10231/nutcracker    
tcp        0      0 0.0.0.0:22222           0.0.0.0:*               LISTEN      10231/nutcracker  
//运行成功

此时我们需要将server2中的/usr/local/bin/redis-cli,scp传输到server4中操作如下

[root@server2 bin]# scp ./redis-cli root@172.25.16.4:/usr/local/bin/
The authenticity of host '172.25.16.4 (172.25.16.4)' can't be established.
ECDSA key fingerprint is SHA256:7cZjIzA/ySKInCxnMhoDDxOB5FeCk1p2ZI33E8pylF4.
ECDSA key fingerprint is MD5:f5:56:81:55:a3:fd:6b:97:c0:7a:21:a3:c4:5d:eb:4b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.25.16.4' (ECDSA) to the list of known hosts.
root@172.25.16.4's password: 
redis-cli                                                                                                           100% 4695KB  70.6MB/s   00:00    
[root@server2 bin]# 在这个servr2中操作

回到server4上

redis-cli -p 22121  -h 172.25.16.2
/可以访问到其他的master上在 server4中进行代理操作
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值