• <legend id='xiUeN'><style id='xiUeN'><dir id='xiUeN'><q id='xiUeN'></q></dir></style></legend>
  • <small id='xiUeN'></small><noframes id='xiUeN'>

    <i id='xiUeN'><tr id='xiUeN'><dt id='xiUeN'><q id='xiUeN'><span id='xiUeN'><b id='xiUeN'><form id='xiUeN'><ins id='xiUeN'></ins><ul id='xiUeN'></ul><sub id='xiUeN'></sub></form><legend id='xiUeN'></legend><bdo id='xiUeN'><pre id='xiUeN'><center id='xiUeN'></center></pre></bdo></b><th id='xiUeN'></th></span></q></dt></tr></i><div id='xiUeN'><tfoot id='xiUeN'></tfoot><dl id='xiUeN'><fieldset id='xiUeN'></fieldset></dl></div>
    1. <tfoot id='xiUeN'></tfoot>

          <bdo id='xiUeN'></bdo><ul id='xiUeN'></ul>

        初始化部署在 AWS EKS 中的 MySQL 数据库

        时间:2023-06-24
        <i id='yUFCz'><tr id='yUFCz'><dt id='yUFCz'><q id='yUFCz'><span id='yUFCz'><b id='yUFCz'><form id='yUFCz'><ins id='yUFCz'></ins><ul id='yUFCz'></ul><sub id='yUFCz'></sub></form><legend id='yUFCz'></legend><bdo id='yUFCz'><pre id='yUFCz'><center id='yUFCz'></center></pre></bdo></b><th id='yUFCz'></th></span></q></dt></tr></i><div id='yUFCz'><tfoot id='yUFCz'></tfoot><dl id='yUFCz'><fieldset id='yUFCz'></fieldset></dl></div>

        <small id='yUFCz'></small><noframes id='yUFCz'>

                <bdo id='yUFCz'></bdo><ul id='yUFCz'></ul>
              • <legend id='yUFCz'><style id='yUFCz'><dir id='yUFCz'><q id='yUFCz'></q></dir></style></legend>
                    <tbody id='yUFCz'></tbody>
                  <tfoot id='yUFCz'></tfoot>
                  本文介绍了初始化部署在 AWS EKS 中的 MySQL 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的 AWS EKS 集群中有一个运行 MySQL:5.7 的 Pod.我有一个 SQL 文件,可以为其初始化并填充数据.在普通的 docker-compose 中,我将在我的 docker-compose 文件中为它使用一个挂载点:

                  卷:- ./:/etc/mysql/conf.d- ./:/var/lib/mysql- ./:/docker-entrypoint-initdb.d/init.sql

                  在 EKS 中,我可以创建一个存储类来保存 MySQL 数据.

                  如何使用我的 init.sql 文件(大约 8GB)来初始化在 EKS 集群中运行的 MySQL pods?

                  更新:如果您有一个小的 init 文件或有权访问 Kubernetes 主机,还有另一个问题解释了如何执行此操作:在Kubernetes上创建mysql容器时如何初始化?

                  不过,就我而言,我使用的是 AWS EKS 并且我的 init 文件有几 GB,因此我们将不胜感激.

                  解决方案

                  在 Kubernetes 中也很容易.您可以按照以下方式进行,

                  1. 将您的 init.sql 文件放入 Kubernetes 卷.
                  2. 将此卷挂载到 mysql pod 的 /docker-entrypoint-initdb.d 目录中.

                  这是一个示例 yaml 文件:mysql-init-demo.yaml>

                  您还可以使用 init-containerinit.sql 文件下载到挂载在 /docker-entrypoint-initdb.d 上的 Kubernetes 卷中 mysql容器目录.

                  UPD: 正如您在更新中指定的那样,您提到的解决方案对您不起作用.我认为 init-container 方法最适合你.在这里,您可以这样做:

                  1. 创建一个 pvc.让它的名字是init-script.
                  2. 现在,将 init-container 添加到您的 mysql pod.将此init-script pvc 挂载到此init-container 的某个目录中.配置你的 init-container 以便它下载你的 init.sql 文件到这个目录.

                  3. /docker-entrypoint-initdb.d

                  4. 的mysql容器中安装init-script

                  如果您需要任何带有 init-container 方法的示例,请告诉我.

                  UPD-2: 我为 init-container 方法添加了一个示例.您可以在此处找到它.

                  I have a pod in my AWS EKS Cluster that runs MySQL:5.7. I have an SQL file that initializes and populates the data for it. in a normal docker-compose, I will use a mount point for it in my docker-compose file:

                  volumes:
                    - ./<path-to-my-config-directory>:/etc/mysql/conf.d
                    - ./<path-to-my-persistence-directory>:/var/lib/mysql
                    - ./<path-to-my-init.sql>:/docker-entrypoint-initdb.d/init.sql
                  

                  In EKS, I can create a storage class in which to save MySQL data.

                  How can I use my init.sql file (about 8GB) to initialize the MySQL pods running in the EKS cluster?

                  Update: there is another question that explains how to do this if you have a small init file or have access to the Kubernetes host: How to initialize mysql container when created on Kubernetes?

                  In my case though, I am on AWS EKS and my init file is a few gigabytes, so any help would be greatly appreciated.

                  解决方案

                  It's easy in Kubernetes too. You can do it as follow,

                  1. Put your init.sql file into a Kubernetes volume.
                  2. Mount this volume into /docker-entrypoint-initdb.d directory of your mysql pod.

                  Here, is an sample yaml file: mysql-init-demo.yaml

                  You can also use an init-container to download init.sql file into a Kubernetes volume that is mounted on /docker-entrypoint-initdb.d directory of mysql container.

                  UPD: As you have specified in update that the solution you have referred won't work for you. I think init-container approach will be best suited for you. Here, is how you can do:

                  1. Create a pvc. Let it's name is init-script.
                  2. Now, add a init-container to your mysql pod. Mount this init-script pvc at some directory of this init-container. Configure your init-container such that it download your init.sql file on this directory.

                  3. Mount the init-script in mysql container at /docker-entrypoint-initdb.d

                  Let me know if you need any sample with init-container approach.

                  UPD-2: I have added a sample for init-container approach. You can find it here.

                  这篇关于初始化部署在 AWS EKS 中的 MySQL 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 MySQL 8.0.20 数据库迁移到 AWS Aurora 下一篇:从 Django 连接到 RDS MySQL 时出现 SSL 连接错误

                  相关文章

                      • <bdo id='vhyoG'></bdo><ul id='vhyoG'></ul>

                      <i id='vhyoG'><tr id='vhyoG'><dt id='vhyoG'><q id='vhyoG'><span id='vhyoG'><b id='vhyoG'><form id='vhyoG'><ins id='vhyoG'></ins><ul id='vhyoG'></ul><sub id='vhyoG'></sub></form><legend id='vhyoG'></legend><bdo id='vhyoG'><pre id='vhyoG'><center id='vhyoG'></center></pre></bdo></b><th id='vhyoG'></th></span></q></dt></tr></i><div id='vhyoG'><tfoot id='vhyoG'></tfoot><dl id='vhyoG'><fieldset id='vhyoG'></fieldset></dl></div>

                      <small id='vhyoG'></small><noframes id='vhyoG'>

                      <tfoot id='vhyoG'></tfoot>
                    1. <legend id='vhyoG'><style id='vhyoG'><dir id='vhyoG'><q id='vhyoG'></q></dir></style></legend>