Archipel 安装与配置

Archipel 是一个管理和监督虚拟机的开源解决方案。->项目主页 ->GitHub地址

Architecture

Archipel Agent --即上图的Physical Hypervisor 安装在每台物理机上
Archipel Client --即上图的Archipel GUI,安装在任意一台linux电脑上

一. Ejabberd XMPP 服务器端的配置安装

Archipel

XMPP服务器的域名就是本机的hostname, 我的hostname是 alecyrus.org , 这个可与通过命令" # hostname"得到,一般默认是ubuntu, 如果需要修改,可运行以下命令,别忘了之后在/etc/hosts 文件中,172.0.1.1 后在ubuntu后并列添加YourHostname,否则无法修改成功.

# hostname YourHostname
# echo YourHostname > /etc/hostname

1:安装ejabberd(至少15.04版本)

# echo "deb https://apt.jabber.at trusty ejabberd" > /etc/apt/sources.list.d/jabber.at.list
# wget -qO- https://apt.jabber.at/gpg-key | apt-key add -
# apt-get update
# apt-get install ejabberd

注:我是在ejabberd15.04版本下测试的,deb安装或者installer安装都行。两种方式安装后,打开关闭重启ejabberd服务的操作略有区别。具体查看ejabberd官方文档如果安装后使用命令开启ejabberd服务时报错,诸如Failed RPC connection... File Operate Error... 说明ejabberd安装出错,自行查看log解决。

2:安装必需的依赖包(ArchipelAgent也需要安装这些依赖包)
# apt-get install -y git build-essential qemu-kvm libvirt-bin libvirt-dev python-setuptools python-numpy python-imaging python-apscheduler python-sqlalchemy python-libvirt subversion python-dev

3:配置Ejabberd
老版本是ejabberd.cfg, 现在的版本都是yaml配置文件(ejabberd.yml)。
如下:

###
###             ejabberd configuration file
###         Archipel Sample default condiguration

###     =========================================
###     DEBUGGING


loglevel: 4

###     =========================================
###     SERVED HOSTNAMES

hosts:
    - "alecyrus.org"

###     =========================================
###     LISTENING PORTS

listen:
-
 
  port: 4560
  module: ejabberd_xmlrpc
  access_commands:
        xmlrpcaccess:
            all : []

## ejabberd c2s
-
  port: 5222
  module: ejabberd_c2s
  max_stanza_size: 65536000
  shaper: c2s_shaper
  access: c2s

## ejabbed s2s
-
  port: 5269
  module: ejabberd_s2s_in
  max_stanza_size: 65536000

-
  port: 5280
  module: ejabberd_http
  request_handlers:
    "/xmpp": ejabberd_http_ws
  web_admin: true
  http_bind: true

###     ========================================
###     S2S
s2s_policy: s2s_access
s2s_use_starttls: optional


###     =========================================
###     AUTHENTICATION

auth_method: internal

###     =========================================
###     TRAFFIC SHAPERS

shaper:
  # in B/s
  normal: 1000
  fast: 50000000

###     =========================================
###     ACCESS CONTROL LISTS

acl:
admin:
    user:
        - "admin": "alecyrus.org"
local:
    user_regexp: ""


###     =========================================
###     ACCESS RULES

access:
max_user_sessions:
    all: 10
local:
    local: allow
c2s:
    blocked: deny
    all: allow
c2s_shaper:        
    admin: none
    all: fast
s2s_shaper:
    all: fast
s2s_access:
    all: allow
announce:
    admin: allow
configure:
    admin: allow
muc_admin:
    admin: allow
muc_create:
    local: allow
muc:
    all: allow
pubsub_createnode:
    all: allow
register:
    all: allow
xmlrpcaccess:
    admin : allow

registration_timeout: infinity

###     ========================================
###     DEFAULT LANGUAGE

language: "en"

###     ========================================
###     MODULES

modules:
  mod_admin_extra: []
  mod_adhoc: []
  mod_announce:
    access: announce
  mod_caps: []
  mod_configure: []
  mod_disco: []
  mod_http_bind:
    max_inactivity: 400 
  mod_irc: []
  mod_last: []
  mod_muc:
    access: muc
    access_create: muc_create
    access_persistent: muc_create
    access_admin: muc_admin
  mod_offline: []
  mod_privacy: []
  mod_private: []
  mod_pubsub:
    access_createnode: pubsub_createnode
    ignore_pep_from_offline: true
    last_item_cache: false
    max_items_node: 1000
    plugins:
        - "flat"
        - "hometree"
        - "pep"
  mod_register:
    access: register
  mod_roster: []
  mod_shared_roster: []
  mod_time: []
  mod_vcard: []
  mod_version: []

然后重启ejabberd服务(DEB安装方式),如果是installer安装,桌面上有俩快捷方式,若没有,进入ejabberd安装目录/bin/, 运行相关命令即可

