Database cloud service generation method, apparatus, device, and readable storage medium

By employing container technology for resource isolation in database cloud services, the security risks of database cloud services are resolved, resulting in enhanced security and efficient database delivery.

CN115618409BActive Publication Date: 2026-04-07CHINA CONSTRUCTION BANK
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-08
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing database cloud services pose high security risks, and user data is easily leaked or lost when subjected to malicious attacks, lacking effective resource isolation and protection measures.

Method used

By deploying database cloud services in containers using container technology, isolation of storage space, network, CPU and memory is achieved. Storage space and network resources are allocated to containers using pre-isolated infrastructure and computing resources, and containers are started based on database images to generate the target database cloud service.

Benefits of technology

It improves the security of database cloud services, reduces security risks for users during use, and enables personalized database customization and efficient delivery of multiple database cloud services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115618409B_ABST
    Figure CN115618409B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and readable storage medium for generating a database cloud service. The method involves acquiring a user-input database cloud service generation instruction, which includes configuration parameters for the target database cloud service to be generated. Based on these parameters, storage space resources and network resources are allocated to the target database cloud service. A container is started based on a pre-built database image, and the container is deployed to the storage space and network resources. CPU and memory resources are further allocated to the container, and the container is run to generate the target database cloud service. Because this application's solution generates the database cloud service by building a cloud computing platform and deploying the database cloud service in a container, the underlying physical resources are isolated, ensuring that resources between different containers do not interfere with each other. By using Docker containers to achieve physical resource allocation and isolation for the database cloud service, the security of the database cloud service is improved, and user data information is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a method, apparatus, device, and readable storage medium for generating database cloud services. Background Technology

[0002] With the development of computer technology in the era of big data, databases, as crucial foundational software with vast data storage capacity, are widely used. A database is a repository that organizes, stores, and manages data according to a data structure; it is a large, organized, shareable, and uniformly managed collection of data stored permanently on a computer. In the era of big data, to facilitate information access and use, cloud computing is combined with databases to provide users with an independent and complete big data resource management service platform. Cloud computing is the process of using a powerful computing system formed through computer networks to store and aggregate relevant resources and provide users with configurable, personalized services. It mainly includes three service models: IaaS (Infrastructure as a Service), PaaS (Platform as a Service), and SaaS (Software as a Service). These three cloud services can provide users with the services they need via the internet.

[0003] Databases utilize cloud services to run applications in the cloud, effectively reducing development costs for users. Simultaneously, storing data in the cloud protects against data loss in the event of a personal computer crash, improving data reliability. However, because all data is shared in the cloud when users access these services, malicious attacks by hackers can lead to data security issues such as the leakage or loss of users' private data. Therefore, current cloud database services offered by service providers pose significant security risks. Summary of the Invention

[0004] In view of this, this application provides a database cloud service generation method, apparatus, device, and readable storage medium to solve the problem that existing methods for generating database cloud services suffer from data security issues such as user data leakage and loss when malicious attacks are encountered to obtain user data stored in the cloud, resulting in high product security risks.

[0005] To achieve the above objectives, the following solution is proposed:

[0006] A method for generating a database cloud service includes:

[0007] Obtain the database cloud service generation instruction input by the user. The generation instruction includes the configuration parameters of the target database cloud service to be generated. The configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters.

[0008] Based on the infrastructure resource configuration parameters, infrastructure resources are allocated to the target database cloud service. The infrastructure resources include storage space resources and network resources. The storage space resources are obtained through pre-implemented storage isolation, and the network resources are obtained through pre-implemented network isolation.

[0009] Obtain the pre-built database image corresponding to the database configuration parameters;

[0010] A container is started based on the database image, and the container is deployed to the infrastructure resources;

[0011] According to the computing resource configuration parameters, computing resources are allocated to the container. The computing resources include CPU resources and memory resources. The CPU resources are obtained through pre-implemented CPU isolation, and the memory resources are obtained through pre-implemented memory isolation.

[0012] Run the container to generate the target database cloud service.

[0013] Optionally, the storage space resources are obtained through pre-implemented storage isolation, including:

[0014] Scan all disks on the host machine;

[0015] Create a corresponding physical volume for each of the aforementioned disks;

[0016] A volume group is created from one or more of the physical volumes;

[0017] Create a logical volume on the volume group;

[0018] A file system is established on the logical volume to obtain the storage space resources.

[0019] Optionally, the network resources are obtained through pre-performed network isolation, including:

[0020] Create one or more virtual network cards from the host machine's physical network card;

[0021] Assign a target virtual network interface card (NIC) to the target database cloud service to obtain the network resources. The target virtual NIC can be any one of the one or more virtual NICs.

