Openresty 学习笔记(一)opm 工具的使用
1、自1.11.2.2开始,OpenResty版本已经包含并默认安装opm。所以通常你不需要自己安装opm。
2、我们在这里只需要做一个软连接就可以了
cd /usr/local/openresty/bin
sudo ln -s `pwd`/opm /usr/local/bin/opm
3、搜索指定软件包名称
www@TinywanAliYun:~$ opm search session
bungle/lua-resty-session Session Library for OpenResty - Flexible and Secure
4、搜索具有多个模式“lru”和“cache”的软件包名称和摘要。
www@TinywanAliYun:~$ opm search lru cache
openresty/lua-resty-lrucache Lua-land LRU Cache based on LuaJIT FFI
5、在一些作者的名字下安装名为lua-resty-logger-socket的软件包
www@TinywanAliYun:~$ opm get p0pr0ck5/lua-resty-logger-socket* Fetching p0pr0ck5/lua-resty-logger-socket
Downloading https://opm.openresty.org/api/pkg/tarball/p0pr0ck5/lua-resty-logger-socket-0.03.opm.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
--:--:-- --:--:-- --:--:--
Package p0pr0ck5/lua-resty-logger-socket 0.03 installed successfully under /usr/local/openresty/site/ .
结果在 /usr/local/openresty/lualib/resty 目录下没有这个文件下载下来
结果该文件默认下载到以下目录了
/usr/local/openresty/site/lualib/resty
编写代码测试
local uuid = require 'resty.jit-uuid'
ngx.say(uuid())
问题来了,项目中直接应用,报错,提示找不到该文件
[C]: in function 'require'
in function /status"
[error] 7626#7626: init_worker_by_lua error: init_worker_by_lua:2: module 'resty.jit-uuid' not found:
no field package.preload['resty.jit-uuid']
no file '/usr/local/openresty/lualib/resty/jit-uuid.lua'
no file '/usr/local/openresty/nginx/conf/waf/resty/jit-uuid.lua'
no file '/usr/local/openresty/lualib/resty/jit-uuid.so'
no file '/opt/verynginx/verynginx/lua_script/resty/jit-uuid.so'
no file '/usr/local/openresty/site/lualib/resty/jit-uuid.so'
no file '/usr/local/openresty/lualib/resty/jit-uuid.so'
如果复制到该目录下,则是可以正常访问的
/usr/local/openresty/lualib/resty
要想安装到以上目录
则在下载的时候指定安装目录就可以了
opm --install-dir=/usr/local/openresty get thibaultcha/lua-resty-jit-uuid
通过上面这种安装方式,直接在项目中就可以使用
参考
Openresty 学习笔记(一)opm 工具的使用的更多相关文章
- openresty 学习笔记二:获取请求数据
openresty 学习笔记二:获取请求数据 openresty 获取POST或者GET的请求参数.这个是要用openresty 做接口必须要做的事情.这里分几种类型:GET,POST(urlenco ...
- Oracle RAC学习笔记02-RAC维护工具集
Oracle RAC学习笔记02-RAC维护工具集 RAC维护工具集 1.节点层 2.网络层 3.集群层 4.应用层 本文实验环境: 10.2.0.5 Clusterware + RAC 11.2.0 ...
- 并发编程学习笔记(10)----并发工具类CyclicBarrier、Semaphore和Exchanger类的使用和原理
在jdk中,为并发编程提供了CyclicBarrier(栅栏),CountDownLatch(闭锁),Semaphore(信号量),Exchanger(数据交换)等工具类,我们在前面的学习中已经学习并 ...
- TensorFlow学习笔记2-性能分析工具
TensorFlow学习笔记2-性能分析工具 性能分析工具 在spyder中运行以下代码: import tensorflow as tf from tensorflow.python.client ...
- openresty 学习笔记小结:综合应用实例
openresty 学习笔记小结:综合应用实例 这个综合实验实现的功能其实很简单,用户访问一个页面,显示一个默认页面.输入参数(post或者get都可以),如果参数在数据库查询得到并满足一定条件,根据 ...
- openresty 学习笔记六:使用session库
openresty 学习笔记六:使用session库 lua-resty-session 是一个面向 OpenResty 的安全和灵活的 session 库,它实现了 Secure Cookie Pr ...
- openresty 学习笔记番外篇:python的一些扩展库
openresty 学习笔记番外篇:python的一些扩展库 要写一个可以使用的python程序还需要比如日志输出,读取配置文件,作为守护进程运行等 读取配置文件 使用自带的ConfigParser模 ...
- openresty 学习笔记番外篇:python访问RabbitMQ消息队列
openresty 学习笔记番外篇:python访问RabbitMQ消息队列 python使用pika扩展库操作RabbitMQ的流程梳理. 客户端连接到消息队列服务器,打开一个channel. 客户 ...
- openresty 学习笔记五:访问RabbitMQ消息队列
openresty 学习笔记五:访问RabbitMQ消息队列 之前通过比较选择,决定采用RabbitMQ这种消息队列来做中间件,目的舒缓是为了让整个架构的瓶颈环节.这里是做具体实施,用lua访问Rab ...
- openresty 学习笔记四:连接mysql和进行相关操作
openresty 学习笔记四:连接mysql和进行相关操作 毕竟redis是作为缓存,供程序的快速读写,虽然reidis也可以做持久化保存,但还是需要一个做数据存储的数据库.比如首次查询数据在red ...
随机推荐
- android startActivityForResult 使用实例
ActivityForResult.java public class ActivityForResult extends Activity { Button bn; EditText city; @ ...
- What can Reactive Streams offer EE4J?
https://developer.lightbend.com/blog/2018-02-06-reactive-streams-ee4j/index.html By James Roper (@jr ...
- Java collection 容器
http://www.codeceo.com/article/java-container-brief-introduction.html Java实用类库提供了一套相当完整的容器来帮助我们解决很多具 ...
- 洛谷P3185 分裂游戏
解:这个毒瘤...... 我们首先发现每一堆的个数对操作不产生影响,每个操作都是针对单个石子的. 所以等价于每个石子都是一个独立的游戏.把它们异或起来作为sg函数值即可. 单个石子的sg值,直接暴力计 ...
- React之Perf
import Perf from 'react-addons-perf' // ES6语法 var Perf = require('react-addons-perf') // ES5语法针对node ...
- 在views中引用UserProfile报错RuntimeError: Model class apps.users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
如图报错,在settings中,该加的也加了啊! 显然类似于网上最容易遇到的解决方案如下图,是没有任何意义的 只要在view中有 from .models import UserProfile,Ver ...
- 灰度发布/AB test
背景 互联网产品有一个特点,就是不停的升级,升级,再升级.一般采用敏捷开发的团队,基本上保持每周一次的发布频率,系统升级总是伴随着风险,新旧版本兼容的风险,用户使用习惯突然改变而造成用户流失的风险,系 ...
- 基本数据类型补充,深浅copy
#str s=' ' #只能是以至少一个空格组成的字符串(全空格) print(s.isspace()) #tuple 当元组只有一个元素组成,并没有",",则该元素是什么数据类型 ...
- 使用bedtools提取vcf多个位置的变异(extract multi-region of genotypes by bedtools)
1.下载安装bedtools: 2.生成bed文件:标准的bed文件格式如下: chr7 127471196 127472363 Pos1 0 + 127471196 127472363 255,0, ...
- NOIP 普及组 2012 寻宝(思维???)
传送门 https://www.cnblogs.com/violet-acmer/p/9937201.html 题解: 一开始用暴力查找下一个要去的房间,超时了,emmmmm....... 然后,就稍 ...