How does metadata_expire parameter works?

Solution Unverified - Updated

Environment

Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 7

Issue

  • What is metadata_expire?
  • How does this parameter works?
  • How to change the metadata_expire value in /etc/yum.repos.d/redhat.repo using subscription-manager ?

Resolution

  • metadata_expire is the time (in seconds) after which the metadata will expire.

  • If the current metadata downloaded is less than this many seconds old then yum will not update the metadata against the repository. If yum is not downloading information on updates, then lower the value of this option.

  • The default of using seconds can be changed to using days, hours or minutes by appending a, d, h or m respectively. The default is 6 hours, to compliment yum-updatesd running once an hour. It's also possible to use the word "never", meaning that the metadata will never expire. Note that when using a metalink file the metalink must always be newer than the metadata for the repository, due to the validation, so this timeout also applies to the metalink file.

  • If metadata_expire parameter is set in yum.conf then RHSM based repositories which are defined in redhat.repo file will not take this parameter.

  • If metadata_expire is set for repository and its time interval has hit, then 'yum repolist' will show '!' infront of repository name
    At times, 'yum repolist' does not re-download repodata but instead any yum transaction like 'yum update' will make re-download of repodata.

  • When metatdata_expire interval is hit it does not re-download repodata each time. If there is change in repodata on the server side then it re-downloads it.

  • To override the values in /etc/yum.repos.d/redhat.repo file, 'repo-override' option can be used with subscription-manager.

# subscription-manager repo-override --repo=rhel-7-server-rpms --add=metadata_expire:5s

For more information:
# subscription-manager repo-override --help
SBR
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.