Docker学习:安装Docker管理工具rancher

1,关于rancher

rancher是一个docker的管理系统。http://rancher.com/
相同类似的系统还有,http://shipyard-project.com/
Docker学习:安装Docker管理工具rancher
有管理界面的好处是,可以方便的查看有多少容器在运行,可以通过简单的界面点击,实现docker的功能。
同时也能够方便的检查系统的运行状况,资源消耗等。
类似于daoCloud和灵云雀等docker的容器服务。
安装的环境是在coreos系统上。

2,下载安装

安装文档参考:
http://docs.rancher.com/rancher/quick-start-guide/
直接下载即可:

docker pull rancher/server
docker run -d --restart=always -p 8080:8080 rancher/server

镜像下载:一共775.9MB要用daoCLoud镜像下载。

rancher/server      latest              26bce58807d1        2 weeks ago         775.9 MB

安装要求docker 1.9.1+,1G RAM
并且mysql max_connections setting > 150
这里先安装一个单机环境测试下。
启动非常慢。需要启动32个服务:

2016-04-12 12:50:01,529 INFO    [main] [ConsoleStatus] [1/32] [0ms] [0ms] Loading bootstrap 
2016-04-12 12:50:01,740 INFO    [main] [ConsoleStatus] [2/32] [211ms] [211ms] Loading config-defaults 
2016-04-12 12:50:10,398 INFO    [main] [ConsoleStatus] [3/32] [8869ms] [8658ms] Loading system 
2016-04-12 12:50:10,516 INFO    [main] [ConsoleStatus] [4/32] [8987ms] [118ms] Loading defaults 
2016-04-12 12:50:11,143 INFO    [main] [ConsoleStatus] [5/32] [9614ms] [627ms] Loading types 
2016-04-12 12:50:17,801 INFO    [main] [ConsoleStatus] [6/32] [16272ms] [6657ms] Loading system-services 
2016-04-12 12:50:18,261 INFO    [main] [ConsoleStatus] [7/32] [16732ms] [460ms] Loading agent-server 
2016-04-12 12:50:18,762 INFO    [main] [ConsoleStatus] [8/32] [17233ms] [501ms] Loading allocator-server 
2016-04-12 12:50:21,995 INFO    [main] [ConsoleStatus] [9/32] [20466ms] [3232ms] Loading api-server 
2016-04-12 12:50:25,014 INFO    [main] [ConsoleStatus] [10/32] [23485ms] [3019ms] Loading iaas-api 
2016-04-12 12:50:25,148 INFO    [main] [ConsoleStatus] [11/32] [23619ms] [130ms] Loading archaius 
2016-04-12 12:50:25,613 INFO    [main] [ConsoleStatus] [12/32] [24084ms] [465ms] Loading core-model 
2016-04-12 12:50:25,649 INFO    [main] [ConsoleStatus] [13/32] [24120ms] [36ms] Loading core-object-defaults 
2016-04-12 12:50:25,746 INFO    [main] [ConsoleStatus] [14/32] [24217ms] [97ms] Loading encryption 
2016-04-12 12:50:29,949 INFO    [main] [ConsoleStatus] [15/32] [28420ms] [4201ms] Loading process 
2016-04-12 12:50:30,021 INFO    [main] [ConsoleStatus] [16/32] [28492ms] [71ms] Loading redis 
2016-04-12 12:50:30,138 INFO    [main] [ConsoleStatus] [17/32] [28609ms] [117ms] Starting bootstrap 
2016-04-12 12:50:30,141 INFO    [main] [ConsoleStatus] [18/32] [28612ms] [0ms] Starting config-defaults 
2016-04-12 12:50:30,141 INFO    [main] [ConsoleStatus] [19/32] [28612ms] [0ms] Starting system 
2016-04-12 12:50:30,142 INFO    [main] [ConsoleStatus] [20/32] [28613ms] [0ms] Starting defaults 
2016-04-12 12:50:30,142 INFO    [main] [ConsoleStatus] [21/32] [28613ms] [0ms] Starting types 
2016-04-12 12:50:34,062 INFO    [main] [ConsoleStatus] [22/32] [32533ms] [3920ms] Starting system-services 
2016-04-12 12:50:34,063 INFO    [main] [ConsoleStatus] [23/32] [32534ms] [1ms] Starting agent-server 
2016-04-12 12:50:34,063 INFO    [main] [ConsoleStatus] [24/32] [32534ms] [0ms] Starting allocator-server 
2016-04-12 12:50:34,748 INFO    [main] [ConsoleStatus] [25/32] [33219ms] [685ms] Starting api-server 
2016-04-12 12:50:36,763 INFO    [main] [ConsoleStatus] [26/32] [35234ms] [2015ms] Starting iaas-api 
2016-04-12 12:50:36,774 INFO    [main] [ConsoleStatus] [27/32] [35245ms] [2ms] Starting archaius 
2016-04-12 12:50:36,774 INFO    [main] [ConsoleStatus] [28/32] [35245ms] [0ms] Starting core-model 
2016-04-12 12:50:36,774 INFO    [main] [ConsoleStatus] [29/32] [35245ms] [0ms] Starting core-object-defaults 
2016-04-12 12:50:36,775 INFO    [main] [ConsoleStatus] [30/32] [35246ms] [1ms] Starting encryption 
2016-04-12 12:50:36,791 INFO    [main] [ConsoleStatus] [31/32] [35262ms] [16ms] Starting process 
2016-04-12 12:50:36,794 INFO    [main] [ConsoleStatus] [32/32] [35265ms] [1ms] Starting redis 
time="2016-04-12T12:50:36Z" level=info msg="Starting websocket proxy. Listening on [:8080], Proxying to cattle API at [localhost:8081], Monitoring parent pid [11]."

