1
0

job_cache.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .. _managing_the_job_cache:
  2. ======================
  3. Managing the Job Cache
  4. ======================
  5. The Salt Master maintains a job cache of all job executions which can be
  6. queried via the jobs runner. This job cache is called the Default Job Cache.
  7. .. _default_job_cache:
  8. Default Job Cache
  9. =================
  10. A number of options are available when configuring the job cache. The default
  11. caching system uses local storage on the Salt Master and can be found in the
  12. job cache directory (on Linux systems this is typically
  13. ``/var/cache/salt/master/jobs``). The default caching system is suitable for most
  14. deployments as it does not typically require any further configuration or
  15. management.
  16. The default job cache is a temporary cache and jobs will be stored for 24
  17. hours. If the default cache needs to store jobs for a different period the
  18. time can be easily adjusted by changing the ``keep_jobs`` parameter in the
  19. Salt Master configuration file. The value passed in is measured via hours:
  20. .. code-block:: yaml
  21. keep_jobs: 24
  22. Reducing the Size of the Default Job Cache
  23. ------------------------------------------
  24. The Default Job Cache can sometimes be a burden on larger deployments (over 5000
  25. minions). Disabling the job cache will make previously executed jobs unavailable
  26. to the jobs system and is not generally recommended. Normally it is wise to make
  27. sure the master has access to a faster IO system or a tmpfs is mounted to the
  28. jobs dir.
  29. However, you can disable the :conf_master:`job_cache` by setting it to ``False``
  30. in the Salt Master configuration file. Setting this value to ``False`` means that
  31. the Salt Master will no longer cache minion returns, but a JID directory and ``jid``
  32. file for each job will still be created. This JID directory is necessary for
  33. checking for and preventing JID collisions.
  34. The default location for the job cache is in the ``/var/cache/salt/master/jobs/``
  35. directory.
  36. Setting the :conf_master:`job_cache` to ``False`` in addition to setting
  37. the :conf_master:`keep_jobs` option to a smaller value, such as ``1``, in the Salt
  38. Master configuration file will reduce the size of the Default Job Cache, and thus
  39. the burden on the Salt Master.
  40. .. note::
  41. Changing the ``keep_jobs`` option sets the number of hours to keep old job
  42. information and defaults to ``24`` hours. Do not set this value to ``0`` when
  43. trying to make the cache cleaner run more frequently, as this means the cache
  44. cleaner will never run.
  45. Additional Job Cache Options
  46. ============================
  47. Many deployments may wish to use an external database to maintain a long term
  48. register of executed jobs. Salt comes with two main mechanisms to do this, the
  49. master job cache and the external job cache.
  50. See :ref:`Storing Job Results in an External System <external-job-cache>`.