- 浏览: 460639 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (369)
- javascript html (20)
- java (31)
- jquery (15)
- jcrop (0)
- JEECG (1)
- ajax (3)
- 反射 (3)
- VI (1)
- mysql (48)
- easyui (1)
- svn (2)
- MD5 加密 (1)
- spring (14)
- ORACLE (8)
- 经验总结 (1)
- TCP/IP协议 (1)
- ICMP协议 (1)
- eclipse (1)
- Reflect (1)
- linux (21)
- android (5)
- excel 操作 (1)
- java tree (1)
- html (1)
- plupload (1)
- mongodb (9)
- aes (1)
- python (1)
- java relax (1)
- highcharts (2)
- json (2)
- java 多线程 (30)
- maven (2)
- 设计模式 (1)
- jsp+js (2)
- 面向对象 (1)
- jvm (16)
- 缓存 (1)
- proxy (1)
- 聊侃 (1)
- 面经 (1)
- java 字节 (1)
- java 类加载器 (2)
- java 基础 (2)
- java 语法糖 (1)
- java 位运算 (1)
- 排序 (3)
- java 服务器性能优化 (19)
- 网络编程 (2)
- jvm 参数设置 (0)
- jersey (1)
- webservice (2)
- nginx+多tomcat 集成 (5)
- nginx (16)
- squid (3)
- memcached (5)
- 正则表达式 (1)
- 常用免费接口 (1)
- jpa (1)
- win7 (1)
- java处理大文件 (1)
- js正则表达式 (1)
- tomcat (1)
- java 敏感字 (1)
- 系统架构优化 (4)
- 学习 (1)
- 本地测试QQ微博第三方登陆 (1)
- java 错误 (1)
- 微信支付 (1)
- https (1)
- httpclient (1)
- awk (2)
- loadrunner (1)
- sql server 2008 (3)
- git (4)
- sql server2008 (1)
- solr (2)
- centos (1)
- 数据存储架构 (3)
- log4j (1)
- weboffice (1)
- 并发编程 (1)
- postgreSQL (0)
- ssl (1)
- openssl (1)
- activeMQ (2)
- IDEA (1)
- shell (1)
- ansible (4)
- docker (2)
- grafana (1)
- jmeter (1)
- TLS (1)
- 将博客搬至CSDN (1)
最新评论
-
dida1990:
啊喔,过去了这么久,不过还是评一个。谁说uuid的hashCo ...
高并发生成订单号(二) -
annan211:
yclovesun 写道使用了uuid,为什么还要machin ...
高并发生成订单号(二) -
yclovesun:
使用了uuid,为什么还要machineId?uuid已经可以 ...
高并发生成订单号(二) -
u013280917:
太深奥,看不懂
mysql优化特定类型的查询
task
- name: create manifest directory file: state: directory path: "{{pushgateway_manifest_dir}}" - name: generator pushgateway manifest template: src: "pushgateway-scale.json.j2" dest: "{{pushgateway_manifest_dir}}/pushgateway-scale-{{item}}.json" when: '"pushgateway" in groups and env_list is defined' with_items: "{{ env_list }}" ## 必须数组 vars: current_env: "{{ item }}" - name: generator pushgateway test manifest template: src: "pushgateway-test.json.j2" dest: "{{pushgateway_manifest_dir}}/pushgateway-test-{{item}}.json" when: '"pushgateway" in groups and env_list is defined' with_items: "{{ env_list }}" vars: current_env: "{{ item }}"
host inventry
prometheus: children: prom_group_1: hosts: 192.168.99.4: prometheus_external_domain: http://192.168.99.4:9090 192.168.99.15: prometheus_external_domain: http://192.168.99.15:9090 vars: vm: - prometheus - alertmanager - cassandra - kafka vm_env: - qa - test1 pushgateway: - uvp - am pushgateway_env: - qa - test1 prom_group_2: hosts: 192.168.99.18: prometheus_external_domain: http://192.168.99.18:9090 192.168.99.16: prometheus_external_domain: http://192.168.99.16:9090 vars: vm: - prometheus - alertmanager - cassandra - kafka vm_env: - test1 pushgateway: - uvp - am pushgateway_env: - test1 pushgateway: vars: env_list: - qa - test children: pgw-group-1: hosts: pushgateway1: expose_ports: push: 12001 scrape: 13001 pushgateway2: expose_ports: push: 12002 scrape: 13002 pushgateway3: expose_ports: push: 12003 scrape: 13003 vars: env: qa host_ip: 192.168.101.6 cluster_url: cluster.com pgw-group-2: hosts: pushgateway4: expose_ports: scrape: 12004 push: 13004 pushgateway5: expose_ports: scrape: 12005 push: 13005 vars: env: test host_ip: 192.168.101.6 cluster_url: cluster.com alertmanager: children: am_ha_g1: hosts: 192.168.99.6: alertmanager_cluster_listen_address: 192.168.99.6:8001 alertmanager_external_domain: http://192.168.99.6:9093 192.168.99.17: alertmanager_cluster_listen_address: 192.168.99.17:8001 alertmanager_peers: 192.168.99.17:8001 alertmanager_external_domain: http://192.168.99.17:9093 vars: listen_port: 9093 alertmanager_cluster_port: 8001
template1
{% set counter = [] %} {% set job_counter = [] %} {% for pgw in groups['pushgateway'] %} {% if hostvars[pgw]['env'] == current_env%} {% if counter.append(1) %}{% endif %} {% endif %} {% endfor %} {"services": { {% if groups['pushgateway'] is defined%} {% set index = 0 %} {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} {% set push_groups_last = loop.last%} "service::${APCERA_DEPLOY_NAMESPACE}::nginx-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-service": { "description": "Nginx-{{host}} Generic Service http://{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}", "type": "generic", "params": { "url": "http://{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}" } } {% if index < counter|length %}, {% set index = index + 1 %}{% endif %} {% endif %} {%endfor%} {% endif %} "service::${APCERA_DEPLOY_NAMESPACE}::pushgateway-cluster-apcera-service": { "description": "pushgateway-cluster-apcera-service", "type": "generic", "params": { "url": "http://{%if ENV=='AWS' %}{{aws.pushgateway_cluster_service}}{%else%}{{cvc.pushgateway_cluster_service}}{%endif%}" } }}, "jobs":{ {% set job_index = 0 %} {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} "job::${APCERA_DEPLOY_NAMESPACE}::vas-pm-prometheus-pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}": { "docker": { "image": "${GLOBALENV_DOCKER_REGISTRY_BASE_URL}${IMAGE_NAME_TAG_VAS_PM_PROMETHEUS_PUSHGATEWAY}", "password": "${GLOBALENV_DOCKER_REGISTRY_PASSWORD}", "username": "${GLOBALENV_DOCKER_REGISTRY_USERNAME}" }, "exposed_ports": [ 80, 9091 ], "state": "started", "env": { "CLEANUP_INTERVAL_SECONDS": "60", "PUSHGATEWAY_URL": "http://pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-{%if ENV=='AWS' %}{{aws.pushgateway_node_endpoint}}{%else%}{{cvc.pushgateway_node_endpoint}}{%endif%}", "METRIC_TIMEOUT_SECONDS": "{{metric_timeout}}", "NGINX_SERVER_LIST":"{% for nginx_host in groups['pushgateway'] %}{% if hostvars[nginx_host]['env'] == current_env%}server {{hostvars[nginx_host]['host_ip']}}:{{hostvars[nginx_host]['expose_ports']['push']}};{%endif%}{% endfor %}" }, "routes": [{ "type": "http", "endpoint": "pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-{%if ENV=='AWS' %}{{aws.pushgateway_node_endpoint}}{%else%}{{cvc.pushgateway_node_endpoint}}{%endif%}", "config": { "/": [{ "port": 9091 }] } }, { "type": "http", "endpoint": "{{hostvars[host]['cluster_url']}}", "config": { "/": [{ "port": 9091 }] } }, { "type": "tcp", "endpoint": "{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}", "config": [{ "port": 9091 }] }, { "type": "tcp", "endpoint": "{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['push']}}", "config": [{ "port": 80 }] } ], "services": { {% set service_index = 1 %} {% for service_host in groups['pushgateway'] %} {% if hostvars[service_host]['env'] == current_env%} "NGINX-{{hostvars[service_host]['host_ip']}}-{{hostvars[service_host]['expose_ports']['scrape']}}-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::nginx-{{hostvars[service_host]['host_ip']}}-{{hostvars[service_host]['expose_ports']['scrape']}}-service" } {% if service_index < counter|length %}, {% set service_index = service_index + 1 %}{% endif %} {% endif %} {%endfor%} "CLUSTER-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::pushgateway-cluster-apcera-service" } } , "restart_mode": "always", "ssh": true, "start": { "timeout": 30 } } {% if job_counter.append(1) %}{% endif %} {% if job_counter|length < counter|length %}, {% endif %} {% endif %} {%endfor%} } }
template2
{% set counter = [] %} {% set route_counter = [] %} {% for pgw in groups['pushgateway'] %} {% if hostvars[pgw]['env'] == current_env%} {% if counter.append(1) %}{% endif %} {% endif %} {% endfor %} { "jobs": { "job::${APCERA_DEPLOY_NAMESPACE}::pushgateway-docker-auto-test": { "docker": { "image": "${GLOBALENV_DOCKER_REGISTRY_BASE_URL}${IMAGE_NAME_TAG_PUSHGATEWAY_DOCKER_AUTO_TEST}", "password": "${GLOBALENV_DOCKER_REGISTRY_PASSWORD}", "username": "${GLOBALENV_DOCKER_REGISTRY_USERNAME}" }, "exposed_ports": [80, 9093], "state": "started", "env": { "PROMETHEUS_PM_URI": "{%if ENV=='AWS' %}{{aws.pushgateway_cluster_service}}{%else%}{{cvc.pushgateway_cluster_service}}{%endif%}", "PUSHGATEWAY_IPS": "{% for host in groups['pushgateway'] %}{% if hostvars[host]['env'] == current_env%}{% set push_groups_last = loop.last%}pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-{%if ENV=='AWS' %}{{aws.pushgateway_node_endpoint}}{%else%}{{cvc.pushgateway_node_endpoint}}{%endif%}{% if ( push_groups_last==False) %},{% endif %}{% endif %}{%endfor%}" }, "routes": [ { "type": "http", {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env and loop.index <=1 %} "endpoint": "{{hostvars[host]['cluster_url']}}", {% endif %} {%endfor%} "config": { "/": [{ "port": 80 }] } }, {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} { "type": "tcp", "endpoint": "{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}", "config": [{ "port": 80 }] } {% if route_counter.append(1) %}{% endif %} {% if route_counter|length < counter|length %}, {% endif %} {% endif %} {%endfor%} ], "services":{ {% set service_index = 0 %} {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} "NGINX-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::nginx-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-service" } {% set service_index = service_index + 1 %} {% if service_index < counter|length %}, {% endif %} {% endif %} {%endfor%} "CLUSTER-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::pushgateway-cluster-apcera-service" } }, "restart_mode": "always", "ssh": true, "start": { "timeout": 30 } } } }
相关推荐
**Python包Jinja2详解** Jinja2是一个强大的、现代的、设计者友好的模板引擎,它是用Python语言编写的,被广泛应用于Web应用开发中,以生成动态HTML、XML或其他标记语言。Jinja2的设计灵感来源于Django模板语言,但...
Jinja2是一个流行的模板引擎,用于Python编程语言,广泛用于Web开发框架如Flask和Django中。其核心功能是将数据与模板结合生成HTML页面或其他格式的文档。 在本文中,会通过实例代码详细解释如何使用Jinja2来生成...
它允许我们在Python中使用模板语言来动态生成SQL,充分利用Jinja2的灵活性和强大功能。结合Python的数据库驱动,如`psycopg2`、`pyodbc`等,我们可以构建出高效且安全的数据库操作代码。在实际项目中,合理使用`...
python-jinja2-26-2.6-3.el6.noarch.rpm
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
Jinja2 is a full featured template engine for Python. It has full unicode support, an optional integrated sandboxed execution environment, widely used and BSD licensed.
**Python库 - Jinja2与ospath** Jinja2是一个强大的、现代的、设计者友好的模板引擎,它是用Python语言编写的。Jinja2基于成熟的Mako模板引擎,为Python开发者提供了高度灵活的模板设计和渲染能力。它广泛应用于Web...
**Jinja2**是Python中一个强大的模板引擎,被广泛应用于Web开发中,尤其是与Flask和Django等框架结合使用。它提供了丰富的语法结构,允许开发者以清晰、简洁的方式编写模板,用于生成动态HTML或其他格式的文档。下面...
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
**Python-Jinja2模板引擎详解** Jinja2是一款强大的、高效且灵活的纯Python模板引擎,它是基于Python语言设计的,无需任何外部依赖。由Pallets团队开发,广泛应用于Web应用开发,如Flask框架中。Jinja2的设计灵感...
Jinja2是一个现代的、设计者友好的模板语言,其设计灵感来源于Django模板语言和Python本身。它具有清晰的语法,易于阅读和编写,并且支持继承、宏、过滤器、表达式和控制结构等高级特性。通过pyramid_jinja2库,...
使用docx作为jinja2模板 介绍 该软件包使用2个主要软件包: 用于读取,编写和创建子文档的python-docx jinja2用于管理插入到模板docx中的标签 之所以创建python-docx-template,是因为python-docx具有创建文档但...
基于 Flask / Jinja2 / Bootstrap / MySQL 开发,仿照拉勾网的风格,实现了招聘网站的必需功能 环境 Python 3 MySQL 快速开始 1. 安装 Python 依赖 $ pip3 install -r requirements.txt 2. 修改配置文件 根据自己...
odoo包
Jinja2 是一个 Python 的功能齐全的模板引擎。它有完整的 unicode 支持,一个可选 的集成沙箱执行环境,被广泛使用,以 BSD 许可证授权。
python compile_to_js.py /path/to/jinja2/template 上面的命令将产生一个 JavaScript 函数,当使用包含对应于模板请求的值作为第一个参数的值的 JSON blob 执行时,将产生模板的呈现版本。 将--attributes标志...
Jinja2是一种现代、设计者友好的Python模板引擎,它模仿了Django模板系统的设计理念,但又在此基础上进行了许多改进与优化。Jinja2的主要特点包括: - **高性能**:Jinja2在设计上特别注重性能优化,能够快速生成...
Python使用Jinja2模板.docx