search

Home  >  Q&A  >  body text

nginx - How to query mysql regularly in openresty's init_worker

I want to set up a timer in init_worker to query mysql information. I found that tcp connection cannot be used in init_worker, so how can I get mysql data in init_worker. I found a post on the Internet that said to call the shell command to obtain it. Is that the only way?

曾经蜡笔没有小新曾经蜡笔没有小新2780 days ago560

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 17:13:11

    You can use ngx.timer
    https://github.com/openresty/...

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-16 17:13:11

    You can use tcp in ngx.timer

    reply
    0
  • Cancelreply