[0022] Optionally, starting a container based on the database image and deploying the container to the infrastructure resource includes:

[0023] Pull the database image to the host machine from the image repository and start the container;

[0024] The container is deployed to the storage space resource by mounting.

[0025] The container is deployed to the network resource via a virtual bridge, and a physical address is assigned to the container.

[0026] Optionally, computing resources are allocated to the container according to the computing resource configuration parameters, the computing resources including CPU resources and memory resources, including:

[0027] Based on the computing resource configuration parameters, a corresponding number of target CPUs and a corresponding size of memory space are allocated to the container. The target CPUs are the CPU resources, and the memory space is the memory resources.

[0028] Optionally, it also includes:

[0029] Record the identifier corresponding to the target CPU, which is a pre-set CPU number.

[0030] Optionally, the configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters, including:

[0031] The infrastructure resource configuration parameters include file system size and server port; the computing resource configuration parameters include CPU allocation quantity and memory allocation quantity; and the database configuration parameters include database version, database deployment mode, and database user ID.

[0032] Optionally, the pre-built database image corresponding to the database configuration parameters includes:

[0033] The database image is built by writing a Dockerfile, and the database configuration parameters are set in the Dockerfile.

[0034] A database cloud service generation device, comprising:

[0035] The instruction acquisition unit is used to acquire the database cloud service generation instruction input by the user. The generation instruction includes the configuration parameters of the target database cloud service to be generated. The configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters.

[0036] An infrastructure resource allocation unit is used to allocate infrastructure resources to the target database cloud service according to the infrastructure resource configuration parameters. The infrastructure resources include storage space resources and network resources. The storage space resources are obtained through pre-implemented storage isolation, and the network resources are obtained through pre-implemented network isolation.

[0037] The database image acquisition unit is used to acquire a pre-built database image corresponding to the database configuration parameters;

[0038] A container startup unit is used to start a container based on the database image and deploy the container to the infrastructure resources;

[0039] A computing resource allocation unit is configured to allocate computing resources to the container according to the computing resource configuration parameters. The computing resources include CPU resources and memory resources. The CPU resources are obtained through pre-implemented CPU isolation, and the memory resources are obtained through pre-implemented memory isolation.

[0040] The database cloud service generation unit is used to run the container and generate the target database cloud service.

[0041] A database cloud service generation device, comprising:

[0042] Memory and processor;

[0043] The memory is used to store programs;

[0044] The processor is used to execute the program to implement each step of the aforementioned database cloud service generation method.

[0045] A readable storage medium storing a computer program, which, when executed by a processor, implements the various steps of the aforementioned database cloud service generation method. As can be seen from the above technical solution, the database cloud service generation method provided in this application obtains a database cloud service generation instruction input by a user. The generation instruction includes configuration parameters of the target database cloud service to be generated. Based on the configuration parameters, storage space resources are allocated to the target database cloud service, and network resources are configured. A container is started based on a pre-built database image, and the container is deployed to the aforementioned storage space resources and network resources. Further, CPU resources and memory resources are allocated to the container, and the container is run to generate the target database cloud service. This application's solution deploys the database cloud service into a container, achieving the allocation and isolation of physical resources based on container technology. Storage space isolation and network isolation belong to computer infrastructure isolation, while CPU isolation and memory isolation belong to computing resource isolation. Based on the configuration parameters of the database cloud service requested by the user, physical resources are allocated to different containers through the above isolation method. Containers isolate resources, ensuring that resources between different containers do not affect each other, thus achieving physical resource isolation, improving the security of the cloud database, and reducing security risks for users during use.

[0046] Furthermore, the proposed solution generates database cloud services by building a cloud computing platform. Users can configure required parameters as needed to achieve personalized database customization. At the same time, since the containers are isolated from each other and do not affect each other, multiple sets of database cloud services can be generated and delivered to multiple users simultaneously, thereby improving database delivery efficiency. Attached Figure Description

[0047] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0048] Figure 1 An optional flowchart of the database cloud service generation method provided in the embodiments of this application;

[0049] Figures 2-5 This application illustrates several optional host resource allocation diagrams for allocating resources to a database cloud service, as disclosed in embodiments of this application.

[0050] Figure 6 This is a schematic diagram of the structure of a database cloud service generation device disclosed in an embodiment of this application;

[0051] Figure 7This is a hardware structure block diagram of a database cloud service generation device disclosed in an embodiment of this application. Detailed Implementation

[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] The inventor's investigation revealed that with the development of cloud computing technology, cloud services have been widely used by users due to their advantages such as high cost-effectiveness, high flexibility, and dynamic scalability. However, while users store data in the cloud to achieve data sharing, data security issues often arise. Because a large amount of important and sensitive data in the infrastructure is not isolated and protected, information leakage or malicious attacks and tampering can occur.

