简体   繁体   English

使用Lua脚本运行HAProxy

[英]Running HAProxy with Lua Scripts

I am trying to build HAProxy-1.9 with USE_LUA=1 flag to enable lua support. 我正在尝试使用USE_LUA=1标志构建HAProxy-1.9以启用lua支持。 This the make command I am using: 我正在使用的make命令:

sudo make TARGET=linux USE_DL=1 USE_CRYPT_H=1 USE_LUA=1 LUA_LIB=/usr/bin/lua5.3 LUA_INC=/usr/include/lua5.3/ LUA_LIB_NAME=lua53

When I execute the make command I receive the following error: 执行make命令时,出现以下错误:

  LD      haproxy
 /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: cannot find -llua53
 collect2: error: ld returned 1 exit status
 make: *** [Makefile:976: haproxy] Error 1

From what I have gathered it seems that a one of the library file (guessing a socket file) is either missing or, I have provided a wrong directory. 从我收集到的信息来看,似乎缺少一个库文件(猜测一个套接字文件),或者我提供了错误的目录。 I am using OpenSuse Tumbleweed . 我正在使用OpenSuse Tumbleweed

EDIT 1 编辑1

I was able to make haproxy from source by changing TARGET=linux to TARGET=generic . 通过将TARGET=linux更改为TARGET=generic我能够从源代码获得haproxy After the make file stopped, no errors were reported on stdout. 生成文件停止后,在stdout上未报告任何错误。 However, haproxy.service was not installed. 但是,未安装haproxy.service

I previously had haproxy installed using zypper . 我以前使用zypper安装了haproxy。 The only reason I removed it was to reinstall it with USE_LUA=1 flag because I was not sure whether it was possible to edit haproxy post compilation to change a compile time configuration. 我删除它的唯一原因是使用USE_LUA=1标志重新安装它,因为我不确定是否可以编辑haproxy post编译来更改编译时间配置。

After reinstalling, it is working. 重新安装后,它可以正常工作。 However, I believe there is an error with lua-load . 但是,我相信lua-load存在错误。 When I try lua-load /usr/share/haproxy/auth-request.lua I get the following error from running journalctl -xe: error in lua file '/tmp/auth-request.lua': cannot open /tmp/auth-request.lua: Permission denied . 当我尝试lua-load /usr/share/haproxy/auth-request.lua我从运行journalctl -xe: error in lua file '/tmp/auth-request.lua': cannot open /tmp/auth-request.lua: Permission denied收到以下错误journalctl -xe: error in lua file '/tmp/auth-request.lua': cannot open /tmp/auth-request.lua: Permission denied The permission set on the file was haproxy:haproxy as in the haproxy.cfg file. haproxy.cfg文件一样,在文件上设置的权限为haproxy:haproxy I have tried also tried modifying user root group root in haproxy.cfg and chown /tmp/auth-request.lua root:root . 我也尝试过尝试修改haproxy.cfgchown /tmp/auth-request.lua root:root user root group root chown /tmp/auth-request.lua root:root The error is still there. 错误仍然存​​在。

I may have deviated somewhat from the original question. 我可能与原始问题有所不同。 I would appreciate it is still possible to solve this problem. 我希望仍然有可能解决此问题。 If more information or context is required, it can be provided. 如果需要更多信息或上下文,则可以提供。

EDIT 2 编辑2

Most recently I tried adding read and execute permissions for all users on /tmp/auth-request.lua . 最近,我尝试在/tmp/auth-request.lua上为所有用户添加读取和执行权限。 ls -l output: ls -l输出:

-rwxr-xr-x 1 root root 3957 Feb 25 02:24 /tmp/auth-request.lua

Okay after some painstaking hours, I was able to fix the permission issue as per EDIT 2 in the post. 辛苦了几个小时,好了,我能够按照帖子中的EDIT 2来解决权限问题。 I moved my Lua script to the haproxy config directory and that seemed to have worked. 我将我的Lua脚本移到了haproxy config目录,这似乎行得通。 Although, I am not too sure whether /etc/haproxy is a good location to keep Lua scripts but, for now it has worked. 虽然,我不太确定/etc/haproxy是否是保留Lua脚本的好位置,但是到目前为止,它已经起作用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM