debug_syntax.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .. _debug_syntax:
  2. DEBUG syntax
  3. ------------
  4. .. code-block:: none
  5. DEBUG [ subcommand ]
  6. DEBUG statement is designed to call different internal or vip commands for dev/testing purposes. It is not intended
  7. for production automation, since the syntax of ``subcommand`` part may be freely changed in any build.
  8. Call ``DEBUG`` without params to show list of useful commands (in general) and subcommands (of ``DEBUG`` statement) available
  9. at the moment.
  10. However you can invoke ``DEBUG`` without params to know which subcommands of the statement are available in any particular case:
  11. .. code-block:: mysql
  12. mysql> debug;
  13. +----------------+---------------------+
  14. | command | meaning |
  15. +----------------+---------------------+
  16. | flush logs | emulate USR1 signal |
  17. | reload indexes | emulate HUP signal |
  18. +----------------+---------------------+
  19. 2 rows in set (0,00 sec)
  20. (these commands are already documented, but such short help just remind about them).
  21. If you connect via 'VIP' connection (see :ref:`listen` for details) the output might be a bit different:
  22. .. code-block:: mysql
  23. mysql> debug;
  24. +---------------------------+------------------------------+
  25. | command | meaning |
  26. +---------------------------+------------------------------+
  27. | debug shutdown <password> | emulate TERM signal |
  28. | debug token <password> | calculate token for password |
  29. | flush logs | emulate USR1 signal |
  30. | reload indexes | emulate HUP signal |
  31. +---------------------------+------------------------------+
  32. 4 rows in set (0,00 sec)
  33. Here you can see additional commands available only in the current context (namely, if you connected on a VIP port).
  34. Two additional subcommands available right now are ``token`` and ``shutdown``.
  35. The first one just calculates a hash (SHA1) of the <password> (which, in turn, may be empty, or a word, or num/phrase enclosed in
  36. '-quotes) like:
  37. .. code-block:: mysql
  38. mysql> debug token hello;
  39. +-------------+------------------------------------------+
  40. | command | result |
  41. +-------------+------------------------------------------+
  42. | debug token | aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d |
  43. +-------------+------------------------------------------+
  44. 1 row in set (0,00 sec)
  45. Another debug subcommand ``shutdown`` will send a TERM signal to the daemon and so will make it shut down.
  46. Since it is quite dangerous (nobody wants accidentally stop a production service), it 1) needs a VIP connection, and 2) needs
  47. the password. For the chosen password you need to generate a token with ``debug token`` subcommand, and put it into
  48. ref:`shutdown_token` param of searchd section of the config file. If no such section exists, or if a hash of the provided
  49. password does not match with the token stored in the config, the subcommand will do nothing. Otherwise it will cause 'clean' shutdown
  50. of the daemon.