[0054] The inventors discovered that container technology can be used to run processes in a container, isolating them from the outside world. By restricting and isolating resources, resources are divided into an independent space, achieving isolation between processes and resources, and ensuring that each container does not affect the others.

[0055] In view of this, the inventors proposed a method for generating database cloud services. Figure 1 This application illustrates an optional flowchart of a database cloud service generation method provided in an embodiment, such as... Figure 1 As shown, the process may include:

[0056] Step S10: Obtain the database cloud service generation instruction input by the user. The generation instruction includes the configuration parameters of the target database cloud service to be generated. The configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters.

[0057] Specifically, user-input database cloud service generation instructions can be obtained through various means. For example, by sending the user a link containing prompts for the required configuration parameters, the user-input information and information submission instructions can be obtained. Alternatively, configuration parameter information can be extracted from the user-input database cloud service configuration information.

[0058] Among them, infrastructure resource configuration parameters can be configuration parameters of computer infrastructure related resources such as file system size and server port; computing resource configuration parameters can be configuration parameters related to computer computing power such as CPU allocation quantity and memory allocation quantity; and database configuration parameters can be configuration parameters related to database such as database version, database deployment mode, and database user ID.

[0059] Step S11: Allocate infrastructure resources to the target database cloud service according to the infrastructure resource configuration parameters. The infrastructure resources include storage space resources and network resources. The storage space resources are obtained through pre-implemented storage isolation, and the network resources are obtained through pre-implemented network isolation.

[0060] Storage space resources may include the number of disks, file directories, etc., while network resources may include network cards, IP addresses, etc.

[0061] Specifically, storage space resources can be determined based on the file system size in the above configuration parameters. By allocating storage space resources to the target database cloud service, the number, size, directory location, etc. of the disks used by the target database cloud service can be determined.

[0062] Furthermore, network resources can be allocated to the target database cloud service based on the server port in the above configuration parameters, and the network connection port of the target database cloud service can be determined by the allocated network resources.

[0063] Step S12: Obtain the pre-built database image corresponding to the database configuration parameters.

[0064] Specifically, the database image to be obtained can be a database image that matches the database version parameter in the target database cloud service configuration parameters submitted by the user. Furthermore, database images of various versions can be pre-made and saved in an image repository. When needed, the corresponding version of the database image can be downloaded from the image repository for use.

[0065] An image repository is a collection of images used to store, manage, and deploy container images. It can be built based on the Docker Registry, a private repository provided by the Docker container engine. It can be a simplified public image repository of the basic version, or a private image repository can be built locally.

[0066] Step S13: Start the container based on the database image and deploy the container to the infrastructure resources.

[0067] Specifically, by running the `docker run` command, a container can be started based on the acquired database image. This involves pulling the required database image from an image repository to the host machine, and then starting the container based on that image. A container is a running instance created from an image; a container is equivalent to a computer process. A container can be viewed as a lightweight Linux runtime environment used to run applications.

[0068] Furthermore, once the container has started, it is necessary to allocate infrastructure resources such as file systems and networks to the container. The container can be deployed to the infrastructure resources allocated to the target database cloud service in step S11 above.

[0069] Specifically, the storage space resources allocated for the target database cloud service in step S11 can be mounted to a specified directory created within the container, allowing the physical disk allocated for the target database cloud service in step S11 to serve as the container's storage space. Simultaneously, a virtual interface can be bridged to the container using a virtual bridge to access the network resources allocated for the target database cloud service in step S11, and a physical address can be allocated to the container from these network resources. The physical address configured for the container is an unused IP address within these network resources.

[0070] Step S14: Allocate computing resources to the container according to the computing resource configuration parameters. The computing resources include CPU resources and memory resources. The CPU resources are obtained through pre-performed CPU isolation, and the memory resources are obtained through pre-performed memory isolation.

[0071] Specifically, allocating CPU resources determines which CPUs a container will use. If resource over-provisioning is needed, CPUs can be reused. Allocating memory resources specifies the amount of memory a container will use, or allocates a specified amount of memory and swap partition to the container. If memory over-provisioning is needed, a certain percentage of memory space exceeding the host machine's total memory can be allocated to the container.

[0072] Computational resource overprovisioning refers to the total CPU or memory resources of all virtual machines on a physical host exceeding the resource limits of the physical host itself. The purpose of computational resource overprovisioning is to ensure that the physical host and virtual machines do not experience abnormal operation due to insufficient hardware resources in extreme cases, thus guaranteeing operational reliability. The swap partition is used to release a portion of the disk memory when the operating system's physical memory is insufficient, making it available for currently running applications. The released space is temporarily stored in the swap partition. Swap partitions are needed when overprovisioning memory space for containers to ensure that the containers have sufficient memory.

