Operating Environment
[Root@docker-node-1 ~]# Docker version
Client:
version: 1.13.1
API version: 1.26
Go version : go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:38:28 os/arch
: linux/ AMD64
Server:
version: 1.13.1
API version: 1.26 (minimum Version 1.12)
Go Version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 06:38:28
os/arch: linux/amd64
Experimental:false
[Root@docker-node-1 ~]# Cat/etc/redhat-release
Operation StepsOfficially, convoy supports a variety of back-end storage, such as Devicemapper,nfs,ebs, and so on, with the example of Devicemapper and NFS configured.
Configuring NFS for Convoy back-end storage1. Configure NFS Server
#yum-y Install Nfs-utils
Configuring the NFS Directory
[Root@docker-manager ~]# vi/etc/exports
/convoy-nfs * (Rw,no_root_squash,no_all_squash,sync)
Start NFS
[Root@docker-manager ~]# systemctl start Rpcbind
[Root@docker-manager ~]# Systemctl start NFS
2. Configuring the NFS Client
#yum-y Install Nfs-utils
Mount NFS Server
[Root@docker-node-1 ~]# mount-t NFS 10.10.200.226:/convoy-nfs/convoy-nfs/
3. Configure Convoy
A. Download convoy
#wget https://github.com/rancher/convoy/releases/download/v0.5.0/convoy.tar.gz
#tar xvzf convoy.tar.gz
# CP Convoy/convoy convoy/convoy-pdata_tools/usr/local/bin/
B. Configuring convoy
#mkdir-P/etc/docker/plugins/
#bash-C ' echo "Unix:///var/run/convoy/convoy.sock" >/etc/docker/plugins/ Convoy.spec '
C. Start Convoy
[root@docker-node-1 rancher]# Convoy daemon--drivers VFS--driver-opts vfs.path=/convoy-nfs DEBU[0000] Creating config A T/var/lib/rancher/convoy Pkg=daemon debu[0000] Driver=vfs driver_opts=ma P[VFS.PATH:/CONVOY-NFS] Event=init Pkg=daemon reason=prepare Root=/var/lib/rancher/convoy DEBU[0000] Driver=vfs event=init Pkg=daemon reason=complete debu[0000] registering GET,/info Pkg=daemon debu[0000] Registering get,/volumes/list Pkg=daemon debu[0000] registering GET,/volum Es/pkg=daemon debu[0000] Registering GET,/snapshots/pkg=daemon debu[0000] Registeri Ng get,/backups/list Pkg=daemon debu[0000] registering GET,/backups/inspect Pkg=daemon debu[0 Registering post,/backups/create Pkg=daemon debu[0000] registering post,/volumes/create pkg =daemon debu[0000] RegistEring Post,/volumes/mount Pkg=daemon debu[0000] registering POST,/volumes/umount Pkg=daemon DEB U[0000] Registering POST,/snapshots/create Pkg=daemon debu[0000] registering DELETE,/volumes/ Pkg=daemon debu[0000] Registering Delete,/snapshots/pkg=daemon debu[0000] registering DELETE,/backups Pkg=daemon debu[0000] Registering plugin handler POST,/volumedriver.create Pkg=daemon debu[0000] Registeri Ng Plugin handler post,/volumedriver.remove Pkg=daemon debu[0000] Registering plugin handler post,/volumedriver.mount Pkg=daemon debu[0000] Registering plugin handler POST,/volumedriver.unmount Pkg=daemon debu[0000] registering plugin Han Dler Post,/volumedriver.path Pkg=daemon debu[0000] Registering plugin handler POST,/volumedriver.get Pkg=daemon DEBU[0 Registering plugin handler post,/volumedriver.list Pkg=daemon debu[0000] Registering plugin handler post,/plugin.a Ctivate Pkg=daemon
D. Create Volume
[root@docker-node-1 ~]# Convoy Create nfstest
E. View volume
[root@docker-node-1 ~]# Convoy list {"Nfstest": {"Name": "Nfstest", "Driver": "V FS "," Mountpoint ":" "," Createdtime ":" Thu Dec 00:40:04-0500 "," D Riverinfo ": {" Driver ":" VFS "," Mountpoint ":" ","
Path ":"/convoy-nfs/nfstest "," PREPAREFORVM ":" false "," Size ":" 0 ",
"Volumecreatedat": "Thu Dec 00:40:04-0500", "VolumeName": "Nfstest" }, "Snapshots": {}}} [root@docker-node-1 ~]# convoy inspect nfstest {"Name
":" Nfstest "," Driver ":" VFS "," Mountpoint ":" "," Createdtime ":" Thu Dec 14 00:40:04-0500 2017 ", "Driverinfo": {"Driver": "VFS", "Mountpoint": "", "Path": "/convo
Y-nfs/nfstest ", "PREPAREFORVM": "false", "Size": "0", "volumecreatedat": "Thu Dec 14 00:40:04-050 0 "," volumename ":" Nfstest "}," Snapshots ": {}}
You can also find it through Docker volume.
[Root@docker-node-1 ~]# docker volume ls
DRIVER volume NAME
block:latest bbtest
Block: Latest blockbridge-3
local blockbridgesimulator_bb_data
local centos7-1 Local Centos7-2
block:latest data
block:latest data1
block:latest data2
Block: Latest data3
local dmtest
convoy nfstest
local test
[ Root@docker-node-1 ~]# Docker Volume ls-f Driver=convoy
driver volume NAME
convoy nfstest
F. Creating container
Create a container through the volume above
[Root@docker-node-1 ~]# Docker run-ti-v nfstest:/data--volume-driver=convoy--name convoycentos CentOS [root@e53d2469c 662/]# df-h Filesystem Size Used Avail use% mounted on/dev/mapper/docker-253 : 1-1073870859-68690cb6b91e73d7e94e7fa854386256c3006a7845ae9763be1a18df1f9ecb8d 10G 247M 9.8G 3%/TMPFS 7.8G 0 7.8G 0%/dev Tmpfs 7.8G 0 7.8G 0%/sys/fs/c Group/dev/mapper/centos-root 905G 163G 74 3G 18%/data SHM 64M 0 64M 0%/dev/shm tmpfs 7.8G 0 7.8G 0%/sys/firmware
G. Creating snapshot
You can create a file nfstest in the container data directory above, and write the characters nfstest
[root@e53d2469c662/]# touch/data/nfstest
[root@e53d2469c662/]# echo nfstest >/data/nfstest
[ root@e53d2469c662/]# cat/data/nfstest
nfstest
At this point, we nfstest volume for snapshot operation, we can see nfstest volume inspect information inside more snapshot column
[root@docker-node-1 ~]# Convoy snapshot Create nfstest--name nfstestsnap1 nfstestsnap1 [root@docker-node-1 ~]# Convoy INS Pect nfstest {"Name": "Nfstest", "Driver": "VFS", "Mountpoint": "/convoy-nfs/nfstest", "C Reatedtime ":" Thu Dec 00:40:04-0500 "," Driverinfo ": {" Driver ":" VFS "," M
Ountpoint ":"/convoy-nfs/nfstest "," Path ":"/convoy-nfs/nfstest "," PREPAREFORVM ":" false ", "Size": "0", "volumecreatedat": "Thu Dec 00:40:04-0500", "Volume Name ":" Nfstest "}," snapshots ": {" Nfstestsnap1 ": {" name ":" Nfst Estsnap1 "," Createdtime ":" Thu Dec 00:49:27-0500 "," Driverinfo ": {"Driver": "VFS", "FilePath": "/VAR/LIB/RANCHER/CONVOY/VF S/snapshots/nfstest_nfstEstsnap1.tar.gz "," Snapshotcreatedat ":" Thu Dec 14 00:49:27-0500 2017 ",
"Snapshotname": "Nfstestsnap1", "Volumeuuid": "Nfstest" }
}
}
}
H. Backing up the snapshot, restoring
Backing Up the snapshot
[Root@docker-node-1 ~]# Convoy backup Create Nfstestsnap1--dest vfs:///convoy-nfs/vfs:///convoy-nfs/?backup=
Backup-fd83d8d5e82640cf\u0026volume=nfstest
Restore a backup to a new volume
[root@docker-node-1 ~]# Convoy create Backup1--backup Vfs:///convoy-nfs/?backup=backup-fd83d8d5e82640cf\u0026volume
=nfstest Backup1 [root@docker-node-1 ~]# convoy list {"Backup1": {"Name": "Backup1",
"Driver": "VFS", "Mountpoint": "", "Createdtime": "Thu Dec 14 00:57:20-0500 2017",
"Driverinfo": {"Driver": "VFS", "Mountpoint": "", "Path": "/convoy-nfs/backup1", "PREPAREFORVM": "false", "S Ize ": 0", "volumecreatedat": "Thu Dec 00:57:20-0500", "Volumenam E ":" Backup1 "}," Snapshots ": {}}," Nfstest ": {" Name ":" Nfstest "," Driver ":" VFS "," Mountpoint ":"/convoy-nfs/nfstest "," createdti Me ":" Thu Dec 14 00:40:04-0500 "," Driverinfo ": {" Driver ":" VFS "," Mountpoint ":"/ Convoy-nfs/nfstest "," Path ":"/convoy-nfs/nfstest "," PREPAREFORVM ":" False
"," Size ":" 0 "," volumecreatedat ":" Thu Dec 14 00:40:04-0500 2017 ", "VolumeName": "Nfstest"}, "snapshots": {"nfst Estsnap1 ": {" Name ":" Nfstestsnap1 "," Createdtime ":" Thu D EC 00:49:27-0500 "," Driverinfo ": {" drive R ":" VFS "," FilePath ":"/var/lib/rancher/convoy/vfs/snapshots/nfstest_nfstestsnap1
. tar.gz "," Snapshotcreatedat ":" Thu Dec 14 00:49:27-0500 2017 ", "Snapshotname ":" Nfstestsnap1 "," Volumeuuid ":" Nfstest "
}
}
}
}
}
We can start the new container via backup volume
[Root@docker-node-1 ~]# Docker run-ti-v backup1:/date1--volume-driver=convoy CentOS [root@c07365b75d20/]# df-h Filesy Stem Size used Avail use% Moun Ted On/dev/mapper/docker-253:1-1073870859-e0fefab5d8e8e68d3481d186b04a409e9ef235393cd6bd80dcab5fe3958bcc33 10G 247M 9.8G 3%/Tmpfs 7. 8G 0 7.8G 0%/dev Tmpfs 7.8G 0 7.8G 0%/sys/fs/cgroup/dev/mapper/centos-root 905G 163G 743G 18%/date1 SHM 64M 0 64M 0%/dev/shm tmpfs 7.8G 0 7.8G 0%/sys/firmware [root@c07365b75d20/]# cat/date1/nfstest nfstest
We can see the nfstest file written in the previous container data directory, also in the new container.
configuring Devicemapper for Convoy back-end storageConfigure Devicemapper as the back-end storage for convoy, you must have two block devices in advance, one to store data, and another to store metadata
#truncate-S 100G data.vol
#truncate-S 1G metadata.vol
#losetup/dev/loop5 data.vol
#losetup/DEV/LOOP6 Metadata.vol
Start convoy
[root@docker-node-1 rancher]# Convoy daemon--drivers devicemapper--driver-opts dm.datadev=/dev/loop5--driver-opts DM.METADATADEV=/DEV/LOOP6 debu[0000] Found existing config. Ignoring command line opts, loading config From/var/lib/rancher/convoy Pkg=daemon debu[0000] Driver=vfs driver_opts=map[dm.datadev:/dev/loop5 DM.METADATADEV:/DEV/LOOP6] Event=init Pkg=daemon Reaso N=prepare Root=/var/lib/rancher/convoy debu[0000] Driver=vfs event=init pkg= Daemon Reason=complete debu[0000] registering post,/volumes/create Pkg=daemon debu[0000] registering post,/V Olumes/mount Pkg=daemon debu[0000] registering POST,/volumes/umount Pkg=daemon debu[0000] Regist Ering Post,/snapshots/create Pkg=daemon debu[0000] registering POST,/backups/create Pkg=daemon DEB U[0000] Registering DELETE,/volumes/pkg=daemon debu[0000] registering DELETE,/snapshots/pkg=daemon debu[0000] registering DELETE,/backups Pkg=daemon debu[0000] R Egistering get,/info Pkg=daemon debu[0000] registering GET,/volumes/list Pkg=daemo N debu[0000] registering get,/volumes/pkg=daemon debu[0000] registering get,/snapshots/ Pkg=daemon debu[0000] Registering get,/backups/list Pkg=daemon debu[0000] registering GET,/backups/i Nspect Pkg=daemon debu[0000] Registering plugin handler POST,/volumedriver.unmount Pkg=daemon debu[0000] Reg Istering Plugin handler post,/volumedriver.path Pkg=daemon debu[0000] Registering plugin handler post,/volumedriver.get Pkg=daemon debu[0000] Registering plugin handler POST,/volumedriver.list Pkg=daemon debu[0000] Registering plugin hand Ler post,/plugin.activate Pkg=daemon debu[0000] registering Plugin handler POST,/volumedriver.create Pkg=daemon DEBU[0 ] Registering pluginHandler post,/volumedriver.remove Pkg=daemon debu[0000] Registering plugin handler POST,/volumedriver.mount Pkg=daemon
The subsequent operation is similar to the previous operation of NFS as a back-end store, and no explanation is given.