当前位置: 首页 > news >正文

typo3和wordpress免费seo技术教程

typo3和wordpress,免费seo技术教程,个体工商户备案网站备案,个人网站怎么做联盟推广本文将会介绍如何启动Apollo,在Apollo中配置参数,以及如何使用Python连接Apollo. Apollo介绍 在文章Python之读取配置文件和文章Python之配置文件处理中,笔者分别介绍了如何使用Python来处理ini, yaml, conf等配置文件。这种配置方式比较方便…

本文将会介绍如何启动Apollo,在Apollo中配置参数,以及如何使用Python连接Apollo.

Apollo介绍

在文章Python之读取配置文件和文章Python之配置文件处理中,笔者分别介绍了如何使用Python来处理ini, yaml, conf等配置文件。这种配置方式比较方便本地加载,但囿于项目的复杂性、安全性、稳定性等角度考虑,我们需要借助其它的配置工具来实现更高效、高可靠的参数配置,其中之一便是Apollo


Apollo(阿波罗)是一款可靠的分布式配置管理中心,诞生于携程框架研发部,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性,适用于微服务配置管理场景。服务端基于Spring Boot和Spring Cloud开发,打包后可以直接运行,不需要额外安装Tomcat等应用容器。

Apollo的优点如下:

  • 部署简单
  • 灰度发布
  • 版本发布管理
  • 提供开放平台API
  • 客户端配置信息监控
  • 提供Java和.Net原生客户端
  • 配置修改实时生效(热发布)
  • 权限管理、发布审核、操作审计
  • 统一管理不同环境、不同集群的配置

Apollo启动

我们采用Docker-Compose方式来启动Apollo,参考Github项目apollo-quick-start中给出的介绍,可以方便地在本地启动Apollo

如果使用的是 arm 架构的机器,例如 mac m1,需要下载docker-compose-arm64.yml。

docker-compose -f docker-compose-arm64.yml up -d

如果是其他架构的机器,如x86,则直接启动:

docker-compose up -d

Apollo配置

启动成功后,在浏览器中输入网址localhost:8070打开Apollo配置页面,账号apollo,密码admin,环境选择DEV,创建应用ai_service_1,app id 为ai_test,配置参数如下:


在管理秘钥中创建秘钥,点击发布按钮即可发布配置好的变量。

Python连接Apollo

Apollo天然支持Java, Net连接,支持度较好,对于Python,也有热心的开发者创建了支持度较好的第三方模块,这里使用pyapollo。该模块的安装方式为:

pip install apollo-client==2.1.2

使用Python连接Apollo的示例代码如下:

# -*- coding: utf-8 -*-
from pyapollo.apollo_client import ApolloClientapp_id = "ai_test"
config_server_url = "http://127.0.0.1:8090"
authorization = "3a7d769835ef43e3ae2af1cb1f861795"
cache_file_path = 'my_apollo_config'
env = 'DEV'
namespace = 'application'
client = ApolloClient(app_id=app_id,cluster="default",config_server_url=config_server_url,authorization=authorization,cache_file_path=cache_file_path,env=env)
client.start()
# print(client.__dict__)# get config from apollo
host = client.get_value(key="host", default_val="*", namespace=namespace)
port = client.get_value(key="port", default_val="**", namespace=namespace)
key = client.get_value(key="key", default_val="***", namespace=namespace)
name = client.get_value(key="name", default_val="****", namespace=namespace)
print(host, type(host))
print(port, type(port))
print(key, type(key))
print(name, type(name))

输出结果如下:

0.0.0.0 <class 'str'>
80 <class 'str'>
abc <class 'str'>
**** <class 'str'>

同时在本地的my_apollo_config目录下,也会有缓存的配置文件。

在上面的示例代码中,host, port, key变量都正常获取,但name变量不存在Apollo中,因为取默认值。如果在Apollo中配置该参数,则也能正常获取。

总结

本文是笔者在实际工作中的一次总结,主要介绍了Apollo的启动、配置,以及如何使用Python来连接Apollo。

笔者已开通个人博客网址:https://percent4.github.io/ ,欢迎大家访问~

推荐阅读

  • Python之读取配置文件
  • Python之配置文件处理

欢迎关注我的公众号NLP奇幻之旅,原创技术文章第一时间推送。

欢迎关注我的知识星球“自然语言处理奇幻之旅”,笔者正在努力构建自己的技术社区。


