haproxy2.0 支持基于dataplaneapi 的haproxy 动态配置修改以及服务生效,早期大家为了动态
可以会基于dsn 的服务发现模式,基于confd 结合consul 动态生成配置并加载,现在支持了基于
api 的控制,还是很方便的

帮助命令

 
Usage:
  dataplaneapi [OPTIONS]
API for editing and managing haproxy instances
Application Options:
      --scheme= the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec
      --cleanup-timeout= grace period for which to wait before killing idle connections (default: 10s)
      --graceful-timeout= grace period for which to wait before shutting down the server (default: 15s)
      --max-header-size= controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size
                                                   of the request body. (default: 1MiB)
      --socket-path= the unix socket to listen on (default: /var/run/data-plane.sock)
      --host= the IP to listen on (default: localhost) [$HOST]
      --port= the port to listen on for insecure connections, defaults to a random value [$PORT]
      --listen-limit= limit the number of outstanding requests
      --keep-alive= sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download) (default: 3m)
      --read-timeout= maximum duration before timing out read of the request (default: 30s)
      --write-timeout= maximum duration before timing out write of the response (default: 60s)
      --tls-host= the IP to listen on for tls, when not specified it's the same as --host [$TLS_HOST]
      --tls-port= the port to listen on for secure connections, defaults to a random value [$TLS_PORT]
      --tls-certificate= the certificate to use for secure connections [$TLS_CERTIFICATE]
      --tls-key= the private key to use for secure connections [$TLS_PRIVATE_KEY]
      --tls-ca= the certificate authority file to be used with mutual tls auth [$TLS_CA_CERTIFICATE]
      --tls-listen-limit= limit the number of outstanding requests
      --tls-keep-alive= sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)
      --tls-read-timeout= maximum duration before timing out read of the request
      --tls-write-timeout= maximum duration before timing out write of the response
HAProxy options:
  -c, --config-file= Path to the haproxy configuration file (default: /etc/haproxy/haproxy.cfg)
  -u, --userlist= Userlist in HAProxy configuration to use for API Basic Authentication (default: controller)
  -b, --haproxy-bin= Path to the haproxy binary file (default: haproxy)
  -d, --reload-delay= Minimum delay between two reloads (in s) (default: 5)
  -r, --reload-cmd= Reload command
  -s, --restart-cmd= Restart command
      --reload-retention= Reload retention in days, every older reload id will be deleted (default: 1)
  -t, --transaction-dir= Path to the transaction directory (default: /tmp/haproxy)
  -n, --backups-number= Number of backup configuration files you want to keep, stored in the config dir with version number suffix (default: 0)
  -m, --master-runtime= Path to the master Runtime API socket
  -i, --show-system-info Show system info on info endpoint
Logging options:
      --log-to=[stdout|file] Log target, can be stdout or file (default: stdout)
      --log-file= Location of the log file (default: /var/log/dataplaneapi/dataplaneapi.log)
      --log-level=[trace|debug|info|warning|error] Logging level (default: warning)
      --log-format=[text|JSON] Logging format (default: text)
Show version:
  -v, --version Version and build information
Help Options:
  -h, --help Show this help message
 
 

<wiz_tmp_tag class="wiz-block-scroll">

 

启动

  • 普通方式
./dataplaneapi --port 5555 -b /usr/sbin/haproxy -c /etc/haproxy/haproxy.cfg -d 5 -r "service haproxy reload" -s "service haproxy restart" -u dataplaneapi -t /tmp/haproxy
  • 容器方式
 ./dataplaneapi --host 0.0.0.0 --port 5555 --haproxy-bin /usr/sbin/haproxy --config-file /etc/haproxy/haproxy.cfg --reload-cmd "kill -SIGUSR2 1" --reload-delay 5 --userlist controller
  • api 请求方式
curl -u <user>:<pass> -H "Content-Type: application/json" "http://127.0.0.1:5555/v1/"
  • haproxy 2.0 的process manager
   program api
    command dataplaneapi --host 0.0.0.0 --port 5555 --haproxy-bin /usr/sbin/haproxy --config-file /etc/haproxy/haproxy.cfg --reload-cmd "systemctl reload haproxy" --reload-delay 5 --userlist controller

说明

haproxy2.0 的扩展能力还是很不错的,而且源码在github 开放的,后续基于docker 运行下dataplaneapi,试用下功能

api 参考资料

https://www.haproxy.com/documentation/hapee/1-9r1/configuration/dataplaneapi/
https://github.com/haproxytech/dataplaneapi

