当前位置:网站首页>How to build your own cloud database in docker
How to build your own cloud database in docker
2022-07-19 08:58:00 【Free [email protected]】
Author's words
Cloud databases of major cloud service providers are very expensive , If we want to build our own cloud database to reduce costs , What to do ? We can use cloud server to realize , There are two ways , One is directly on the cloud server (linux edition ) Jacket linux Version of mysql, The other is in docke Create your own by pulling the image mysql Containers , Its advantage is that it can create multiple mysql Containers , Install directly in the cloud service mysql, Only one cloud database can be installed .
preparation
technology :docker knowledge linux command
Tools :navicat mysql database Virtual machine ESC
Environmental Science :centos 7
Code implementation
1. Check to see if... Is already installed mysql Mirror image
Use docker images View the installation image , If it were not so , adopt docker pull ( Mirror source ) Pull one mysql Mirror image
[[email protected] root]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos/mysql-57-centos7 latest f83a2938370c 6 weeks ago 452MB
2. see docker Operation status in the container
adopt docker ps see dockers The state of the container in ,docker ps Show status Has been suspended up The container of .docker ps -a The display status is exiit The container of , Delete container ,docker rm CONTAINER ID, Example :docker rm 0b
[[email protected] root]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0b71daef059c centos/mysql-57-centos7 "container-entrypoin…" 4 weeks ago Up 13 days 0.0.0.0:3307->3306/tcp mysql02
3.docker Startup and operation mysql Mirror image
docker run -p 3308:3306 --name mysql03 -e MYSQL_ROOT_PASSWORD=123456 -d centos/mysql-57-centos7
-p Represents a port mapping
–name : Name your container
-e MYSQL_ROOT_PASSWORD=123456 : Set parameters
-d The background to perform
Note that the mapping cannot be written as 3306:3306, It may be related to your local 3306 Caused by conflict
[[email protected] root]# docker run -p 3308:3306 --name mysql03 -e MYSQL_ROOT_PASSWORD=123456 -d centos/mysql-57-centos7
ceec68111b3078e87bb5a7fa9d4b7923a18a2b9c9743cad939ad6cce78141570
[[email protected] root]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ceec68111b30 centos/mysql-57-centos7 "container-entrypoin…" 10 seconds ago Up 7 seconds 0.0.0.0:3308->3306/tcp mysql03
0b71daef059c centos/mysql-57-centos7 "container-entrypoin…" 4 weeks ago Up 13 days 0.0.0.0:3307->3306/tcp mysql02
4. use navicat Connect to the cloud database we created
Turn on the computer , use navicat Enter the name of the virtual machine ip and docker Where we run mysql Connect with the container port number , Click ok ok, Cloud data succeeded
5. design sketch
Okay , Your own cloud database can be used . If you want to build another one , Just repeat
6 I hope I can help you , If you need technical service help, you can add me QQ:1728608455
Follow my official account to get Java Learning materials .

版权声明
本文为[Free [email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207170857335303.html
边栏推荐
- 解决接口跨域问题和node操作MySQL
- MySQL读写分离
- Authing 实践|制造业身份认证统一管理解决方案
- Why are the special effects in others' games very soft
- LabVIEW用了多线程,程序是不是会跑的更快些
- 2022 Guangdong Provincial Safety Officer a certificate, the third batch (main person in charge) exercise questions and mock examination
- Magic Usage of mongodb $symbol +mongo data type
- [Hongke] lidar safety system: making the world safer
- 2022t elevator repair examination question bank and answers
- Programming in the novel [serial 12] the moon bends in the yuan universe
猜你喜欢

数据库——sql-server

How to set preferences when developing esp8266 and esp32 with Arduino

静态路由!!静态路由!!静态路由!!

Redis

Cbcgpedit control used by BCG

cut,sort,uniq,xargs

freeswitch的话单模块

Leetcode sword finger offer II 041 Average value of sliding window: low space consumption solution

Translucent double glass side thickness

Idea debug according to conditional breakpoints
随机推荐
【虹科】激光雷达安全系统:让世界更安全
gradle入门笔记
【回归预测】基于粒子滤波实现锂离子电池寿命预测附matlab代码
Leetcode sword finger offer II 041 Average value of sliding window: low space consumption solution
2022T电梯修理考试题库及答案
QR decomposition for matrix inversion -- C engineering implementation
RPA相关知识点整理
[regression prediction] lithium ion battery life prediction based on particle filter with matlab code
Why are the special effects in others' games very soft
如何在 Authing 上快速实现 Zadig 单点登录?
QT串口通信
[handwritten numeral recognition] handwritten numeral recognition based on lenet network with matlab code
(鬼火引擎)中多设备的支持
Qt之Qprocess
Cbcgpedit control used by BCG
使用<pre>和JSON.stringify处理网页展示JSON的格式
How to set preferences when developing esp8266 and esp32 with Arduino
ARM计算新应用,违规垂钓“一网打尽”
Programming in the novel [serial 15] the moon bends in the yuan universe
[Hongke] Introduction to genicam protocol