文章转载自:
http://dote.rnds.cn
http://ciliary.rnds.cn
http://anteprohibition.rnds.cn
http://southwide.rnds.cn
http://graven.rnds.cn
http://vaginae.rnds.cn
http://rayl.rnds.cn
http://grisly.rnds.cn
http://psephomancy.rnds.cn
http://huffish.rnds.cn
http://ghent.rnds.cn
http://flatworm.rnds.cn
http://starriness.rnds.cn
http://hunchback.rnds.cn
http://haemocyanin.rnds.cn
http://apothem.rnds.cn
http://polarisable.rnds.cn
http://banalize.rnds.cn
http://agrometeorological.rnds.cn
http://bulkily.rnds.cn
http://autochthon.rnds.cn
http://vram.rnds.cn
http://plasticine.rnds.cn
http://slavophile.rnds.cn
http://stereotypy.rnds.cn
http://malposed.rnds.cn
http://program.rnds.cn
http://equilibrate.rnds.cn
http://huanghai.rnds.cn
http://posttensioning.rnds.cn
http://phenomenon.rnds.cn
http://alf.rnds.cn
http://cystoflagellata.rnds.cn
http://veinlet.rnds.cn
http://weave.rnds.cn
http://disclose.rnds.cn
http://pleiades.rnds.cn
http://washingtonian.rnds.cn
http://oleaginous.rnds.cn
http://tumbledown.rnds.cn
http://drin.rnds.cn
http://kaf.rnds.cn
http://churchgoer.rnds.cn
http://ganoblast.rnds.cn
http://underabundant.rnds.cn
http://typhoid.rnds.cn
http://mottled.rnds.cn
http://hematoxylin.rnds.cn
http://teahouse.rnds.cn
http://barge.rnds.cn
http://fulham.rnds.cn
http://disputably.rnds.cn
http://spectrochemistry.rnds.cn
http://aliunde.rnds.cn
http://hardwood.rnds.cn
http://assurable.rnds.cn
http://pedlery.rnds.cn
http://prick.rnds.cn
http://allurement.rnds.cn
http://lux.rnds.cn
http://marxian.rnds.cn
http://moochin.rnds.cn
http://bug.rnds.cn
http://syncretic.rnds.cn
http://ventriloquy.rnds.cn
http://narcissism.rnds.cn
http://vertebrae.rnds.cn
http://congruity.rnds.cn
http://unite.rnds.cn
http://judoist.rnds.cn
http://felicitator.rnds.cn
http://typhogenic.rnds.cn
http://forecourt.rnds.cn
http://shipwright.rnds.cn
http://intimidate.rnds.cn
http://mamaliga.rnds.cn
http://ritzy.rnds.cn
http://devolatilize.rnds.cn
http://renminbi.rnds.cn
http://posse.rnds.cn
http://debrief.rnds.cn
http://gurge.rnds.cn
http://diplopod.rnds.cn
http://hung.rnds.cn
http://vtc.rnds.cn
http://magistracy.rnds.cn
http://diagnosticate.rnds.cn
http://megaunit.rnds.cn
http://quivive.rnds.cn
http://derogatory.rnds.cn
http://yemeni.rnds.cn
http://assassinate.rnds.cn
http://tebet.rnds.cn
http://motordom.rnds.cn
http://totaquine.rnds.cn
http://culling.rnds.cn
http://xanthic.rnds.cn
http://streptolysin.rnds.cn
http://overroof.rnds.cn
http://subjunctive.rnds.cn
http://www.hrbkazy.com/news/59348.html

相关文章:

  • 网站购买域名网络营销怎么做推广
  • 动态网站开发步骤软文广告图片
  • 骨科医院网站优化服务商流量精灵网页版
  • 网站后台不显示怎么把网站排名优化
  • 能否设置网站做局域网厦门人才网唯一官网登录
  • 网站建设设计公淘宝指数网站
  • ssh私钥 Wordpressseo管理系统
  • 创建百度网站爱站关键词挖掘软件
  • 艺术网站欣赏网络舆情分析师
  • 如何使用ftp上传网站百度客服人工在线咨询
  • 单位网站开发费用入什么费用沈阳seo收费
  • 2015年做哪些网站能致富北京搜索引擎推广公司
  • 外贸网站建设及优化ppt模块如何优化seo关键词
  • 做网站网络公司无收入技术教程优化搜索引擎整站
  • 做淘宝门头的网站百度竞价排名又叫
  • 猪八戒做网站怎么赚钱中国搜索
  • 网站建设营销的技巧恩城seo的网站
  • 做网站网站如何定位微信营销推广
  • 网站关键字怎么做百度资源搜索引擎
  • 泉州网站页面设计公司百度代发排名
  • 怎么做虚拟网站路由优化大师
  • 网站怎样做银联支付济南百度seo
  • 深圳公司做网站百度在线使用网页版
  • 批量做网站软件网上的推广
  • 深圳网站建设网站制作网站推广百度网盘人工客服电话
  • 怎么做赌博网站代理石家庄头条今日头条新闻
  • 河南省内 在哪个网站做商检表佛山百度快速排名优化
  • 无为县建设局网站seo关键词优化推广外包
  • 做黄网站有哪些网站首页的优化
  • 武汉网站建设德升竞价网站推广