下文给大家带来调用cinder-backup实现Freezer - 备份云硬盘,希望能够给大家在实际运用中带来一定的帮助,云硬盘涉及的东西比较多,理论也不多,网上有很多书籍,今天我们就用亿速云在行业内累计的经验来做一个解答。
freezer api底层的restful api框架是基于falcon实现的。falcon简介:https://falconframework.org/
freezer scheduler基于APScheduler来实现定时备份的功能
具体实现见:https://github.com/yaoice/freezer-api/commit/4c3d371c28bc4635049bef4c037b7d1d36e9c532
使用curl测试api(freezer api使用keystone v2)
# keystone v2获取token curl -s -d '{"auth":{"passwordCredentials":{"username": "admin", "password": "cloud"},"tenantName": "demo"}}' -H "Content-Type: application/json" http://192.168.141.6:5000/v2.0/tokens | python -m json.tool # keystone v3获取token curl -i -H "Content-Type: application/json" -d ' { "auth": { "identity": { "methods": ["password"], "password": { "user": { "name": "admin", "domain": { "id": "default" }, "password": "cloud" } } } } }' http://localhost:5000/v3/auth/tokens ; echo # 获取cinder所有的backups,纯属测试 curl -s -H "X-Auth-Token: fced5d5ae9e84009b3dca7972d7c5131"\ -X GET\ -H "Content-type: application/json"\ http://192.168.141.6:8776/v2/b232965aeb9c4b3a883ce41b16394e3f/backups | python -m json.tool # freezer获取backup list curl -s -H "X-Auth-Token: fced5d5ae9e84009b3dca7972d7c5131" -X GET -H "Content-type: application/json" http://192.168.141.6:9090/v1/cinderbackups | python -m json.tool # freezer创建backup curl -s -H "X-Auth-Token: fd60f3b93b2841e893269b887572c26d" -X POST -H "Content-type: application/json" -d '{"volume_id": "438de34e-ef9e-4f4f-b047-600ab6229cc0"}' http://192.168.141.6:9090/v1/cinderbackups # freezer删除backup curl -s -H "X-Auth-Token: 76744b82dd8c49c490eb7c0ca5f33824" -X DELETE -H "Content-type: application/json" http://192.168.141.6:9090/v1/cinderbackups/1ffe9901-43de-490e-b675-0bb92e50c4f4 # freezer还原备份,并创建一个新volume curl -s -H "X-Auth-Token: 232685c229fd48d4b24629f7748bceda" -X POST -H "Content-type: application/json" http://192.168.141.6:9090/v1/cinderrestores/ed3e05bd-c892-441c-b9c6-226bbb030794 # freezer针对某个volume备份还原 curl -s -H "X-Auth-Token: 232685c229fd48d4b2a629f7748bceda" -X POST -H "Content-type: application/json" -d '{"volume_id": "496a7db9-3197-4658-9cc6-ef496f2b0cd1"}' http://192.168.141.6:9090/v1/cinderrestores/da1b7290-5e56-43ff-b95f-a1c511b305d2
看了以上关于调用cinder-backup实现Freezer - 备份云硬盘,如果大家还有什么地方需要了解的可以在亿速云行业资讯里查找自己感兴趣的或者找我们的专业技术工程师解答的,亿速云技术工程师在行业内拥有十几年的经验了。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。