[0073] Step S15: Run the container to generate the target database cloud service.

[0074] Specifically, the target database cloud service can be generated by running a program within a container using the Docker command. Furthermore, the generated target database cloud service can be output and submitted to the user. The database cloud service generation method provided in this application allocates the infrastructure and computing resources corresponding to the configuration parameters of the target database cloud service input by the user to a container. This container starts based on a pre-built database image, and the target database cloud service is generated by running this container. This application embodiment, based on container technology, deploys the database within a container, utilizing containers to achieve physical resource isolation. This ensures that resources and processes between different containers do not affect each other, improving the security of the cloud database and reducing security risks for users during use.

[0075] Furthermore, users can submit configuration parameters according to their individual needs. Since the target database cloud service is generated based on the user-submitted configuration parameters, this application enables personalized customization of the database. Simultaneously, because the containers are isolated from each other and do not affect each other, this application can generate multiple database cloud services concurrently, thereby ensuring data security while delivering services to multiple users concurrently and improving database delivery efficiency.

[0076] See further Figure 2 , Figure 2 This illustration shows a schematic diagram of host machine storage space allocation based on storage isolation for database cloud services, as disclosed in an embodiment of this application. Figure 2 This application embodiment describes an optional implementation of allocating storage space resources for the target database cloud service in step S11 above, which may include the following steps:

[0077] S1. Scan all disks on the host machine.

[0078] The host machine can be a dedicated physical server with a virtualized environment deployed, such as a physical computer with virtual machines installed.

[0079] Specifically, such as Figure 2 As shown, Figure 2 The scan detected a total of 5 disks on the host machine. Furthermore, these disks can be named as disk identifiers to clearly identify which disks are being allocated resources. For example... Figure 2 As shown, you can set an identifier for a disk by assigning it a disk number.

[0080] S2. Create a corresponding physical volume for each disk.

[0081] A physical volume (PV) is a disk partition or a device that logically has the same function as a disk partition. Compared to a disk, a physical volume contains management parameters related to managing disk partitions.

[0082] Specifically, one physical volume corresponds to one disk. For example... Figure 2 As shown, each disk corresponds to a physical volume, and the physical volume number is consistent with the corresponding disk number.

[0083] S3. Create a volume group from one or more physical volumes.

[0084] A volume group (VG) can be a storage pool consisting of one or more physical volumes.

[0085] Specifically, a volume group can be created from a single physical volume, or from two or more physical volumes. For example... Figure 2 The two optional disk allocation options are shown. Figure 2 The volume group in (a) is created from physical volume 1 and physical volume 2. Figure 2 The volume group in (b) is created from physical volume 3, physical volume 4 and physical volume 5.

[0086] S4. Create a logical volume on the volume group.

[0087] A logical volume (LV) can be a virtual storage device created from a physical storage device. It can be a standard block device, similar to a hard drive partition. Logical volumes can be created on top of volume groups.

[0088] Specifically, a logical volume is created on the specified volume group created in step S3 above. Multiple logical volumes can also be created; in this embodiment, only one logical volume is created on one volume group. For example... Figure 2 As shown, a logical volume is created on each created volume group.

[0089] S5. Create a file system on the logical volume.

[0090] Specifically, a logical volume is equivalent to a storage device, which needs to be formatted. Only after a file system is established through formatting can data be written.

[0091] In this embodiment, steps S1-S4 are steps for storage isolation of the host machine's storage space. In the aforementioned embodiments, steps S1-S4 are completed in advance, while in step S11, it is only necessary to determine the required logical volume to be allocated to the target database cloud service based on the file system size parameters input by the user, for example... Figure 2Each logical volume is allocated a Docker container. As illustrated in the above embodiments, this application embodiment can deploy database cloud services into containers. Storage space resources can be allocated by assigning the determined logical volumes to the containers where the target database cloud service to be generated is deployed. Furthermore, creating a file system on the logical volume allows the use of the corresponding storage space resources.

[0092] This embodiment pre-completes storage isolation of the host machine's storage space using the "disk-physical volume-volume group-logical volume" method. Based on the configuration parameters input by the user, it selects storage space resources that match the user's configuration parameters from the isolated storage space resources and allocates them to the container to which the target database cloud service to be generated is deployed, so that the container can exclusively use one or several disks, achieving disk-level isolation.

