In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about how to use PV and PVC. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
Here is a demonstration of how to provide persistent storage for a MySQL database by:
Create PV and PVC.
Deploy MySQL.
Add data to MySQL.
Simulating node downtime, Kubernetes automatically migrates MySQL to other nodes.
Verify data consistency.
First, create PV and PVC with the following configuration:
Mysql-pv.yml
Mysql-pvc.yml
Next, deploy MySQL with the following configuration file:
MySQL is deployed to k8s-node2, and the client accesses Service mysql as follows:
Kubectl run-it-rm-image=mysql:5.6-restart=Never mysql-client-mysql- h mysql- ppassword
Update the database:
① switches to database mysql.
② creates the database table my_id.
③ inserts a piece of data.
④ confirms that the data has been written.
Shut down k8s-node2 to simulate node downtime.
Verify the consistency of the data:
The MySQL service is restored and the data is intact.
We discussed how Kubernetes manages storage resources.
Volume of emptyDir and hostPath types is convenient, but not durable, and Kubernetes supports Volume for a variety of external storage systems.
PV and PVC separate the responsibilities of administrators and ordinary users and are more suitable for production environments. We also learned how to achieve more efficient dynamic provisioning through StorageClass.
Finally, we demonstrated how to use PersistentVolume to achieve data persistence in MySQL.
The above is how to use PV and PVC. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.