启动之后进入管理界面:
Docker学习:安装Docker管理工具rancher

3,增加主机

首先创建一个host主机。测试就把本机当成一个主机吧。
一定要执行那个命令,执行完成之后就把本机当成一个客户端了。其实下载的rancher/agent ,并且把客户端注册上。
Docker学习:安装Docker管理工具rancher
当然还支持其他主机。亚马逊,和ssh方式登录的主机。
继续漫长的等待,因为网速的问题,在国内搭建环境还是非常费力的,得赶紧学会创建私服。
然后执行命令就行了。但是但是,没有添加成功。
是因为coreos的原因么??

4,容器

主机增加成功之后就可以增加一个容器了。
Docker学习:安装Docker管理工具rancher
比如增加一个tomcat,这个太直观了,将docker的参数命令都写到界面上了,方便配置。
主机都没有添加成功,自然容器也没有 正常启动。
Docker学习:安装Docker管理工具rancher
看日志:

itioningInternalMessage=null, previousIds=null, data={}, time=Tue Apr 12 13:43:45 UTC 2016, listenerKey=null, transitioningProgress=null]] 
2016-04-12 13:43:45,297 ERROR [a6949f7c-dc4e-46c9-9919-a44754211614:29] [instance:1] [instance.start->(InstanceStart)->instance.allocate] [] [ecutorService-3] [c.p.e.p.i.DefaultProcessInstanceImpl] Unknown exception io.cattle.platform.eventing.exception.EventExecutionException: Scheduling failed: No candidates available
        at io.cattle.platform.eventing.exception.EventExecutionException.fromEvent(EventExecutionException.java:53) ~[cattle-framework-eventing-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.eventing.impl.AbstractEventService.callSync(AbstractEventService.java:258) ~[cattle-framework-eventing-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.process.common.handler.EventBasedProcessHandler.handle(EventBasedProcessHandler.java:109) ~[cattle-iaas-logic-common-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.process.instance.InstanceAllocate.handle(InstanceAllocate.java:48) ~[cattle-iaas-logic-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl.runHandler(DefaultProcessInstanceImpl.java:446) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl$4.execute(DefaultProcessInstanceImpl.java:393) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl$4.execute(DefaultProcessInstanceImpl.java:387) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.engine.idempotent.Idempotent.execute(Idempotent.java:42) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl.runHandlers(DefaultProcessInstanceImpl.java:387) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl.runLogic(DefaultProcessInstanceImpl.java:493) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]
        at io.cattle.platform.engine.process.impl.DefaultProcessInstanceImpl.runWithProcessLock(DefaultProcessInstanceImpl.java:320) [cattle-framework-engine-0.5.0-SNAPSHOT.jar:na]

好吧,我还以为所有的服务都是用go写的呢,原来这个是java的服务呢,为啥内存消耗1G知道原因了。

5,总结

终于找到一个超级NB的docker管理系统,虽然系统还没有跑起来,但是雏形已经基本有了。
可以像大多数docker容器服务一样有强大的界面功能。
开发人员可以轻松的创建镜像,管理服务。
想了想,目前想可有可能是coreos的问题。明天换下CentOS7再试验下。

相关推荐