F-stack及其Nginx、redis的编译安装
F-stack简介
- F-stack粘合了dpdk、用户态协议栈和nginx、redis,弥补了dpdk没有协议栈的不足,并用nginx、redis提供了一个调用应用程序的接口。
Quick Start
安装
clone F-Stack
# mkdir /data/f-stack
# git clone https://github.com/F-Stack/f-stack.git /data/f-stack
安装DPDK依赖
# install libnuma-dev
# yum install numactl-devel # on Centos
# sudo apt-get install libnuma-dev # on Ubuntu
# cd f-stack
编译 DPDK
- 打开配置脚本,在脚本中输入对应项的序号
# cd dpdk/usertools
# ./dpdk-setup.sh
- 选择编译:
x86_64-native-linuxapp-gcc - 插入igb_uio
- 设置大页
- 绑定网卡
- 在 Ubuntu, 使用 gawk 而非 default mawk.
关闭 ASLR; 多核处理上必选
echo 0 > /proc/sys/kernel/randomize_va_space
# sudo apt-get install gawk
# sudo update-alternatives --config awk //to choose gawk.
编译 F-Stack
# export FF_PATH=/data/f-stack
# export FF_DPDK=/data/f-stack/dpdk/x86_64-native-linuxapp-gcc
# cd ../../lib/
# make
Nginx
# cd app/nginx-1.11.10
# bash ./configure --prefix=/usr/local/nginx_fstack --with-ff_module
# make
# make install
# cd ../..
# /usr/local/nginx_fstack/sbin/nginx
如果此步编译出现问题:可见博客:https://www.cnblogs.com/vancasola/p/9335724.html
Redis
# cd app/redis-3.2.8/
# make
# make install
If KNI is enabled in the configuration file, you should create a virtual NIC after F-Stack started, and set the ipaddr, netmask, mac addr, route table, etc. These addrs must be same with F-Stack.
If you don't have another management port, you should execute a script like this.
/usr/local/nginx_fstack/sbin/nginx
sleep 10
ifconfig veth0
route add -net 0.0.0.0 gw
route add -net ... # other route rules