# /etc/init.d/ejabberd restart


注:如果重启不成功,使用以下命令来查看启动服务过程中是哪里出问题,一般都是配置文档
出错,语法,模块错误什么的。

# ejabberdctl live

4:ejabberd xmpp服务器admin账户的注册(DEB安装方式,若是install方式,在安装ejabberd时就创建好了)

# ejabberdctl register admin alecyrus.org YourPassWd

二. Archipel Agent的配置安装

Archipel Agent是需要安装在每台物理机上,物理机上的Virtual Machine Monitor 可以是KVM、Xen、VMware... ,以后如果需要把某台物理机上的全部KVM虚拟机添加到Archipel,那就需要在这台物理机上安装Archipel Agent.

前提:能够正常创建虚拟机,qumu,kvm这些的安装好。

1:下载Archipel以及安装

# git clone https://github.com/ArchipelProject/Archipel.git
# cd Archipel
# ./pull.sh
# easy_install apscheduler sqlalchemy numpy
# cd ArchipelAgent
# ./buildAgent -d
# archipel-initinstall

注:通常在archipel-initinstall加上 -x FQDN(# archipel-initinstall -x alecyrus.org), 意思就是指定这台Physical Hypervisor将要连接的XMPP服务 器 的地址,如果你XMPP服务器和Physical Hypervisor安装在同一台机器上,比如现在,那么Physical Hypervisor 中Archipel的配置没问题,同一台机器,Physical Hypervisor 和XMPP服务器当然能够互相ping通。
但是如果以后XMPP服务器配置好了,你想把其他的Physical Hypervisor 添加到XMPP服务器上让ArchipelClient一并管理,如果还是如此配置,那么这台Physical Hypervisor 就无法识别alecyrus.org, 所以在其他机器安装ArchipelAgent,别忘了在hosts文件中添加alecyrus.org 和XMPP服务器ip的映射。同时,保证XMPP服务器与Physical Hypervisor 能相互ping通。

2:将这台Physical Hypervisor 的ArchipelAgent初始化到XMPP服务器,使用你的XMPP服务器的管理员账号。
# archipel-tagnode -j [email protected] -p YourPassWD --create
# archipel-rolesnode -j [email protected] -p YourPassWD --create
# archipel-adminaccounts -j [email protected] -p YourPassWD --create

3:配置Archipel Agent

编辑/etc/archipel.conf, 添加以下内容

[MODULES]

action_scheduler            = True
centraldb                   = True
geolocalization             = True
hypervisor_health           = True
hypervisor_network          = True
hypervisor_vmcasts          = True
iphone_notification         = False
oomkiller                   = True
snapshoting                 = True
storage                     = True
virtualmachine_appliance    = True
vnc                         = True
xmppserver                  = True
vmparking                   = True  # needs centraldb to be     activated

[CENTRALAGENT]
# centralagent can be :
#  - auto (default) : will be central agent if there is none already started
#  - force : will be central agent (be careful to configure only one of your hypervisors this way)
centralagent               = auto

[VNC]
vnc_certificate_file                        = None
vnc_only_ssl                                = False
vnc_enable_websocket_debug                  = True

注:最后将machine_ip由auto改成这台hypervisor的ip地址,这样方便archipel查看ip地址。

4:重启Archipel

 # /etc/init.d/archipel restart

三. Archipel Client安装

Archipel Client就是一个web应用,通过官方发布的The nightlies版本可以很方便的安装的,但经过测试(Ubuntu 14.04LTS),项目作者把centralAgent也加入admin list后,centralAgent就无法正常安装了,bu
以下命令在之前clone命令的同级目录下进行,即开始这条命令时,ls命令可以可以看到之前的Archipel文件夹。

# wget http://nightlies.archipelproject.org/latest-archipel-client.tar.gz
# tar -xzf latest-archipel-client.tar.gz

四. 最后的工作

进入Archipel目录开启HTTP服务

1:开启8000端口

# python -m SimpleHTTPServer

注:务必进入Archipel目录运行这个命令

2:
打开网址:localhost:8000


Archipel 安装与配置_第1张图片

登陆信息如上
然后添加安装了Archipel Agent的Physical Hypervisor 的JID...

这个JID的格式可以在archipel.conf 中看到。。如下:

我这里是alecyrus@%(xmpp_server)s,,也就是说JID为:
[email protected]

Archipel 安装与配置_第2张图片

Archipel 安装与配置_第3张图片
2016-01-18 02:04:30屏幕截图.png

添加完成后,就可以在这里看到你的物理机的虚拟机管理程序了,不过它变了样子

Archipel 安装与配置_第4张图片
2016-01-18 02:14:08屏幕截图.png

一个Physical Hypervisor就是你的一个联系人,这个联系人下面可以有很多的虚拟机,你也可以把虚拟机添加联系人中。

Done!

你可能感兴趣的:(Archipel 安装与配置)