F-stack简介
- F-stack粘合了dpdk、用户态协议栈和nginx、redis,弥补了dpdk没有协议栈的不足,并用nginx、redis提供了一个调用应用程序的接口。
Quick Start
安装
clone F-Stack
1# mkdir /data/f-stack 2# git clone https://github.com/F-Stack/f-stack.git /data/f-stack
安装DPDK依赖
1# install libnuma-dev 2 3# yum install numactl-devel # on Centos 4# sudo apt-get install libnuma-dev # on Ubuntu 5 6# cd f-stack
编译 DPDK
-
打开配置脚本,在脚本中输入对应项的序号
cd dpdk/usertools
./dpdk-setup.sh
-
选择编译: x86_64-native-linuxapp-gcc
-
插入igb_uio
-
设置大页
-
绑定网卡
-
在 Ubuntu, 使用 gawk 而非 default mawk.
关闭 ASLR; 多核处理上必选
1echo 0 > /proc/sys/kernel/randomize_va_space 2 3 4# sudo apt-get install gawk 5# sudo update-alternatives --config awk //to choose gawk.
编译 F-Stack
1# export FF_PATH=/data/f-stack 2# export FF_DPDK=/data/f-stack/dpdk/x86_64-native-linuxapp-gcc 3# cd ../../lib/ 4# make
Nginx
1# cd app/nginx-1.11.10 2# bash ./configure --prefix=/usr/local/nginx_fstack --with-ff_module 3# make 4# make install 5# cd ../.. 6# /usr/local/nginx_fstack/sbin/nginx
如果此步编译出现问题:可见博客:https://www.cnblogs.com/vancasola/p/9335724.html
Redis
1# cd app/redis-3.2.8/ 2# make 3# 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 <ipaddr> netmask <netmask> broadcast <broadcast> hw ether <mac addr> route add -net 0.0.0.0 gw <gateway> dev veth0 route add -net ... # other route rules