In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to talk to you about how to create Rex-Ray volume, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something from this article.
We installed and deployed Rex-Ray and successfully configured VirtualBox backend, and today we demonstrate how to create and use Rex-Ray volume.
Create a volume by executing the following command on docker1 or docker2:
Docker volume create-driver rexray-name=mysqldata-opt=size=2
The volume mysqldata was created successfully with a size of 2GB. Mysqldata can also be seen in the VirtualBox host.
Because VirtualBox uses a small amount of space initially allocated by thin-provisioning,volume.
Next we will:
Start the MySQL container mydb_on_docker1 on dokcer1 and use mysqldata as the data volume.
Update the database and then destroy the mydb_on_docker1.
Start the MySQL container mydb_on_docker2 on dokcer2, also use mysqldata as the data volume, and then verify the validity of the data.
Create containers and use data volumes
Start the MySQL container by executing the following command on dokcer1:
Docker run-- name mydb_on_docker1-v mysqldata:/var/lib/mysql-e MYSQL_ROOT_PASSWORD=passw0rd-d mysql
-v mysqldata:/var/lib/mysql transfers the previously created volume mount to the MySQL data directory.
Let's take a look at how this mount is implemented at a lower level.
First view the storage configuration of the virtual machine docker1 in VirtualBox:
Rex-Ray volume mysqldata has been mounted to docker1.
Perform docker volume inspect mysqldata:
Mysqldata has been mount to the docker1 directory / var/lib/libstorage/volumes/mysqldata/data, and execute docker inspect mydb_on_docker1 to view the volume information of the container:
/ var/lib/libstorage/volumes/mysqldata/data is mount to the container's directory / var/lib/mysql, so that Rex-Ray volume mysqldata has already mount to the container mydb_on_docker1.
Update the database
Follow these steps to update the MySQL data:
① enters the container mydb_on_docker1.
② logs in to the database and enters the password specified by the environment variable MYSQL_ROOT_PASSWORD when the container starts.
③ switches to database mysql.
④ creates the database table my_id.
⑤ inserts a piece of data.
⑥ confirms that the data has been written.
Execute docker rm-f mydb_on_docker1 to delete the container.
After reading the above, do you have any further understanding of how to create Rex-Ray volume? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.