haproxy2.0 dataplaneapi 简单说明的更多相关文章

  1. haproxy 2.0 dataplaneapi rest api 几个方便的问题排查接口

    在使用haproxy 2.0 dataplaneapi的时候,刚开始的时候我们可能需要进行调试,保证我们的配置在我们的系统环境中 是可以使用的,以下是自己在当前学习中为了排查问题会使用的几个api 创 ...

  2. haproxy 2.0 dataplaneapi rest api 转为graphql

    haproxy 2.0 dataplaneapi rest api 是比较全的,以下是一个简单的集成graphql,通过swagger-to-graphql 转换为graphql api 方便使用 环 ...

  3. haproxy 2.0 dataplaneapi docker 镜像

    为了方便测试dataplaneapi 基于官方的docker镜像,制作了一个简单的包含dataplaneapi 的镜像 下载dataplaneapi https://github.com/haprox ...

  4. Asp.Net MVC+BootStrap+EF6.0实现简单的用户角色权限管理

    这是本人第一次写,写的不好的地方还忘包含.写这个的主要原因是想通过这个来学习下EF的CodeFirst模式,本来也想用AngularJs来玩玩的,但是自己只会普通的绑定,对指令这些不是很熟悉,所以就基 ...

  5. 云优化的概念、Entity Framework 7.0、简单吞吐量压力测试

    云优化的概念.Entity Framework 7.0.简单吞吐量压力测试 继续上一篇<开发 ASP.NET vNext 初步总结(使用Visual Studio 2014 CTP1)>之 ...

  6. Android 6.0 超级简单的权限申请2 (Permission)

    代码地址如下:http://www.demodashi.com/demo/13506.html 写在前面 上次写了一个权限申请的例子Android 6.0 超级简单的权限申请 (Permission) ...

  7. Android 6.0 超级简单的权限申请 (Permission)

    代码地址如下:http://www.demodashi.com/demo/13369.html 背景描述 随着Android系统的不断升级,谷歌对用户的隐私是越来越注重了,给我们开发者带来了更多的繁琐 ...

  8. haproxy2.0入门部署教程

    测试后发现,haproxy2.0和之前的版本部署有些许差异,配置文件的写法也是不同的 测试环境:Centos7.3 IP:172.16.1.227 172.16.1.228 部署httpd,页面内容为 ...

  9. 用Vue2.0实现简单的分页及跳转

    用Vue2.0实现简单的分页及跳转 2018年07月26日 20:29:51 Freya_yyy 阅读数 3369    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog ...

随机推荐

  1. 删除排序链表中的重复元素II --链表

    题目 给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字. 示例1 输入: ->->->->->-> 输出: ->-> ...

  2. Python将背景图片的颜色去掉

    一.问题  在使用图片的时候有时候我们希望把背景变成透明的,这样就只关注于图片本身.比如在连连看中就只有图片,而没有背景,其实我个人感觉有背景好看一点. 二.解决  我们需要使用RGBA(Red,Gr ...

  3. C#读写设置修改调整UVC摄像头画面-白平衡

    有时,我们需要在C#代码中对摄像头的白平衡进行读和写,并立即生效.如何实现呢? 建立基于SharpCamera的项目 首先,请根据之前的一篇博文 点击这里 中的说明,建立基于SharpCamera的摄 ...

  4. Java自学-异常处理 Exception

    Java 异常 Exception 异常定义: 导致程序的正常流程被中断的事件,叫做异常 步骤 1 : 文件不存在异常 比如要打开d盘的LOL.exe文件,这个文件是有可能不存在的 Java中通过 n ...

  5. English--不完全及物动词与授予动词

    English|不完全及物动词与授予动词 动词在整个语法中都是占据着十分重要的角色.在五大句型中将动词分为五种:系动词.不及物动词.及物动词.不完全及物动词.授予动词.这篇主讲不完全及物动词和授予动词 ...

  6. English--动词时态

    English|动词时态 时态是一个很玄乎的东西,要么是完全掌握,要么是不知所云. 在正式开始之前,大家需要明白汉语的谓语动词是不会随着时间与状态而变化.但是,英语的谓语动词会随着时间与状态发生变化. ...

  7. spark过滤算子+StringIndexer算子出发的一个逻辑bug

    问题描述: 在一段spark机器学习的程序中,同时用到了Filter算子和StringIndexer算子,其中StringIndexer在前,filter在后,并且filter是对stringinde ...

  8. 91.用js遍历原生json数据

    <!doctype html> <html lang="en"> <head>     <meta charset="UTF-8 ...

  9. Android Scroller解析

    作用 这个类封装了滚动操作,如帮我们处理手指抬起来时候的滑动操作.与ViewGroup的scrollTo(),scrollBy()的生硬式移动,Scroller提供了一个更加柔和的移动效果.Scrol ...

  10. JVM 源码解读之 CMS 何时会进行 Full GC

    t点击上方"涤生的博客",关注我 转载请注明原创出处,谢谢!如果读完觉得有收获的话,欢迎点赞加关注. 前言 本文内容是基于 JDK 8 在文章 JVM 源码解读之 CMS GC 触 ...