Centos6安装运行twemproxy

https://github.com/twitter/twemproxy

1. 按照Git主页的安装方法安装,需要安装automake和libtool

yum install automake libtool

2. 执行autoreconf和make

$ git clone git@github.com:twitter/twemproxy.git
$ cd twemproxy
$ autoreconf -fvi
$ ./configure --enable-debug=full
$ make
$ src/nutcracker -h

3. 如果执行autoreconf时报错autoconf版本低,需更新autoconf

[root@node01 twemproxy]# autoreconf -fvi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:8: error: Autoconf version 2.64 or higher is required
configure.ac:8: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63

  1. 添加阿里源
    https://developer.aliyun.com/mirror/epel?spm=a2c6h.13651102.0.0.3e221b11HwVEUR
[root@node01 twemproxy]# cd /etc/yum.repos.d
[root@node01 yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
  1. 查找autoconf更新版本
[root@node01 twemproxy]# yum search autoconf
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * centos-sclo-rh: mirrors.bfsu.edu.cn
 * centos-sclo-sclo: mirrors.neusoft.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
epel                                                                                                                                                                                      | 4.7 kB     00:00     
epel/primary_db                                                                                                                                                                           | 6.1 MB     00:01     
============================================================================================= N/S Matched: autoconf =============================================================================================
php-horde-Horde-Mail-Autoconfig.noarch : Horde Mail Autoconfiguration
autoconf.noarch : A GNU tool for automatically configuring source code
autoconf213.noarch : A GNU tool for automatically configuring source code
autoconf268.noarch : A GNU tool for automatically configuring source code

  Name and summary matches only, use "search all" for everything.

  1. 安装autoconf268
yum install autoconf268
  1. 回到第二步,完成安装

4. 启动配置

进入源码包中的scripts文件夹

[root@node01 scripts]# cp nutcracker.init /etc/init.d/twemproxy
[root@node01 scripts]# cd /etc/init.d
[root@node01 init.d]# chmod +x twemproxy 

查看这个启动脚本里的相关配置,并按照其要求进行如下配置

[root@node01 init.d]# vi twemproxy 

在这里插入图片描述

[root@node01 init.d]# mkdir /etc/nutcracker
[root@node01 init.d]# cp /root/GitRepository/twemproxy/conf/nutcracker.yml /etc/nutcracker/
[root@node01 init.d]# cp /root/GitRepository/twemproxy/src/nutcracker /usr/bin

5. 基本使用

  1. 修改配置文件,设置两个redis server
alpha:
  listen: 127.0.0.1:22121
  hash: fnv1a_64
  distribution: ketama
  auto_eject_hosts: true
  redis: true
  server_retry_timeout: 2000
  server_failure_limit: 1
  servers:
   - 127.0.0.1:6379:1
   - 127.0.0.1:6380:1

  1. 启动服务
[root@node01 init.d]# service twemproxy start

  1. 分别开启两个redis server
[root@node01 6380]# redis-server --port 6379
[root@node01 6380]# redis-server --port 6380
  1. 使用redis-cli连接配置的22121端口进行测试
[root@node01 ~]# redis-cli -p 22121
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值