• 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服务器,再原路返回。

  • 相关阅读:
    G
    ZOJ 3782
    23.内存池
    22.boost图模板
    21.boost Ford最短路径算法(效率低)
    20.boost dijkstra最短路径算法
    19.boost A*算法
    18.boost 图的拓扑排序
    17.广度优先遍历bfs
    16.boost图深度优先遍历DFS
  • 原文地址:https://www.cnblogs.com/youn/p/5278006.html
Copyright © 2020-2023  润新知