Closed kushalkh closed 7 years ago
@kushalkh Instead of this
if not cluster then
ngx.say(ngx.ERR, 'could not create cluster: ', err)
ngx.exit(200)
else
local rows = cluster.execute("SELECT uid FROM tableName where sid = ? limit 1", {sid})
end
could you do this
if err ~= nil then
ngx.say(ngx.ERR, 'could not create cluster: ', err)
ngx.exit(200)
else
local rows = cluster.execute("SELECT uid FROM tableName where sid = ? limit 1", {sid})
end
And then send the output?
Hi @avadhutp
The error actually pops up when "execute" function is called. There is no error in creating the cluster connection so it always goes into the else statement and tries executing the query.
Thanks for taking a look at this. Looking forward to further advise.
On a side note, i'm able to get single server connection and execute query perfectly. I'm seeing this error only on cluster module.
@kushalkh You need to call functions like so: cluster:execute()
and not cluster.execute()
. I suggest you spend some time reading a bit about the Lua syntax :)
Hi,
I'm trying to use the cluster module as mentioned in the usage. Here is my code:
I'm seeing an error on execute command. Error:
2017/04/17 17:00:18 [error] 28879#28879: *68 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/cassandra/cluster.lua:837: attempt to call method 'refresh' (a nil value) stack traceback: coroutine 0: /usr/local/openresty/lualib/resty/cassandra/cluster.lua: in function </usr/local/openresty/lualib/resty/cassandra/cluster.lua:835>
What could i be missing? I installed it like it was mentioned.