zoukankan      html  css  js  c++  java
  • twemproxy 安装

    twemproxy

    安装

    1. 获取安装包

    shell> wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz 
    shell> wget https://codeload.github.com/twitter/twemproxy/zip/master
    #twemproxy要求autoconf的版本在2.64以上

    2. 编译安装

    shell> unzip ./twemproxy-master.zip
    
    shell> tar -zxvf ./autoconf-2.69.tar.gz
    
    shell> cd ./autoconf-2.69

    shell> ./configure --prefix=/usr/ shell> make && make install
    shell> /usr/bin/autoconf -V
    autoconf (GNU Autoconf) 2.69
    Copyright (C) 2012 Free Software Foundation, Inc.
    License GPLv3+/Autoconf: GNU GPL version 3 or later
    <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by David J. MacKenzie and Akim Demaille.

    shell
    > cd twemproxy-master shell> autoreconf -fvi
    shell> configure.ac:36: error: possibly undefined macro: AC_PROG_LIBTOOL
          If this token and others are legitimate, please use m4_pattern_allow.
          See the Autoconf documentation.

    shell> yum -y install libtool
    shell> autoreconf -fvi
    shell> ./configure --prefix=/usr/local/twemproxy 

    shell
    > make -j `grep processor /proc/cpuinfo | wc -l`

    shell
    > make install

    3.增加配置文件

    shell> cd /usr/local/twemproxy
    
    shell> cat > /usr/local/twemproxy/nutcracker.yml << EOF
    
    memcache:
    
      listen: 0.0.0.0:11210
    
      hash: fnv1a_64
    
      distribution: ketama
    
      auto_eject_hosts: true
    
      redis: false
    
      timeout: 400
    
      server_retry_timeout: 30000
    
      server_failure_limit: 5
    
      servers:
    
       - 172.18.18.52:11211:1
    
       - 172.18.18.53:11211:1
    
       - 127.18.3.11:11211:1
    
       - 172.18.3.12:11211:1
    
       #- 172.18.3.4:11211:1
    
       #- 172.18.3.7:11211:1
    
    EOF

    4. 启动服务

    shell> vi /etc/sysconfig/iptables
    
    shell> -A INPUT -m state --state NEW -m tcp -p tcp  --dport 11210 -j ACCEPT #开放防火墙端口11210
    
    shell> /etc/init.d/iptables restart
    
    shell> nutcracker -t #测试配置文件
    
    shell> /usr/local/twemproxy/sbin/nutcracker -d -c /usr/local/twemproxy/nutcracker.yml #指定配置文件启动

    5.启动命令详解

    Usage: nutcracker [-?hVdDt] [-v verbosity level] [-o output file]
    [-c conf file] [-s stats port] [-a stats addr]
    [-i stats interval] [-p pid file] [-m mbuf size]
    参数释义
    -h, –help 查看帮助文档,显示命令选项
    -V, –version 查看nutcracker版本
    -t, –test-conf 测试配置脚本的正确性
    -d, –daemonize 以守护进程运行
    -D, –describe-stats 打印状态描述
    -v, –verbosity=N 设置日志级别 (default: 5, min: 0, max: 11)
    -o, –output=S 设置日志输出路径,默认为标准错误输出 (default: stderr)
    -c, –conf-file=S 指定配置文件路径 (default: conf/nutcracker.yml)
    -s, –stats-port=N 设置状态监控端口,默认22222 (default: 22222)
    -a, –stats-addr=S 设置状态监控IP,默认0.0.0.0 (default: 0.0.0.0)
    -i, –stats-interval=N 设置状态聚合间隔 (default: 30000 msec)
    -p, –pid-file=S 指定进程pid文件路径,默认关闭 (default: off)
    -m, –mbuf-size=N 设置mbuf块大小,以bytes单位 (default: 16384 bytes)

    Twemproxy是一种代理分片机制,由Twitter开源。Twemproxy作为代理,可接受来自多个程序的访问,按照路由规则,转发给后台的各个Redis服务器,再原路返回。

  • 相关阅读:
    PS_0005:画带颜色在线条框 按住Alt键复制
    零钱兑换(动态规划)
    倒排索引原理和实现
    集群搭建
    java内部类
    nohup &后台运行脚本
    scala构造函数
    spark数据源读取及读数据原理
    安装redis解决公司linux环境的坑
    61、对于employees表中,给出奇数行的first_name
  • 原文地址:https://www.cnblogs.com/youn/p/5278006.html
Copyright © 2011-2022 走看看