How to solve the "Failed opening the RDB file dump.rdb"?

Solution Verified - Updated -

Issue

  • Meet the error "Failed opening the RDB file dump.rdb" in /var/log/redis/redis.log.
3582387:C 26 Sep 2023 17:14:37.379 # Failed opening the RDB file dump.rdb (in server root dir /var/lib/redis) for saving: Permission denied
3494770:M 26 Sep 2023 17:14:37.781 # Background saving error
  • Meet the setroubleshoot report in /var/log/messages if setroubleshoot is enabled in the server.
Sep 26 17:06:08 localhost setroubleshoot[xxxxx]: SELinux is preventing /usr/bin/redis-server from search access on the directory /var/lib/redis.#012#012*****  Plugin restorecon (54.2 confidence) suggests   ************************#012#012If you want to fix the label. #012/var/lib/redis default label should be redis_var_lib_t.#012Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.#012Do#012# /sbin/restorecon -v /var/lib/redis#012#012*****  Plugin file (16.6 confidence) suggests   ******************************#012#012This is caused by a newly created file system.#012Then you need to add labels to it.#012Do#012/sbin/r
estorecon -R -v /var/lib/redis#012#012*****  Plugin file (16.6 confidence) suggests   ******************************#012#012If you think this is caused by a badly mislabeled machine.#
  • Can't choose the single host item in grafana for PCP.

Environment

  • Red Hat Enterprise Linux 7,8,9
  • Redis
  • Selinux enable

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content