Quickstart: Replicate A File

 

To replicate a file, you need a setup with at least two OSDs. Since XtreemFS uses majority voting, a fault-tolerant setup requires at least three replicas. For testing, you can run multiple OSDs on the same machine, just make sure that they use differen ports (http_port and listen.port in osdconfig.properties).

  1. create and mount a volume (see install & setup)
  2. copy a file, e.g. a short movie for demonstration into the mounted XtreemFS volume
    > cp ~/movie.avi ~/xtreemfs/
  3. check the replicas for the file
    > xtfsutil ~/xtreemfs/movie.avi
    Path (on volume)     /movie.avi
    XtreemFS file Id     4f8ca1c5-a824-4566-b31d-13dfbd71c437:403
    XtreemFS URL         pbrpc://localhost:32638/regular/movie.avi
    Owner                user
    Group                users
    Type                 file
    Replication policy   none (not replicated)
    XLoc version         0
    Replicas:
      Replica 1
         Striping policy     STRIPING_POLICY_RAID0 / 1 / 128kB
         OSD 1               test-osd1/127.0.0.1:32641
    
  4. now we can change the replication mode for the file to read/write replication with majority voting:
    > xtfsutil -r WqRq ~/xtreemfs/movie.avi
  5. check the list of OSDs that can be used to create a new replica of the file:
    > xtfsutil -l ~/xtreemfs/movie.avi
    OSDs suitable for new replicas: 
      test-osd0
      test-osd2
    
    If the list is empty, please make sure that your setup is correct and that both OSDs are registered with the directory service.
  6. add a new replica for the file
    > xtfsutil -a auto ~/xtreemfs/movie.avi

    A new replica is now created on the second OSD which automatically fetches the data from the original copy of the file.
  7. You can now try the failover by e.g. watching the movie with a player (we tested it with mplayer). Use the OSDs status page to check which OSD is currently used and then kill it. The client will automatically switch to the second OSD.

    For more advanced setups please read the section about Replica Selection Policies in the user guide.
  8. If you want all new files on the volume to be replicated automatically, you can set the default replication policy. This policy defines how new files are replicated, it doesn't affect files that already exist.
    > xtfsutil --set-drp --replication-policy WqRq --replication-factor 3 ~/xtreemfs

    Now all new files will be created with three replicas.