[0093] Furthermore, logical volumes are scalable, allowing their size to be changed on demand. They can be added on a per-disk basis, expanding the number of disks or the size of logical volumes to make full use of storage space.

[0094] See further Figure 3 , Figure 3 This illustration shows a schematic diagram of allocating network resources for a database cloud service based on network isolation, as disclosed in an embodiment of this application. Figure 3 This application embodiment describes an optional implementation method for allocating network resources for the target database cloud service in step S11 above.

[0095] This embodiment can be based on virtual network interface card (NIC) technology, which can achieve network isolation by creating one or more virtual NICs from a physical NIC.

[0096] Furthermore, in step S11 of the aforementioned embodiment, network resources are allocated to the target database cloud service. The network resources are a target virtual network card determined from the virtual network cards obtained after network isolation in this embodiment.

[0097] Specifically, as explained in the foregoing embodiments, network resources can be allocated to the target database cloud service based on the server port parameters in the configuration parameters input by the user. In this embodiment, a target virtual network interface card is determined based on the server port parameters. The target virtual network interface card can be mounted to the container deployed by the target database cloud service. Furthermore, a physical IP address can be allocated to the container for its use.

[0098] The virtual network interface cards (NICs) are typically created in pairs, with each pair connecting two network devices. In this embodiment, the pair of virtual NICs connects the host machine and the container, respectively. Furthermore, a virtual bridge can be used to deploy the container to the network resources allocated for the target database cloud service, connecting the container to the bridged network.

[0099] In this embodiment, the network isolation step is completed in advance; that is, the virtual network interface card (NIC) is pre-created. When generating the target database cloud service, it is only necessary to determine one target virtual NIC as the network resource allocated to the target database cloud service, connect the target virtual NIC to the container where the target database cloud service is deployed, configure the physical address for the container, and complete the network configuration of the target database cloud service. This embodiment achieves network-level isolation by using virtual NIC technology to isolate network traffic between containers.

[0100] See further Figure 4 , Figure 4 This illustration shows a schematic diagram of allocating CPU resources for a database cloud service, as disclosed in an embodiment of this application. Figure 4 This application embodiment describes an optional implementation of allocating CPU resources to the container in step S14 above.

[0101] This embodiment will detail the process of allocating CPU resources to a container by determining the target CPU for use by the target database cloud service, for example... Figure 4 The detailed process may include the following steps:

[0102] S1. Pre-set identifiers for all CPUs on the host machine.

[0103] The identifier can be a numerical code or a string, used to identify the CPU for easy differentiation. For example... Figure 4 As shown in the example, the CPU identifiers are in the form of numbers, and there are four CPUs: CPU0 to CPU3.

[0104] S2. Determine the target CPU based on the computing resource configuration parameters input by the user.

[0105] Specifically, based on the number of CPUs requested in the computing resource configuration parameters, the corresponding number of CPUs are selected from all CPUs whose identifiers were set in step S1 above to obtain the target CPUs. The target CPUs are the CPU resources allocated to the container.

[0106] like Figure 4 As shown, Figure 4The diagram illustrates two scenarios for allocating CPUs to a container. If the CPU request quantity is 1, then any CPU, such as CPU0, is selected as the target CPU and allocated to the container. If the CPU request quantity is 3, then any 3 CPUs, such as CPU1, CPU2, and CPU3, are selected as the target CPUs and allocated to the container.

[0107] S3. Allocate the target CPU to a container.

[0108] Specifically, the identifier corresponding to the target CPU is recorded, and the recorded identifier is entered as the parameter "--cpuset-cpus parameter" into the docker command statement. By running the docker command, the operation of allocating CPU resources to the container is completed.

[0109] For example, Figure 4 When the number of CPU requests is 3, and the target CPUs are CPU1, CPU2, and CPU3, the following command is executed:

[0110] docker run-it--rm--cpuset-cpus="1-3"mysql:latest

[0111] The above Docker statement indicates that the container utilizes CPU1, CPU2, and CPU3, meaning that the CPU resources allocated to the container are CPU1, CPU2, and CPU3.

[0112] Furthermore, if CPU over-provisioning is required, CPU numbers can be reused.

[0113] This embodiment sets an identifier for the CPU, configures parameters according to the number of CPU requests, determines the target CPU, and allocates the target CPU to the container by running the docker command, thereby achieving CPU isolation between containers.

[0114] See further Figure 5 , Figure 5 This illustration shows a schematic diagram of allocating memory resources for a database cloud service, as disclosed in an embodiment of this application. Figure 5 This application embodiment describes an optional implementation of allocating memory resources for the container in step S14 above.

[0115] Allocating memory resources to a container can involve specifying the amount of memory a container can occupy. Specifically, in this embodiment, based on the number of memory requests in the user-input computing resource configuration parameters, a corresponding size of memory space is planned for the container and allocated to it.

