nginx-lua taken rear redis key value when random array.

# Press millisecond value
math.randomseed(tostring(os.time()):reverse():sub(1, 7))
is assumed to take the value of two server ip, 13, 24,
action2={13,24}
if the number of array elements is greater than one
if (#action2) > 1 then
server ip reassign one of a plurality of element values in action2.
action2=action2[math.random(#action2)]
Aciton2 (server ip) after printing reassignment
print (action2)
end
can control their subsequent action2 = redis where one key / value, value number> 1 can be a random value, returns to the nginx

Guess you like

Origin blog.51cto.com/13801798/2462768