百度智能云

All Product Document

          Object Storage

          Operation Example

          This section takes the synchronization of the data of two buckets as examples, and explains the use of BOS FS.

          Assume that there are two buckets: bucket-a and bucket-b, and these two buckets may be located at different Region (for example, Beijing and Guangzhou). The data of bucket-a needs to be backup at bucket-b due to business needs, and only the changed files are synchronized to reduce the expenditure. This can be done according to the following steps:

          1.Find a virtual machine with available Centos mirror (buy one if not available) and open EIP service;

          2.Install bosfs;

          3.Use bosfs mounting command to mount the bucket-a and bucket-b to local two directories of bucket-a and bucket-b;

          4.Use the command rsync -av --partial-dir=/tmp bucket-a bucket-b to start to synchronize the data of these two buckets.

          5.Consider adding the command rsync into crontab for perodic execution.

          Note:

          • When a file is synchronized, it takes up space under the directory of/tmp or specified directory of cache, which is released when the file is synchronized. Therefore, you need to make sure to have enough disk space locally.
          • When the command rsync is used, try to add the option --partial-dir=/tmp, and place the temporary file under the tem directory.
          • The synchronization speed may be slow if you use one rsync process, and the synchronization speed may also be affected by the stand-alone network card if another machine is use. Therefore, if the directory structure of synchronized bucket itself can be split, you may consider operating multiple rsync processes in parallel, or deploying several virtual machines to synchronize different sub-directories in parallel.
          • If the same file is operated at multiple mount points at the same time, BOS cannot guarantee a predictable result, which may result in file truncation, write loss, or a newly written file that cannot be read at another mount point, so it needs to be avoided.
          • In terms of this example, as the two buckets are located in different Regions, so EIP needs to be opened. EIP service needs to be opened as long as any of the two buckets and BCC crosses regions, and EIP service do not need to be opened if all the three are located in the same Region.
          Previous
          Operation
          Next
          Version Change Record