MySQL Enterprise Edition on official docker image
商用版のライセンスを利用者が別途準備する事で(Bring Your Own License)商用版のMySQLをDockerで利用する事が可能です。
https://blogs.oracle.com/mysql/mysql-enterprise-edition-now-in-docker-store
MySQLライセンスについては此方を参照下さい。
https://www.mysql.com/jp/products/
物理サーバーライセンスなので、Dockerを複数立ち上げるような開発環境ではコストメリットが大きいかと思います。
STEP1: Dockerストアにアクセス
https://store.docker.com
https://store.docker.com/images/mysql-enterprise-server
STEP2:Checkoutに進むと以下のように入力が画面が出てくるので、必要な入力項目を入れて下さい。
STEP3: Checkoutするとインストール方法とイメージのPULL用URLが表示されます。
STEP4: 利用可能パッケージの確認
自分のアカウントで利用可能な、パッケージが以下のURLにアクセスする事が出来ます。
https://store.docker.com/profiles/{DockerID}/content
STEP5: ここからは実際にイメージをダウンロードして初期設定後に環境の確認をしてみます。
[root@DockerHost oracle]# docker login Username: myaccount Password: Email: my.private@variable.jp WARNING: login credentials saved in /root/.docker/config.json Login Succeeded [root@DockerHost oracle]# docker pull store/oracle/mysql-enterprise-server:5.7 5.7: Pulling from store/oracle/mysql-enterprise-server 0a8af4fbe73a: Pull complete f8726cc27fe2: Pull complete fae37bbdd736: Pull complete 39a334372a33: Pull complete f9c82196334c: Pull complete ef578d7130a0: Pull complete 847fdfc5f5d7: Pull complete 8e21b593de13: Pull complete 5b0a6ab7d9e4: Pull complete 99091fe3cf31: Pull complete 483de1c4dc82: Pull complete f7d4675ff63d: Pull complete c41819234bbd: Pull complete Digest: sha256:09a6201fe690055c450f7e17a94efc4f10ae38b2607242abae191e3b283698f5 Status: Downloaded newer image for store/oracle/mysql-enterprise-server:5.7 [root@DockerHost oracle]#
あとで、設定を適宜変更したいのでデータやオプションファイルのパスを指定してインスタンスの初期化を行っています。
[root@DockerHost oracle]# docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE store/oracle/mysql-enterprise-server 5.7 c41819234bbd 13 days ago 246.9 MB mysql/mysql-server 8.0 270395aafb1e 3 months ago 295.3 MB mysql 5.7.15 3dd6dfe65426 15 months ago 383.4 MB mysql/mysql-server 5.7.15 de24da03ab76 15 months ago 369.1 MB [root@DockerHost oracle]# [root@DockerHost docker57ee]# docker run --name=mysql57ee -v /docker/option57ee/my.cnf:/etc/my.cnf -v /docker/docker57ee:/var/lib/mysql -e MYSQL_RANDOM_ROOT_PASSWORD=true -e MYSQL_ONETIME_PASSWORD=true -d store/oracle/mysql-enterprise-server:5.7 9ea25f5c1df4a6045197d3adac2e123faa404b538919775cc6269e0d0556a921 [root@DockerHost docker57ee]# docker logs mysql57ee [Entrypoint] MySQL Docker Image 5.7.20-1.1.2 <SNIP> [Entrypoint] GENERATED ROOT PASSWORD: hUmv@v+EgFopmUcZIr-yqegLOn [root@DockerHost docker57ee]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 38347f04b6b7 store/oracle/mysql-enterprise-server:5.7 "/entrypoint.sh mysql" 4 minutes ago Up 4 minutes 3306/tcp, 33060/tcp mysql57ee ecd2156cdd36 mysql/mysql-server:8.0 "/entrypoint.sh mysql" 12 weeks ago Exited (0) 19 minutes ago mysql83 d92d218ffff6 mysql/mysql-server:5.7.15 "/entrypoint.sh mysql" 15 months ago Exited (0) 8 months ago multi_docker05 7e9de9a905ad mysql/mysql-server:5.7.15 "/entrypoint.sh mysql" 15 months ago Exited (0) 15 months ago multi_docker04 fb1c8aaf8de7 mysql/mysql-server:5.7.15 "/entrypoint.sh mysql" 15 months ago Exited (0) 14 months ago multi_docker03 [root@DockerHost docker57ee]#
ログインして、初期パスワードを変更後にバージョンとプラグインを確認。
現状ではプラグインを設定してないのでロードはされてませんが、モジュールが存在するところまで確認してあります。
[root@DockerHost docker57ee]# docker exec -it mysql57ee mysql --default-character-set=utf8mb4 -uroot -phUmv@v+EgFopmUcZIr-yqegLOn mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.20-enterprise-commercial-advanced-log Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. root@localhost [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql'; Query OK, 0 rows affected (0.01 sec) root@localhost [(none)]> select user,host from mysql.user; +---------------+-----------+ | user | host | +---------------+-----------+ | healthchecker | localhost | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +---------------+-----------+ 4 rows in set (0.00 sec) root@localhost [(none)]> select @@version; +-------------------------------------------+ | @@version | +-------------------------------------------+ | 5.7.20-enterprise-commercial-advanced-log | +-------------------------------------------+ 1 row in set (0.00 sec) root@localhost [(none)]> show variables like 'plugin%'; +---------------+--------------------------+ | Variable_name | Value | +---------------+--------------------------+ | plugin_dir | /usr/lib64/mysql/plugin/ | +---------------+--------------------------+ 1 row in set (0.01 sec) root@localhost [(none)]> system ls -l /usr/lib64/mysql/plugin/ total 4484 -rwxr-xr-x 1 root root 22336 Sep 13 17:12 adt_null.so -rwxr-xr-x 1 root root 299944 Sep 13 17:12 audit_log.so -rwxr-xr-x 1 root root 7392 Sep 13 17:12 auth_socket.so -rwxr-xr-x 1 root root 40712 Sep 13 17:12 authentication_ldap_sasl_client.so -rwxr-xr-x 1 root root 19928 Sep 13 17:12 authentication_pam.so -rwxr-xr-x 1 root root 50216 Sep 13 17:12 connection_control.so -rwxr-xr-x 1 root root 100064 Sep 13 17:12 firewall.so -rwxr-xr-x 1 root root 1240104 Sep 13 17:12 group_replication.so -rwxr-xr-x 1 root root 116624 Sep 13 17:12 innodb_engine.so -rwxr-xr-x 1 root root 86792 Sep 13 17:12 keyring_file.so -rwxr-xr-x 1 root root 287256 Sep 13 17:12 keyring_okv.so -rwxr-xr-x 1 root root 19968 Sep 13 17:12 keyring_udf.so -rwxr-xr-x 1 root root 192696 Sep 13 17:12 libmemcached.so -rwxr-xr-x 1 root root 10920 Sep 13 17:12 locking_service.so -rwxr-xr-x 1 root root 11928 Sep 13 17:12 mypluglib.so -rwxr-xr-x 1 root root 7352 Sep 13 17:12 mysql_no_login.so -rwxr-xr-x 1 root root 1714912 Sep 13 17:12 mysqlx.so -rwxr-xr-x 1 root root 49368 Sep 13 17:12 openssl_udf.so -rwxr-xr-x 1 root root 7480 Sep 13 17:12 rewrite_example.so -rwxr-xr-x 1 root root 53992 Sep 13 17:12 rewriter.so -rwxr-xr-x 1 root root 63312 Sep 13 17:12 semisync_master.so -rwxr-xr-x 1 root root 16112 Sep 13 17:12 semisync_slave.so -rwxr-xr-x 1 root root 61312 Sep 13 17:12 thread_pool.so -rwxr-xr-x 1 root root 29352 Sep 13 17:12 validate_password.so -rwxr-xr-x 1 root root 33016 Sep 13 17:12 version_token.so root@localhost [(none)]>
本日の説明はここまで。Docker環境でもMySQLのEnterprise Editionの機能を利用して開発や検証したい方にはお勧め。
Please Enjoy it.