Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Rex-Ray volume across hosts

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use Rex-Ray volume across hosts. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Today we will demonstrate the re-use of Rex-Ray volume mysqldata in docker2.

Start the MySQL container by executing the following command on dokcer2:

Docker run-- name mydb_on_docker2-v mysqldata:/var/lib/mysql-d mysql

The new container uses the same volume mysqldata, but this time you don't need to specify the environment variable MYSQL_ROOT_PASSWORD, because the password is already stored in mysqldata.

Now Rex-Ray volume mysqldata has been mounted to docker2:

You can also use docker volume inspect and docker inspect to view specific mount information as before, and I won't repeat it here.

Follow these steps to verify the data for MySQL:

① enters the container mydb_on_docker2.

② logs in to the database with the same password as mydb_on_docker1.

③ switches to database mysql.

④ confirms that the tables and written data previously created by mydb_on_docker1 are intact.

Rex-Ray can provide cross-host volume, and its life cycle does not depend on Docker Host and containers, so it is an ideal data storage method for stateful containers.

How to use the volume driver of other storage provider, the deployment and configuration of storage provider are different, but Docker uses volume in the same way:

Create a volume through docker volume create-- driver.

Use-v to specify the volume created in the previous step when creating the container.

On how to use Rex-Ray volume across hosts to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report