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 ...
随机推荐
- Node<T> 的作用
Java中常见到以下定义的类 public class Node<T> { T data; public Node<T> next; Node(T data) { this.d ...
- 【BZOJ4008】[HNOI2015]亚瑟王(动态规划)
[BZOJ4008][HNOI2015]亚瑟王(动态规划) 题面 BZOJ 洛谷 题解 设\(f[i][j]\)表示前\(i\)张卡中有\(j\)张被触发的概率. 分两种情况转移,即当前这张是否被触发 ...
- JS基本类型-引用类型-深浅拷贝
在JavaScript中变量包含两种类型的值:一种是基本类型,一种是引用类型. 基本类型包括:数值.字符串.null.undefined.布尔值引用类型包括:对象.数组.函数.正则… 补充: null ...
- 【docker】docker安装和使用
一.docker简介: docker是容器技术的一个代表,而容器技术是将程序打包和隔离的一种技术,其实它并不是一个新技术,之前在linux内核中早已存在,真正被大众所用所了解是因为docker的出现. ...
- CentOS装个NTP时间同步服务器
服务端: driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 ...
- Nginx简易编译安装
1.下载Nginx: http://nginx.org/download/nginx-1.6.3.tar.gz 2.安装Pcre.Zlib.Openssl等相关组件: [root@track ngin ...
- P1637 三元上升子序列
thair 好,这个naive的东西因为只有三元,很好求解.只要把每个数之前小的L[i]与之后大的R[i]求一下即可. 求两次逆序对即可.那么答案便是∑(L[i]*R[i]); 对于更高元的,胡雨菲写 ...
- A1128. N Queens Puzzle
The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboar ...
- 用宏定义代替printf函数
来自:http://blog.csdn.net/yannanxiu/article/details/52506451 #define _DEBUG_ 1 #if _DEBUG_ #define PR( ...
- 第二十七节,IOU和非极大值抑制
你如何判断对象检测算法运作良好呢?在这一节中,你将了解到并交比函数,可以用来评价对象检测算法. 一 并交比(Intersection over union ) 在对象检测任务中,你希望能够同时定位对象 ...