[0116] Furthermore, the memory space allocated to the container is entered as the parameter "--memory parameter" into the docker command statement. By running the docker command, the operation of allocating memory resources to the container is completed.

[0117] For example, when the memory request size is 1GB, a memory space of 1GB is allocated in the host machine's memory, such as... Figure 5 For memory space 1 shown, run the following command:

[0118] docker run --memory 1G mysql:latest

[0119] The above Docker statement indicates that the container can use 1GB of memory, that is, the memory resources allocated to the container are 1GB of memory space.

[0120] Furthermore, if memory over-provisioning is necessary, a certain percentage of memory space can be allocated to the container beyond the host machine's total memory. Specifically, a swap partition can be used to free up a certain amount of memory for the container. It's important to note that the sum of the total memory size and the swap partition size must not exceed the total host machine memory.

[0121] For example, when the memory request size is 2GB, a 1GB memory space is allocated in the host machine's memory, and a 1GB swap partition is released. Figure 5 For memory space 2 shown, run the following command:

[0122] docker run --memory 1G --memory-swap 2G mysql:latest

[0123] The above Docker statement indicates that the container can use 1GB of memory, and the memory plus swap partition size cannot exceed 2GB, meaning that the memory resources allocated to the container are no more than 2GB of memory space.

[0124] This embodiment allocates memory space for containers, isolating the memory occupied by each container to achieve memory isolation.

[0125] Next, this application embodiment will further describe the process of pre-building the database image in step S12 above.

[0126] In an alternative approach, this embodiment can create a database image by writing a Dockerfile. The detailed database image building process can include the following steps:

[0127] S1. Create the Dockerfile directory.

[0128] S2. Download the MySQL media package to the Dockerfile directory.

[0129] S3. Create a Dockerfile.

[0130] S4. Run the Dockerfile to build the MySQL image.

[0131] The following section uses writing a Dockerfile in a CentOS environment as an example to explain steps S1-S4 in detail.

[0132] S1. Create the Dockerfile directory.

[0133] mkdir -p / root / dockerfile

[0134] S2. Download the MySQL media package to the Dockerfile directory.

[0135] mv mysql-8.0.23-linux-glibc2.12-x86_64.tar.gz / root / dockerfile

[0136] The downloaded database version is MySQL 8.0.23.

[0137] S3. Create a Dockerfile.

[0138] vidockerfile

[0139] Creating a Dockerfile can include:

[0140] 1) Set environment variables:

[0141] WORKDIR / root

[0142] ENV MYSQL_DATA_DIR= / mydata / data

[0143] ENV MYSQL_USER=mysql

[0144] ENV MYSQL_EXTRACT_DIR= / usr / local

[0145] ENV MYSQL_PORT = 3306

[0146] 2) Database installation:

[0147] RUN mkdir–p$MYSQL_DATA_DIR&&cd$MYSQL_EXTRACT_DIR&&tar xf mysql-8.0.23-linux-glibc2.12-x86_64.tar.gz

[0148] RUN chown-R mysql:mysql / mydata / data

[0149] RUN cd / usr / local / mysql / scripts&&mysql_install_db--user=mysql–datadir= / mydata / data--socket= / tmp / mysql.sock--pid-file= / mydata / data / mysqld.pid--log-err= / mydata / data / mysqld.log--basedir= / usr / local / mysql

[0150] RUN cd / usr / local / mysql / bin&&mysqld_safe--user=mysql--basedir= / usr / local / mysql--datadir= / mydata / data--socket= / mydata / data / mysql.sock

[0151] S4. Run the Dockerfile to build the MySQL image.

[0152] docker build-t docker-user / mysql:v1 / root / dockerfile

[0153] This embodiment builds the database image by writing a Dockerfile. Database images corresponding to various versions of the database can be pre-built and stored in an image repository. When generating a database cloud service of a certain version, the corresponding version of the database image can be directly downloaded from the image repository for use, saving time in generating the database cloud service and improving efficiency.

[0154] Furthermore, after completing the various steps of allocating infrastructure resources for the target database cloud service in the aforementioned embodiments, the database image can be pulled to the host machine from the image repository, and the container can be started. Specifically, the container can be started using the following Docker command:

[0155] docker run-dp 13306:3306-v / db / mysql: / mydata / data docker-user / mysql:v1

[0156] The `docker run -d` option is used to create and start the container in the background. The `-p` parameter is used to specify the port mapping, mapping port 3306 exposed by MySQL inside the container to port 13306 on the local host. The `-v` parameter is used to specify the mount path of the data directory, mounting the MySQL data directory in the container to the ` / db / mysql` directory on the local host.

