openstack组件通讯端口定义

openstack 组件通讯是通过ZeroMQ+ceilometer发送组件调用信息,具体是通过TCP通讯,发送数据和接收数据是用同一个端口(在配置文件指定),下面通过代码稍作解析:

IceHouse/ceilometer/ceilometer/openstack/common/rpc/impl_zmq.py

def _multi_send(method, context, topic, msg, timeout=None,
                envelope=False, _msg_id=None):
    """Wraps the sending of messages.

    Dispatches to the matchmaker and sends message to all relevant hosts.
    """
    conf = CONF
    LOG.debug(_("%(msg)s") % {‘msg‘: ‘ ‘.join(map(pformat, (topic, msg)))})

    queues = _get_matchmaker().queues(topic)
    LOG.debug(_("Sending message(s) to: %s"), queues)

    # Don‘t stack if we have no matchmaker results
    if not queues:
        LOG.warn(_("No matchmaker results. Not casting."))
        # While not strictly a timeout, callers know how to handle
        # this exception and a timeout isn‘t too big a lie.
        raise rpc_common.Timeout(_("No match from matchmaker."))

    # This supports brokerless fanout (addresses > 1)
    for queue in queues:
        (_topic, ip_addr) = queue
        _addr = "tcp://%s:%s" % (ip_addr, conf.rpc_zmq_port)

        if method.__name__ == ‘_cast‘:
            eventlet.spawn_n(method, _addr, context,
                             _topic, msg, timeout, envelope,
                             _msg_id)
            return
        return method(_addr, context, _topic, msg, timeout,
                      envelope)

debug日志:/var/log/ceilometer/compute.log

compute.log:2015-05-18 11:36:58.972 2436 DEBUG ceilometer.openstack.common.rpc.common [-] Sending message(s) to: [(u‘metering.ceilometer‘, u‘ceilometer‘)] _multi_send /usr/lib/python2.6/site-packages/ceilometer/openstack/common/rpc/impl_zmq.py:750
compute.log:2015-05-18 11:36:58.982 2436 DEBUG ceilometer.openstack.common.rpc.common [-] Sending message(s) to: [(u‘metering.ceilometer‘, u‘ceilometer‘)] _multi_send /usr/lib/python2.6/site-packages/ceilometer/openstack/common/rpc/impl_zmq.py:750

1. conf.rpc_zmq_port是通过/etc/nova/nova.conf中指定的,也即是nova服务(/usr/bin/oslo-messaging-zmq-receiver)启动的监听端口:

[[email protected] ceilometer]# netstat -lntp | grep 9502
tcp        0      0 192.168.213.202:9502        0.0.0.0:*                   LISTEN      17860/haproxy
tcp        0      0 192.168.213.88:9502         0.0.0.0:*                   LISTEN      7611/python
[[email protected] ceilometer]# ps -ef | grep 7611
nova      7611     1  0 May13 ?        00:00:02 /usr/bin/python /usr/bin/oslo-messaging-zmq-receiver --config-file /etc/nova/nova.conf
root     26349 20271  0 11:44 pts/2    00:00:00 grep 7611

2. 通过上面代码可以看到nova与ceilometer通讯的指定的目的端口也是rpc_zmq_port,由此可以得出,在all in one环境中,需要对cinder、nova、neutron和ceilometer做端口转发,才能在不修改源码的基础上做到组件之间通讯(组件与ceilometer建立tcp连接),用haproxy:

/etc/haproxy/haproxy.cfg

#/etc/haproxy/haproxy.cfg

#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    # to have these messages end up in /var/log/haproxy.log you will
    # need to:
    #
    # 1) configure syslog to accept network log events.  This is done
    #    by adding the ‘-r‘ option to the SYSLOGD_OPTIONS in
    #    /etc/sysconfig/syslog
    #
    # 2) configure local2 events to go to the /var/log/haproxy.log
    #   file. A line like the following can be added to
    #   /etc/sysconfig/syslog
    #
    #    local2.*                       /var/log/haproxy.log
    #
    log         /dev/log local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     32768
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------
# common defaults that all the ‘listen‘ and ‘backend‘ sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    tcp
    log                     global
    #option                  httplog
    option                  dontlognull
    #option http-server-close
    #option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 32768

listen haproxy_stats
    bind *:8888
    mode http
    stats uri /
    #stats refresh 5
    # stats realm HAproxy\ stats
    # stats auth admin:admin

listen zmq-cinder
    bind 192.168.213.202:9501
    mode tcp
    #log         127.0.0.1 local2
    balance roundrobin
    server test1 192.168.213.88:9500

listen  zmq-nova
    bind 192.168.213.202:9502
    mode tcp
    #log         127.0.0.1 local2
    balance roundrobin
    server test1 192.168.213.88:9500

