1、安装GCC
[code language=”bash”]
$ yum install gcc
[/code]
2、安装Boost
[code language=”bash”]
$ yum install boost-devel
[/code]
3、安装Ragel,官网:http://www.colm.net/open-source/ragel/
[code language=”bash”]
$ tar -xvf ragel-6.9.tar.gz
$ cd ragel-6.9
$ ./configure
$ make && make install
[/code]
4、执行以下安装命令
[code language=”bash”]
sudo yum install -y \
autoconf \
binutils-devel \
bison \
boost-devel \
double-conversion-devel \
flex \
gcc-c++ \
gcc \
git \
gflags-devel \
glog-devel \
jemalloc-devel \
openssl-devel \
libtool \
libevent-devel \
make \
python-devel
[/code]
5、安装folly,官网:https://github.com/facebook/folly
安装folly要先安装double-conversion。官网:https://github.com/google/double-conversion
[code language=”bash”]
cmake . -DBUILD_TESTING=ON
make && make install
test/cctest/cctest –list | tr -d ‘<’ | xargs test/cctest/cctest
[/code]
安装folly要先安装Wangle,官网:https://github.com/facebook/wangle
[code language=”bash”]
cmake .
make
ctest
make install
[/code]
安装folly
[code language=”bash”]
autoreconf -ivf
./configure
make && make install
[/code]
folly默认安装在了/usr/local/lib里面,有些系统可能没在搜索路径里面。此时需要修改/etc/profile文件,加入
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
立即生效
[code language=”bash”]
source /etc/profile
[/code]
6、安装mcrouter
[code language=”bash”]
$ autoreconf –install
$ ./configure
$ make
$ sudo make install
$ mcrouter –help
[/code]
7、编辑配置文件,启动mcrouter
配置文件内容 mcrouter.json
[code language=”json”]
{
"pools":{"A":{"servers":["192.168.1.166:11211","192.168.1.161:11211"]}},
"route":"PoolRoute|A"
}
[/code]
启动脚本:
[code language=”bash”]
$ mcrouter –config-file mcrouter.json -p 5000 > /dev/null 2>&1 &
[/code]