nsqadmin 结构体定义

type Options struct {
LogLevel string `flag:"log-level"`
LogPrefix string `flag:"log-prefix"`
Verbose bool `flag:"verbose"` // for backwards compatibility
Logger Logger
logLevel lg.LogLevel // private, not really an option HTTPAddress string `flag:"http-address"` GraphiteURL string `flag:"graphite-url"`
ProxyGraphite bool `flag:"proxy-graphite"` StatsdPrefix string `flag:"statsd-prefix"`
StatsdCounterFormat string `flag:"statsd-counter-format"`
StatsdGaugeFormat string `flag:"statsd-gauge-format"` StatsdInterval time.Duration `flag:"statsd-interval"` NSQLookupdHTTPAddresses []string `flag:"lookupd-http-address" cfg:"nsqlookupd_http_addresses"`
NSQDHTTPAddresses []string `flag:"nsqd-http-address" cfg:"nsqd_http_addresses"` HTTPClientConnectTimeout time.Duration `flag:"http-client-connect-timeout"`
HTTPClientRequestTimeout time.Duration `flag:"http-client-request-timeout"` HTTPClientTLSInsecureSkipVerify bool `flag:"http-client-tls-insecure-skip-verify"`
HTTPClientTLSRootCAFile string `flag:"http-client-tls-root-ca-file"`
HTTPClientTLSCert string `flag:"http-client-tls-cert"`
HTTPClientTLSKey string `flag:"http-client-tls-key"` AllowConfigFromCIDR string `flag:"allow-config-from-cidr"` NotificationHTTPEndpoint string `flag:"notification-http-endpoint"` AclHttpHeader string `flag:"acl-http-header"`
AdminUsers []string `flag:"admin-user" cfg:"admin_users"`
}

Options 只有一个 New 方法, 就是创建一个 NSQAdmin 对象:

func New(opts *Options) *NSQAdmin {}
type NSQAdmin struct {
sync.RWMutex
opts atomic.Value // interface 类型,实际保存的是 *Options
httpListener net.Listener
waitGroup util.WaitGroupWrapper
notifications chan *AdminAction
graphiteURL *url.URL
httpClientTLSConfig *tls.Config
}

再看看 NSQAdmin 提供了哪些方法:

// 读取 ops 的值,这里用的 atomic 来保证同步操作
func (n *NSQAdmin) getOpts() *Options {} // 存储 ops 的值
func (n *NSQAdmin) swapOpts(opts *Options) {} // 返回服务器地址,即: net.Listener.Addr()
func (n *NSQAdmin) RealHTTPAddr() *net.TCPAddr {} // 从 channel 中读取消息,转换成 json, 然后发送到 nsq 节点
func (n *NSQAdmin) handleAdminActions() {} // 退出清理操作
// 关闭 http 监听, 关闭 channel
func (n *NSQAdmin) Exit() {} // 监听端口
func (n *NSQAdmin) Main() {}

nsqadmin的更多相关文章

  1. go语言nsq源码解读二 nsqlookupd、nsqd与nsqadmin

    nsqlookupd: 官方文档解释见:http://bitly.github.io/nsq/components/nsqlookupd.html 用官方话来讲是:nsqlookupd管理拓扑信息,客 ...

  2. Nginx reverse proxy NSQAdmin

    以下配置只针对nsqadmin v1.1.0 (built w/go1.10.3)版本 ## The default server# server {    listen       80 defau ...

  3. (转)go语言nsq源码解读二 nsqlookupd、nsqd与nsqadmin

    转自:http://www.baiyuxiong.com/?p=886 ---------------------------------------------------------------- ...

  4. 深入NSQ 之旅[转载]

    介绍 NSQ是一个实时的分布式消息平台.它的设计目标是为在多台计算机上运行的松散服务提供一个现代化的基础设施骨架.这篇文章介绍了 基于go语言的NSQ的内部架构,它能够为高吞吐量的网络服务器带来 性能 ...

  5. nsq

    官网:http://nsq.io (1)描述 都是message broker,rabbitmq久经考验,nsq则是后起之秀.rabbitmq是erlang编写,nsq是golang. 安装:http ...

  6. 实时消息平台NSQ的特性

    NSQ是GO语言开发的可用于大规模系统中的实时消息服务,但是和RabbitMQ等相比,它具有什么特色,什么场景下选择NSQ呢? NSQ的自身特色很明显,最主要的优势在如下三个方面: 1,性能.在多个著 ...

  7. nsq初探

    一. 安装 参考:http://nsq.io/deployment/installing.htmlhttp://www.baiyuxiong.com/?p=873    (推荐.) 不推荐直接把官方的 ...

  8. Mac OS X 上的安装nsq并使用

    安装: brew install nsq 使用: The following steps will run a small NSQ cluster on your local machine and ...

  9. NSQ部署

    一.      简介 NSQ主要有三个主要程序和一个Web服务程序: nsqd:是守护进程,接收,缓存,并投递消息给客户端 nsqlookupd:是一个守护进程,为消费者提供运行时发现服务,来查找指定 ...

随机推荐

  1. react动态路由以及获取动态路由

    业务中会遇到点击列表跳转到详情页, 1.在index.js修改我们的跟组件 新建router2的文件 import React from 'react' import { HashRouter as ...

  2. AB PLC首次IP地址如何分配

    AB PLC首次IP地址如何分配,这里介绍的方法是针对CompactLogix和ControlLogix控制器 一.准备工作 AB PLC控制器一台,本文以5069-L330ER为例,将其通电: 笔记 ...

  3. C# 泛型单例

    不支持非公共的无参构造函数的 public abstract class BaseInstance<T> where T : class,new() { private readonly ...

  4. edx的ST

    卷积概率论 顺便了解了一下卷积函数 反正以后学CNN还要再看 这个mit老师水平真的不太行 倒是以这个为源头找到不少好的youtube视频 看看她题目出的怎么样吧... cousera今天估计没时间了

  5. 学习笔记——单片机简介 & 点亮LED & 流水灯 & 电路基础【更新Ing】

    视频地址:https://www.bilibili.com/video/av10765766 超详细!!!!!! 单片机内部三大资源 [资源:单片机可提供使用的东西] FLASH 可以重复擦写 断电后 ...

  6. 【easy】746. Min Cost Climbing Stairs 动态规划

    On a staircase, the i-th step has some non-negative cost cost[i]assigned (0 indexed). Once you pay t ...

  7. 【原创】大数据基础之Impala(3)部分调优

    1)将coordinator和executor角色分离 By default, each host in the cluster that runs the impalad daemon can ac ...

  8. VMware对虚拟机快照进行克隆

    1.在关机状态下做一个快照 2.把快照管理器打开 3.右键快照,选择“克隆此快照” 4.选择要克隆的快照 5.选择克隆的方式 6.设置名称及保存的位置 注:虚拟机的快照是开机状态,不能对快照进行克隆

  9. IE8引用jQuery报$或者jQuery未定义

    最近公司做的项目要求兼容到IE8,结果在页面调试的时候出了个bug,在IE8上面一直报错$未定义,或者jQuery未定义,导致页面上面写的jQuery全部失效,在Chrome浏览器没有任何问题.很是头 ...

  10. DataTable插件通过js导出Excel

    $('#myTab').DataTable( { serverSide: false,//分页,取数据等等的都放到服务端去. true为后台分页,每次点击分页时会请求后台数据,false为前台分页 d ...