listen  zmq-neutron
    bind 192.168.213.202:9505
    mode tcp
    #log         127.0.0.1 local2
    balance roundrobin
    server test1 192.168.213.88:9500

listen  zmq-ceilometer
    bind 192.168.213.202:9500
    mode tcp
    #log         127.0.0.1 local2
    balance roundrobin
    server test1 192.168.213.88:9500

3. 建立TCP连接时指定目的IP是在nova配置文件的[matchmaker_ring]模块中指定:

[matchmaker_ring]
ringfile = /etc/nova/matchmaker_ring.json
{
    "conductor":["test1"],
    "scheduler":["test1"],
    "compute": ["test1"],
    "cert": ["test1"],
    "consoleauth":["test1"],
    "backendtask":["test1"],
    "metering": ["ceilometer"],
    "notifications-info": ["ceilometer"],
    "notifications-error": ["ceilometer"]
}
时间: 2024-10-25 04:22:26

openstack组件通讯端口定义的相关文章

openstack组件使用的默认端口

openstack组件使用的默认端口号 openstack service default ports port type Block Storage (cinder) 8776 publicurl and adminurl Compute (nova) endpoints 8774 publicurl and adminurl Compute API (nova-api) 8773, 8775 Compute ports for access to virtual machine consol

Openstack组件部署 — Keystone Install & Create service entity and API endpoints

目录 目录 前文列表 Install and configure Prerequisites 先决条件 Create the database for identity service 生成一个随机数 Install and configure components Configure the Apache HTTP server Create the service entity and API endpoints Prerequisites 先决条件 Create the service e

Openstack组件部署 — keystone(domain, projects, users, and roles)

目录 目录 前文列表 Create a domain projects users and roles domain projects users and roles的意义和作用 Create the default domain Create the service projecttenant 创建用于管理的用户租户和角色 Create the admin projecttenant Create the admin user Create the admin role Add the adm

Openstack组件部署 — Networking service_安装并配置Controller Node

目录 目录 前文列表 前提条件 完成下面的步骤以创建数据库 创建service credentials服务凭证 创建Neutron的API Endpoints 配置自服务网络 安装网络组件 配置服务组件 配置 Modular Layer 2 ML2 插件 配置Linux 桥接代理 配置layer-3代理 配置DHCP代理 配置元数据代理 配置计算使用网络 完成安装 前文列表 Openstack组件部署 - Overview和前期环境准备 Openstack组建部署 - Environment o

COM口,串行通讯端口,RS-232接口 基础知识

COM口即串行通讯端口. COM口的接口标准规范和总线标准规范是RS-232,有时候也叫做RS-232口.电脑上的com口多为9针,最大速率115200bps.通常用于连接鼠标(串口)及通讯设备(如连接外置式MODEM进行数据通讯)等.但目前主流的主板一般都只带1个串口,甚至不带,慢慢会被USB 取代. 以前用于连接老式的COM口鼠标键盘,还有链接路由器,外置调制解调器等.现在很少使用. 什么是串口,串行通讯端口?-----------------------------------------

路由与组件通讯

路由的钩子:(即导航守卫) 1.全局的, const router = new VueRouter({ ... }) router.beforeEach((to, from, next) => { // ... }) 2.单个路由独享的 const router = new VueRouter({ routes: [ { path: '/foo', component: Foo, beforeEnter: (to, from, next) => { // ... } } ] }) 3.组件级的

小程序的组件通讯三种方法==子向父传值

小程序的组件通讯三种方法 ============================ ================================ 子向父传值 第一步:小程序子向父传值在父组件定义方法 第二步:小程序子向父传值第二部在使用子组件的标签上在父的wxml文件中把方法传递给子组件 第三步:小程序子向父传值第三步在子组件的js文件中调用this·triggerEvent触发方法同时传递参数给父组件 第四步:第四步在第一步定义好的方法内部通过e·detail来接收子组件传递回来的参数 原

OpenStack组件系列?Keystone搭建

一:版本信息 官网:http://docs.openstack.org/newton/install-guide-rdo/keystone.html 二:部署keystone 官网文档:http://docs.openstack.org/newton/install-guide-rdo/ 查看系统信息: [[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) [[email prote

Openstack组件部署 — Networking service_Compute Node

目录 目录 前文列表 安装组件 配置通用组件 配置自服务网络选项 配置Linux 桥接代理 配置Nova使用网络 完成安装 验证操作Execute following commands on Controller Node 前文列表 Openstack组件部署 - Overview和前期环境准备 Openstack组建部署 - Environment of Controller Node Openstack组件部署 - Keystone功能介绍与认证实现流程 Openstack组件部署 - Ke