lua

灰度发布浅析

╄→尐↘猪︶ㄣ 提交于 2020-12-08 09:57:25
定义 灰度发布就是已一种平滑过渡的方式来发布,通过切换线上新旧版本之间的路由权重,逐步从旧版本切换到新版本;比如要上线新功能,首先只是更新少量的服务节点,通过路由权重,让少部分用户体验新版本,如果没有什么问题,再更新所有服务节点;这样可以在出现问题把影响面降到最低,保证了系统的稳定性。 灰度发布 一个系统往往有接入层比如nginx(Openresty),网关层比如zuul,以及服务层比如各种rpc框架;在这几层都有路由功能,也就是说这几层都可以做灰度;接入层可以使用nginx+lua来实现灰度,网关层zuul可以结合ribbon来实现灰度,rpc框架如dubbo本身提供了路由功能可以直接做灰度处理;下面看看具体如何去实现; 接入层灰度 接入层我们这里使用功能更强大的Openresty,然后使用lua进行路由转发,相关的路由策略可以配置在分布式缓存redis里面,当然也可以持久化到数据库里面; 准备 准备一台Openresty,两台web服务器tomcat(端口分别是8081,8082),以及redis;为了方便模拟在redis里面配置白名单,如果在白名单里面就走8082,不在则走8081; Openresty配置 需要在Openresty中配置支持lua,以及相关路由的lua脚本,nginx.conf配置如下: http { ... lua_package_path "

Im trying to figure out how I can decompile this obfuscated Lua script

孤街浪徒 提交于 2020-12-08 05:16:09
问题 So I've been trying to figure out how to decompile dlls, java, and Lua files but once I ran into this one I got stumped. Does anyone have any ideas on how I can decompile this? Since the script was way too big I put it in a pastebin link. https://pastebin.com/UsdWEHnm IlIIl1liIllIi1II1Ii.lIl1llIllIii1111lIIIii = lIli1IlI11lIlI1il11i1() lIli1IlI11lIlI1il11i1() lIli1IlI11lIlI1il11i1() local ll1ili1i1Ii1II111li = lIlIlll1Ill1illiliIiI() for i1IiIili111iI1lil1l = lIliI1iii11lilII1IIil,

Im trying to figure out how I can decompile this obfuscated Lua script

为君一笑 提交于 2020-12-08 05:14:50
问题 So I've been trying to figure out how to decompile dlls, java, and Lua files but once I ran into this one I got stumped. Does anyone have any ideas on how I can decompile this? Since the script was way too big I put it in a pastebin link. https://pastebin.com/UsdWEHnm IlIIl1liIllIi1II1Ii.lIl1llIllIii1111lIIIii = lIli1IlI11lIlI1il11i1() lIli1IlI11lIlI1il11i1() lIli1IlI11lIlI1il11i1() local ll1ili1i1Ii1II111li = lIlIlll1Ill1illiliIiI() for i1IiIili111iI1lil1l = lIliI1iii11lilII1IIil,

what do 'load' do in Lua?

二次信任 提交于 2020-12-07 08:27:07
问题 I was Trying to sove my problem in understanding load function in Lua Scripts but there was not any Examples or guides for this command . it tells in his own Lua Website https://www.lua.org/manual/5.2/manual.html#pdf-load this : load (ld [, source [, mode [, env]]]) can someone describe it to me please ? 回答1: load takes a chunk, compiles it, and returns as a function that can be called to execute the chunk. For example, the following will create a function that will add two numbers together:

what do 'load' do in Lua?

蓝咒 提交于 2020-12-07 08:26:59
问题 I was Trying to sove my problem in understanding load function in Lua Scripts but there was not any Examples or guides for this command . it tells in his own Lua Website https://www.lua.org/manual/5.2/manual.html#pdf-load this : load (ld [, source [, mode [, env]]]) can someone describe it to me please ? 回答1: load takes a chunk, compiles it, and returns as a function that can be called to execute the chunk. For example, the following will create a function that will add two numbers together:

what do 'load' do in Lua?

送分小仙女□ 提交于 2020-12-07 08:26:17
问题 I was Trying to sove my problem in understanding load function in Lua Scripts but there was not any Examples or guides for this command . it tells in his own Lua Website https://www.lua.org/manual/5.2/manual.html#pdf-load this : load (ld [, source [, mode [, env]]]) can someone describe it to me please ? 回答1: load takes a chunk, compiles it, and returns as a function that can be called to execute the chunk. For example, the following will create a function that will add two numbers together:

redis(一)内部机制的介绍和启动过程

允我心安 提交于 2020-12-06 18:18:11
redis(一)内部机制的介绍和启动过程 redis的基本介绍 redis服务端 redis客户端 redis的持久化 redis中的文件事件和时间时间 redis的启动过程 redis的基本介绍 redis是一种非关系型数据库,采用=key,value的形式来存储数据。key是二进制数据,对于value的数据类型,redis支持string、hash、list、set、sorted set五种类型。 对于单个redis实例,内部使用多线程通信,但是对外采用RESP单线程通信协议 ,在TCP层通过二进制方式进行传输数据,单线程采用同步的请求方式 。 redis服务端 redis服务端内部结构为struct redisServer和struct redisDb。redis中默认16个数据库,可以通过配置来修改数据库数量,每一个数据库对应一个redisDb。数据库之间的数据是相互独立的。查询数据的时候,可以通过select指定具体某个数据库。 1 struct redisServer { 2 int dbnum; // 服务器的数据库数量,值由服务器配置的“databases”选项决定,默认为16 3 redisDb *db; // 数组,保存着服务器中的所有数据库 4 5 list *clients; // 一个链表,保存了所有客户端状态,每个链表元素都是“redisClient

Lua 笔记

谁说我不能喝 提交于 2020-12-05 19:24:01
##Lua 笔记 ####下载 官网下载: lua官网地址 下载源码。 解压安装: tar zxvf lua-5.2.1.tar.gz 然后修改下 Makefile 文件, 修改其中的安装地址: # 安装的地址,以下的bin ,include lib 等都基于这个 INATALL_TOP=/usr/local/lua 然后进行 make 但是会发现有提示错误,提示没加平台的参数,这时根据提示的平台名称加在 make之后就可以了 make linux make install ####执行脚本 这样就安装好了,开始第一个hello world 吧 cd /usr/local/lua/bin ./lua print 'hello world' 看见输出结果了吧。其实有三种方法来执行lua脚本。 第一种就是 上面的例子,在终端里的lua bin目录里输入./lua,进入控制台来执行lua 语句。 进入控制台的标志是前面有个 > 第二种 是执行单独的脚本文件,后缀名是 .lua touch my.lua -- lua 的注释就是两个- print 'hello world' 然后也是在bin目录里 执行这个文件 ./lua my.lua 也看到结果了吧 第三种方法 lua 是支持编译的,当你不想让别人看到你的程序的源码的话 ,你可以编译先,然后再执行

lua学习笔记

大兔子大兔子 提交于 2020-12-05 19:23:38
1. 在控制结构的条件中除了 false 和 nil 为假,其他值都为真。所以 Lua 认为 0 和空串都是真. 2. Lua 中字符串是不可以修改的,你可以创建一个新的变量存放你要的字符串. 3. ..在 Lua 中是字符串连接符,当在一个数字后面写..时,必须加上空格以防止被解释错. 4. and 和 or 的运算结果不是 true 和 false,而是和它的两个操作数相关. a and b --如果a为false,则返回a,否则返回b a or b --如果a为true,则返回a,否则返回b print(4 and 5) --> 5 print(nil and 13) --> nil print(false and 13) --> false print(4 or 5) --> 4 print(false or 5) --> 5 一个很实用的技巧:如果 x 为 false 或者 nil 则给 x 赋初始值 v x = x or v 等价于 if not x then x = v end C 语言中的三元运算符 a ? b : c 在 Lua 中可以这样实现: (a and b) or c lua的.和:的区别,.默认函数需要自己传self,:不需要 来源: oschina 链接: https://my.oschina.net/u/941259/blog/482115

lua笔记

∥☆過路亽.° 提交于 2020-12-05 18:43:52
1,命名规范: 区分大小写; 2,动态类型语言,在语言中没有类型定义的语法,每个值本身就包含了类型信息。对于一个变量来说,它的值的类型是可以随时变换的。 基础类型: nil 空 boolean 布尔 只有 false和nil为假,其它为真 number 数字 不论浮点数还是整形都是number类型。 string字符串 function 函数 table 表 userdata 自定义数据类型 thread 线程 类型检测: print(type(var)) ->nil var = 20 print(type(var)) -> number var = print print(type(var)) -> function var = {} print(type(var)) -> table 来源: oschina 链接: https://my.oschina.net/u/856051/blog/2253308