Nebula-orchestartor,广域网容器资源协调器
Nebula-orchestartor可以跨数据中心进行容器资源的管理。传统的资源协调器例如YARN/Mesos/Kubernetes都是在数据中心内部使用,假设集群内通过高速网络连接,主要用于数据密集或计算密集的场合。对于IoT、边缘计算、雾计算、多数据中心互联等广域网应用来说,面对传输延迟、低带宽、数据同步、容错恢复、服务路由、灾难备份等各种情况,需要开发新的解决方案。Nebula-orchestartor采用MongoDB进行数据存储,rabbitMQ作为数据通讯,具有扩展到广域网资源调度的潜力,不过目前还在早期发展阶段。这里通过一个简单的实例,可以体验Nebula-orchestartor的操作模式和能力。
参见:
- 官网:
- 源码:
- 文档:
快速入门教程
了解新技术的最好办法是亲自动手去做一做。下面的教程使用docker-compose快速设置一个 Nebula 集群。要求docker & docker-compose预先安装,推荐使用Docker for Mac的最新版本。
1)安装基础Docker镜像
- Note that some linux systems have epmd installed (Ubuntu included) which the following rabbitmq container requires so if your having problems with rabbit refusing to run try killing the host epmd and\or host rabbitmq-server for the duration of this tutorial
- First get the of this tutorial and save it locally on your machine
- Nebula is geared towards using a private registry but will also work with docker hub, to use your own user\pass (by default no auth is used) edit the docker-compose.yml by entering your docker hub user & password into "REGISTRY_AUTH_USER" & "REGISTRY_AUTH_PASSWORD" under the "worker" container, if your using a private registry change the "REGISTRY_HOST" variable as well to point to your private registry. from the directory where you saved docker-compose.yml at (same name is important) run
docker-compose up -d
(you might need tosudo su
first if you didn't set your user to be part of the docker group), don't worry if you see the worker-manager & api-manager restarting, it's because the mongo & rabbit containers aren't configured yet so they fail to connect to it
2)配置MongoDB
-
创建database的user & schema,命令如下:
docker exec -it mongo mongouse nebuladb.createUser( { user: "nebula", pwd: "nebula", roles: [ "readWrite" ] })
-
退出容器 (ctrl-d)。
3)配置rabbitMQ
-
创建 rabbitMQ的 user 和 vhost,命令如下:
docker exec -it rabbit shrabbitmqctl add_vhost nebularabbitmqctl add_user nebula nebularabbitmqctl set_permissions -p nebula nebula ".*" ".*" ".*"
-
退出容器 (ctrl-d)。
- Either wait for the changes to catch (they are examined at the container boot only so if the DB's schemas are not yet created the container restarts) or restart the api-manager & worker-manager containers
4)创建Worker-Nginx
现在Nebula cluster已经运行起来了, lets use Curl to create an nginx app to fill the "example" APP_NAME app that the worker-manager has set to manage:
curl -X POST \ http://127.0.0.1/api/apps/example \ -H 'authorization: Basic bmVidWxhOm5lYnVsYQ==' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -d '{ "starting_ports": [{"81":"80"}], "containers_per": {"server": 1}, "env_vars": {}, "docker_image" : "nginx", "running": true, "volumes": ["/tmp:/tmp/1", "/var/tmp/:/var/tmp/1:ro"], "networks": ["nebula"], "privileged": false, "devices": []}'
因为需要下载Nginx容器,如果以前机器上没有镜像,需要耐心等待.......
可以使用下面的命令查看进度(一直等待到结束通知):
docker logs -f work-manager
5)访问Worker服务
Either wait for the changes to catch (usually few seconds at most) or restart the worker-manager container, you now have your first nebula worker (try logging into 127.0.0.1:81 in your browser to see), because the network is internal in this tutorial you can only run more on the same machine (which kinda defeats the purpose) but after you deploy Nebula by following the guide you can run as many workers as you need by having multiple servers running the same worker-manager container with the same envvars\config file.
视频教程: