Docker Percona failed to start when set INIT_TOKUDB=1

I have tried to pull percona offical image:

docker pull percona

Then run:

docker run -d --name percona_test -e MYSQL_USER=test -e MYSQL_PASSWORD=test -e MYSQL_ROOT_PASSWORD=root -e INIT_TOKUDB=1 percona

The container failed to start and the log shows below error:

INFO: TokuDB engine plugin is not installed.

Disabling transparent huge pages for the current session…

/usr/bin/ps-admin: line 708: /sys/kernel/mm/transparent_hugepage/defrag: Read-only file system

/usr/bin/ps-admin: line 711: /sys/kernel/mm/transparent_hugepage/enabled: Read-only file system

ERROR: Failed to disable transparent huge pages for this session.

I have tried 5.7 and 8.0 version, both not working.

Any suggestions?

Thanks!

Hi,

TokuDB requires transparent_hugepages to be disabled (https://www.percona.com/doc/percona-server/8.0/tokudb/tokudb_installation.html#prerequisites). Process in the docker container doesn’t have enough permissions to disable them. Can you please run:

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag

as root (or with sudo) and try again.

Hi @nickzren

As docker is using kernel from the host system you should disable transparent_hugepages on the host system and after that you should be able to enable TokuDB in docker

Just FYI, you should not be designing any new applications based upon TokuDB as it is deprecated and will be removed in a future version https://www.percona.com/doc/percona-server/LATEST/tokudb/tokudb_intro.html#tokudb-introduction

George O. Lorch III

Director of Server Engineering, Percona Server for MySQL, Percona XtraDB Cluster, and Percona XtraBackup

I failed to run "

  1. echo never > /sys/kernel/mm/transparent_hugepage/enabled" because that's readonly file and container does not allow "sudo"
  2. How to disable transparent_hugepages on the host system?
  3. We have been used Percona TokuDB in production for years, we would like to setup a Docker version.

I have tried below unofficial version Docker for Percona TokuDB image, and it works:

Docker Hub

And also, I have access the container, it has not disabled transparent_hugepages, so the installation procedure is different? Any clues? Thanks!

Hi @nickzrenAs I already wrote:

Docker container doesn’t have it’s own kernel and works with host’s kernel. Host machine is the machine where you run your dockers.

To disable them on host you should do the same actions if it is Linux box.

For example I am running ubuntu 18.04 on my host

So I executed

sudo -s
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
exit

After that I was able to run the docker image with enabled TokuDB successfully.

As for the image bestmike007/percona-tokudb

I have checked it and found the following:

1 it contains old Percona Server 5.7.21 (the latest available Percona Server for MySQL is 5.7.32)

2 Yes it doesn’t require to disable THP but our recommendation is to disable it

3 It starts with root as default user which is insecure

So my suggestion would be disable THP and use official image

Thank you Evgeniy for the advice.

I’m actually working the test version on my Mac not linux box. Do you by chance knowing how to disable THP on Mac OS?

Do you mean if I pull official Percona Server 5.7.21 , it might work? Thanks

@nickzren

I’m actually working the test version on my Mac not linux box. Do you by chance knowing how to disable THP on Mac OS?

I think this might help https://github.com/docker-library/redis/issues/55#issuecomment-368346882

Do you mean if I pull official Percona Server 5.7.21 , it might work?

No, it is required to disable THP for Percona Server. So it doesn’t matter what version it should be. The image bestmike007/percona-tokudb is created incorrectly.

Thanks a lot Evgeniy!

Actually there is a bug since version 2.3.0.4 of Docker Desktop for Mac, Screen is terminating…

I used the alternative method to access the Docker VM:

docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh

Then I can disable THP. Now I can run docker percona image with enabled TokuDB successfully.