依赖软件版本
- tengine-2.3.2
- lua-5.1.5-coco (openresty-1.13.6.2中集成的版本,在lua-5.1.5的基础上打了补丁 LuaCoco-1.1.9)
- LuaCoco-1.1.9
- redis-5.0.8
- lua-cjson-2.1.0.6 (openresty-1.13.6.2中集成的版本,bundle下面)
- LuaJIT-2.1-20180420 (openresty-1.13.6.2中集成的版本,bundle下面)
- lua-rds-parser-0.06 (openresty-1.13.6.2中集成的版本,bundle下面)
- lua-redis-parser-0.13 (openresty-1.13.6.2中集成的版本,bundle下面)
安装步骤
依赖库安装
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc g++ gcc-c++ gd-devel libuuid-devel && yum install readline-devel && yum -y install patch && yum -y install libxslt-devel && yum -y install perl-devel perl-ExtUtils-Embed && sudo yum install -y GeoIP-devel.x86_64
lua-5.1.5 安装
- cd …/openresty-1.13.6.2/bundle/lua-5.1.5
- make linux
- make install
lua-5.1.5安装补丁
- tar -zxvf LuaCoco-1.1.9
- mv lua-5.1.5 lua-5.1.5-coco
- cd lua-5.1.5-coco
- patch -p1 …/LuaCoco-1.1.9/lua-5.1.5-coco-1.1.9.patch
- make linux
- make install
- ./src/lua …/LuaCoco-1.1.9/test/cotest.lua(看到成功表示补丁包安装成功)
LuaJIT-2.1-20180420安装
- cd openresty-1.13.6.2/bundle/LuaJIT-2.1-20180420
- make PREFIX=/usr/local/luajit install
- export LUAJIT_LIB=/usr/local/luajit/lib 环境变量设置
- export LUAJIT_INC=/usr/local/luajit/include/luajit-2.1 环境变量设置
- 这里还可以设置一下动态库,不设置也不会报错,不过切换到别的账号启动你的tengine会找不到动态库,还是手动设置一下,cd /etc/ld.so.conf.d && touch luajitlib.conf && vim luajitlib.conf 写上/usr/local/luajit install后esc退出:wq保存即可
lua-cjson-2.1.0.6安装
- openresty-1.13.6.2/bundle/lua-cjson-2.1.0.6
- make && make instlal
- cp cjson.so /usr/lib64/lua/5.1/cjson.so 复制库文件
lua-rds-parser-0.06安装
- make && make install
lua-redis-parser-0.13
- make && make install
ABTestingGateway安装
- git clone https://github.com/SinaMSRE/ABTestingGateway
redis-5.0.8 安装
- tar -zxvf redis-5.0.8.tar.gz
- cd redis-5.0.8
- make install
- cp /usr/ABTestingGateway/utils/conf/redis.conf /usr/redis-5.0.8/redis.conf 将ABTestingGateway里面的redis.conf复制到redis里面,因为有一些配置需要配置,我这里不想配置了,就直接复制过去,具体配置有什么用看下ABTestingGateway的doc下面的文件就明白了
- 修改redis.config里面的daemonize yes
- Q.redis启动 ./src/redis-server …/redis.conf
- R.修改/usr/ABTestingGateway/utils/conf/vhost.conf里面的redis链接,如果是同一台服务器,可以不改
tengine-2.3.2 安装
- tar -zxvf tengine-2.3.3.tar.gz
- cd tengine-2.3.3
- ./configure --user=www --group=www
–prefix=/data/tengine/nginx
–with-http_stub_status_module
–with-http_ssl_module
–with-http_v2_module
–with-http_realip_module
–with-http_gzip_static_module
–with-mail
–with-mail_ssl_module
–add-module=./modules/ngx_http_upstream_check_module
–add-module=./modules/ngx_http_upstream_session_sticky_module
–add-module=./modules/ngx_http_user_agent_module
–add-module=./modules/ngx_http_footer_filter_module
–add-module=./modules/ngx_http_proxy_connect_module
–add-module=./modules/ngx_http_trim_filter_module
–add-module=./modules/ngx_http_upstream_consistent_hash_module
–add-module=./modules/ngx_http_upstream_dynamic_module
–add-module=./modules/ngx_http_reqstat_module
–add-module=./modules/ngx_http_headers_more_filter_module
–add-module=./modules/incubator-pagespeed-ngx-1.13.35.2-stable
–add-module=./modules/ngx_http_upstream_dyups_module
–add-module=./modules/ngx_multi_upstream_module
–add-module=./modules/ngx_http_concat_module
–add-module=…/openresty-1.13.6.2/bundle/ngx_lua-0.10.13
–add-module=…/openresty-1.13.6.2/bundle/ngx_devel_kit-0.3.0
–add-module=…/openresty-1.13.6.2/bundle/rds-csv-nginx-module-0.09
–add-module=…/openresty-1.13.6.2/bundle/rds-json-nginx-module-0.15
–add-module=…/openresty-1.13.6.2/bundle/redis2-nginx-module-0.15
–add-module=…/openresty-1.13.6.2/bundle/redis-nginx-module-0.3.7
–add-module=…/openresty-1.13.6.2/bundle/encrypted-session-nginx-module-0.08
–add-module=…/openresty-1.13.6.2/bundle/form-input-nginx-module-0.12
–add-module=…/openresty-1.13.6.2/bundle/iconv-nginx-module-0.14
–add-module=…/openresty-1.13.6.2/bundle/ngx_lua_upstream-0.07
–add-module=…/openresty-1.13.6.2/bundle/srcache-nginx-module-0 - make
- make install
应用测试
安装完成后,进入ABTestingGateway文件夹,可以看到abtesting.sh和shutdownabtesting.sh两个文件,修改里面的ngnix指向刚刚tengine安装的ngnix文件中的路径,启动即可
后面关于怎么配置策略,参看doc下面的文档,描述很详细