[0157] Furthermore, after the container is launched, it is deployed to the allocated infrastructure resources, including storage space resources and network resources.

[0158] Specifically, deploying containers to storage resources can be done by mounting a file system created on a logical volume into the container, allowing the container to use the disk storage space corresponding to that logical volume for data storage. Furthermore, deploying containers to network resources can be done by connecting a virtual network interface card (NIC) to the container via a virtual bridge or mounting, and assigning the container a separate IP address. This allows the container to connect to the bridged network and use network interface card traffic independently, thus completing the container deployment.

[0159] In conjunction with the above embodiments, this application, based on container technology, achieves isolation of underlying physical resources, thereby improving the security of data storage and management through the generated database cloud service, reducing the security risks in the process of users accessing the database cloud service, and further protecting users' data information and user privacy.

[0160] The database cloud service generation apparatus provided in the embodiments of this application is described below. The database cloud service generation apparatus described below can be referred to in correspondence with the database cloud service generation method described above.

[0161] Combination Figure 6 This application describes a database cloud service generation apparatus disclosed in its embodiments, such as... Figure 6 As shown, the database cloud service generation device may include:

[0162] The instruction acquisition unit 100 is used to acquire the database cloud service generation instruction input by the user. The generation instruction includes the configuration parameters of the target database cloud service to be generated. The configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters.

[0163] Infrastructure resource allocation unit 110 is used to allocate infrastructure resources to the target database cloud service according to the infrastructure resource configuration parameters. The infrastructure resources include storage space resources and network resources. The storage space resources are obtained through pre-implemented storage isolation, and the network resources are obtained through pre-implemented network isolation.

[0164] The database image acquisition unit 120 is used to acquire a pre-built database image corresponding to the database configuration parameters;

[0165] The container startup unit 130 is used to start a container based on the database image and deploy the container to the infrastructure resources;

[0166] The computing resource allocation unit 140 is used to allocate computing resources to the container according to the computing resource configuration parameters. The computing resources include CPU resources and memory resources. The CPU resources are obtained through pre-performed CPU isolation, and the memory resources are obtained through pre-performed memory isolation.

[0167] The database cloud service generation unit 150 is used to run the container and generate the target database cloud service.

[0168] Optionally, the infrastructure resource allocation unit 110 may include:

[0169] A storage space resource allocation unit is used to allocate storage space resources to the target database cloud service;

[0170] The network resource allocation unit is used to allocate network resources to the target database cloud service.

[0171] Optionally, the storage space resource allocation unit may include:

[0172] The disk scanning unit is used to scan all disks in the host machine;

[0173] The physical volume creation unit is used to create a corresponding physical volume for each of the aforementioned disks;

[0174] A volume group creation unit is used to create a volume group from one or more of the physical volumes;

[0175] A logical volume creation unit is used to create a logical volume on the volume group;

[0176] The file system creation unit is used to establish a file system on the logical volume to obtain the storage space resources.

[0177] Optionally, the network resource allocation unit may include:

[0178] The virtual network interface card (NIC) creation unit is used to create one or more virtual NICs from the host machine's physical NICs.

[0179] A virtual network interface card (NIC) allocation unit is used to allocate a target virtual NIC to the target database cloud service to obtain the network resources. The target virtual NIC is any one of the one or more virtual NICs.

[0180] Optionally, the container initiation unit 130 may include:

[0181] The image pull unit is used to pull the database image to the host machine through the image repository and start the container;

[0182] A storage space resource deployment unit is used to deploy the container to the storage space resource by mounting.

[0183] The network resource deployment unit is used to deploy the container to the network resource through a virtual bridge and to allocate a physical address to the container.

[0184] Optionally, the computing resource allocation unit 140 may include:

[0185] The CPU resource allocation unit is used to allocate a corresponding number of target CPUs to the container according to the computing resource configuration parameters, wherein the target CPUs are the CPU resources.

[0186] The memory resource allocation unit is used to allocate a memory space of a corresponding size to the container according to the computing resource configuration parameters, wherein the memory space is the memory resource.

[0187] Optionally, the computing resource allocation unit 140 may further include:

[0188] The CPU identifier recording unit is used to record the identifier corresponding to the target CPU, wherein the identifier is a pre-set CPU number.

[0189] The database cloud service generation apparatus provided in this application embodiment can be applied to a database cloud service generation device. The database cloud service generation device can be a computer. Figure 7 The hardware structure block diagram of the database cloud service generation device is shown, such as... Figure 7 As shown, the hardware structure of the database cloud service generation device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4.

[0190] In this embodiment of the application, the number of processor 1, communication interface 2, memory 3 and communication bus 4 is at least one, and processor 1, communication interface 2 and memory 3 communicate with each other through communication bus 4.

[0191] The processor 1 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.

[0192] Memory 3 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device.

[0193] The memory stores a program, and the processor can call the program stored in the memory. The program is used to implement the various processing flows in the aforementioned database cloud service generation scheme.

[0194] This application embodiment also provides a readable storage medium that can store a program suitable for processor execution, the program being used to implement various processing flows in the aforementioned database cloud service generation scheme.

[0195] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0196] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0197] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating database cloud services, characterized in that, include: Obtain the database cloud service generation instruction input by the user. The generation instruction includes the configuration parameters of the target database cloud service to be generated. The configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters. Based on the infrastructure resource configuration parameters, infrastructure resources are allocated to the target database cloud service. The infrastructure resources include storage space resources and network resources. The storage space resources are obtained through pre-implemented storage isolation, and the network resources are obtained through pre-implemented network isolation. Obtain the pre-built database image corresponding to the database configuration parameters; A container is started based on the database image, and the container is deployed to the infrastructure resources; According to the computing resource configuration parameters, computing resources are allocated to the container. The computing resources include CPU resources and memory resources. The CPU resources are obtained through pre-implemented CPU isolation, and the memory resources are obtained through pre-implemented memory isolation. Run the container to generate the target database cloud service; The process of starting a container based on the database image and deploying the container to the infrastructure resources includes: Pull the database image to the host machine from the image repository and start the container; The container is deployed to the storage space resource by mounting. The container is deployed to the network resource via a virtual bridge, and a physical address is assigned to the container.

2. The method according to claim 1, characterized in that, The storage space resources are obtained through pre-implemented storage isolation, including: Scan all disks on the host machine; Create a corresponding physical volume for each of the aforementioned disks; Create a volume group from one or more of the physical volumes; Create a logical volume on the volume group; A file system is created on the logical volume to obtain the storage space resources.

3. The method according to claim 1, characterized in that, The network resources are obtained through pre-implemented network isolation, including: Create one or more virtual network cards from the host machine's physical network card; Assign a target virtual network interface card (NIC) to the target database cloud service to obtain the network resources. The target virtual NIC can be any one of the one or more virtual NICs.

4. The method according to claim 1, characterized in that, Based on the computing resource configuration parameters, computing resources are allocated to the container, including CPU resources and memory resources, including: Based on the computing resource configuration parameters, a corresponding number of target CPUs and a corresponding size of memory space are allocated to the container. The target CPUs are the CPU resources, and the memory space is the memory resources.

5. The method according to claim 4, characterized in that, Also includes: Record the identifier corresponding to the target CPU, which is a pre-set CPU number.

6. The method according to claim 1, characterized in that, The configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters, including: The infrastructure resource configuration parameters include file system size and server port; the computing resource configuration parameters include CPU allocation quantity and memory allocation quantity; and the database configuration parameters include database version, database deployment mode, and database user ID.

7. A database cloud service generation device, characterized in that, include: The instruction acquisition unit is used to acquire the database cloud service generation instruction input by the user. The generation instruction includes the configuration parameters of the target database cloud service to be generated. The configuration parameters include infrastructure resource configuration parameters, computing resource configuration parameters, and database configuration parameters. An infrastructure resource allocation unit is used to allocate infrastructure resources to the target database cloud service according to the infrastructure resource configuration parameters. The infrastructure resources include storage space resources and network resources. The storage space resources are obtained through pre-implemented storage isolation, and the network resources are obtained through pre-implemented network isolation. The database image acquisition unit is used to acquire a pre-built database image corresponding to the database configuration parameters; A container startup unit is used to start a container based on the database image and deploy the container to the infrastructure resources; A computing resource allocation unit is configured to allocate computing resources to the container according to the computing resource configuration parameters. The computing resources include CPU resources and memory resources. The CPU resources are obtained through pre-implemented CPU isolation, and the memory resources are obtained through pre-implemented memory isolation. A database cloud service generation unit is used to run the container and generate the target database cloud service. Specifically, the container startup unit starts a container based on the database image and deploys the container to the infrastructure resources. This is done by: pulling the database image to the host machine through the image repository and starting the container; deploying the container to the storage space resources by mounting it; and deploying the container to the network resources through a virtual bridge and allocating a physical address to the container.

8. A database cloud service generation device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the database cloud service generation method as described in any one of claims 1-6.

9. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements each step of the database cloud service generation method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Computing resource creation method and system under cloud computing

    CN110413378A

  • Service deployment method and device and storage medium

    CN111324412A