Mryqu's Notes


  • 首页

  • 搜索
close

使用Consul DNS接口

时间: 2018-06-21   |   分类: Tool   Consul     |   阅读: 664 字 ~4分钟
Consul提供了两个查询接口:HTTP和DNS。DNS接口允许应用程序在没有与consul高度集成的情况下使用服务发现。 以下面这个小Consul集群为例: root@consul:/# /usr/bin/consul members Node Address Status Type Build Protocol DC configuration 172.17.0.7:8301 alive client X.Y.Z 2 dc1 consul 172.17.0.2:8301 alive server X.Y.Z 2 dc1 httpd 172.17.0.4:8301 alive client X.Y.Z 2 dc1 logon 172.17.0.8:8301 alive client X.Y.Z 2 dc1 postgres 172.17.0.3:8301 alive client X.Y.Z 2 dc1 rabbitmq 172.17.0.6:8301 alive client X.Y.Z 2 dc1 可以通过DNS接口以<dnode>.node[.datacenter].<domain>的形式查询节点地址,也可以[tag.]<dservice>.service[.datacenter].<domain>的形式查询服务地址。 root@httpd:/# dig @127.0.0.1 -p53 postgres.node.consul ANY ; <<>> DiG 9.9.5-9-Debian <<>> @127.0.0.1 -p53 postgres.node.consul ANY ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57064 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;postgres.
阅读全文 »

Vagrant折腾记

时间: 2018-06-19   |   分类: Tool   Vagrant     |   阅读: 1206 字 ~6分钟
自从用了OpenStack,真是很久没玩Vagrant。偶尔想用用,问题不断,废了一点功夫才解决。 遭遇VBoxManage.exe: error $ vagrant up Bringing machine 'xdevimg' up with 'virtualbox' provider... ==> xdevimg: Checking if box 'devimage-ubuntu' is up to date... ==> xdevimg: A newer version of the box 'devimage-ubuntu' is available! You currently ==> xdevimg: have version '0.13.0'. The latest is version '0.13.2'. Run ==> xdevimg: `vagrant box update` to update. ==> xdevimg: Clearing any previously set forwarded ports... ==> xdevimg: Clearing any previously set network interfaces... ==> xdevimg: Preparing network interfaces based on configuration.
阅读全文 »

服务发现产品对比

时间: 2018-05-29   |   分类: Service+JavaEE     |   阅读: 90 字 ~1分钟
首先就一些常见的服务发现产品进行下对比: 对比项[Consul](https://www.consul.io/) [GitHub](https://github.com/hashicorp/consul)[Zookeeper](https://zookeeper.apache.org/) [GitHub](https://github.com/apache/zookeeper)[Etcd](https://coreos.com/etcd/) [GitHub](https://github.com/coreos/etcd)Euerka [GitHub](https://github.com/Netflix/eureka)[Kubernetes](https://kubernetes.io/) [GitHub](https://github.com/kubernetes/kubernetes)**服务健康检查**[客户端可绑定 任意多个服务或 节点健康检查 (内存、磁盘)](https://www.consul.io/intro/index.html)[CS之间长连接 +连接心跳](http://zookeeper.apache.org/doc/current/zookeeperOver.html); [SS之间TCP KeepAlive](http://zookeeper.apache.org/doc/current/zookeeperAdmin.html)[连接心跳](https://coreos.com/etcd/docs/latest/tuning.html)[连接心跳注册、 其他可配支持](http://cloud.spring.io/spring-cloud-netflix/single/spring-cloud-netflix.html#_eureka_s_health_checks)**多数据中心**[内置WAN方案支持](https://www.consul.io/docs/internals/architecture.html)[中央Zookeeper集群, 通过Observer有限支持](https://zookeeper.apache.org/doc/current/zookeeperObservers.html)————**KV存储限制**上百MB上百MB (有时支持上GB)上GB——**线性化读取 原子读取**[是](https://www.consul.io/docs/agent/http.html#consistency)否[是](https://coreos.com/etcd/docs/latest/learning/api_guarantees.html#linearizability)——**事务**[字段比较、 锁、读、写](https://www.consul.io/api/txn.html)[版本审查、 写](https://zookeeper.apache.org/doc/current/api/org/apache/zookeeper/ZooKeeper.html#multi-java.lang.Iterable-)[字段比较、 读、写](https://coreos.com/etcd/docs/latest/learning/api.html#transaction)——**多版本并发控制 MVCC**————[支持](https://coreos.com/etcd/docs/latest/learning/data_model.html)——**watch支持/ 变化通知**[针对KV对、键前缀、 服务成员、服务实例、 节点列表、健康检查、 自定义用户事件等](https://www.consul.io/docs/agent/watches.html)[针对当前KV或目录; 单次](http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ch_zkWatches)[针对过去或当前的键区间](https://coreos.com/etcd/docs/latest/learning/api.html#watch-streams)[针对app、 vipAddress 或实例](https://github.com/Netflix/eureka/wiki/Eureka-2.0-Client-Configuration-And-Use#using-the-interest-client)**一致性协议**[Raft](https://www.consul.io/docs/internals/consensus.html)[Zab(≈Paxos)](https://cwiki.apache.org/confluence/display/ZOOKEEPER/Zab+vs.+Paxos)[Raft](https://github.com/coreos/etcd)——**CAP**[CP](https://www.consul.io/intro/vs/serf.html)[CP](https://www.elastic.co/blog/found-zookeeper-king-of-coordination)CP[AP](https://github.com/Netflix/eureka/wiki/Eureka-2.0-Architecture-Overview#cap-theorem)**成员动态更新**[支持](https://www.consul.io/docs/guides/servers.html)[>3.5.0](https://cwiki.apache.org/confluence/display/ZOOKEEPER/ClusterMembership)[支持](https://coreos.com/etcd/docs/latest/op-guide/runtime-configuration.html)[支持](https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance#configurability)**支持接口**[HTTP](https://www.consul.io/api/index.html)和[DNS](https://www.consul.io/docs/agent/dns.html)[客户端](https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZKClientBindings)[HTTP](https://coreos.com/etcd/docs/latest/dev-guide/api_grpc_gateway.html)和gRPC[HTTP](https://github.com/Netflix/eureka/wiki/Eureka-REST-operations) ([Sidecar](https://cloud.spring.io/spring-cloud-netflix/multi/multi__polyglot_support_with_sidecar.html))**性能指标监控**[Metrics](https://www.consul.io/docs/agent/telemetry.html)—— (可通过[命令行](http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_zkCommands) 或[JMX](http://zookeeper.apache.org/doc/current/zookeeperJMX.html)监控, 但没有Metrics)[Metrics](https://coreos.com/etcd/docs/latest/metrics.html)[Metrics](https://github.com/Netflix/eureka/blob/master/eureka-core/src/main/java/com/netflix/eureka/util/EurekaMonitors.java)**用户权限**[ACLs](https://www.consul.io/docs/guides/acl.html)[ACLs](https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperAccessControl)[基于Role](https://coreos.com/etcd/docs/latest/op-guide/authentication.html)——**安全**[TLS](https://www.consul.io/docs/agent/encryption.html) / [HTTPS](https://www.consul.io/docs/agent/encryption.html)[SSL](https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZooKeeper+SSL+User+Guide)[TLS](https://coreos.com/etcd/docs/latest/op-guide/security.html) / [HTTPS](https://coreos.com/etcd/docs/latest/etcd-live-http-to-https-migration.html)[HTTPS](http://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/2.0.0.RC2/single/spring-cloud-netflix.html#_registering_a_secure_application)**Web管理界面**[支持](https://www.consul.io/intro/getting-started/ui.html)支持—— (有第三方支持, 例如soyking/e3w)[支持](https://github.com/Netflix/eureka-ui)**Spring Cloud集成**[Spring Cloud Consul](https://cloud.spring.io/spring-cloud-consul/)[Spring Cloud Zookeeper](https://cloud.spring.io/spring-cloud-zookeeper/)[Spring Cloud Etcd](https://github.com/spring-cloud-incubator/spring-cloud-etcd) (孵化状态)[Spring Cloud Netflix](https://cloud.spring.io/spring-cloud-netflix/)[Spring Cloud Kubernetes](https://github.com/spring-cloud-incubator/spring-cloud-kubernetes) (孵化状态)**实现语言**[Go](https://github.com/hashicorp/consul)[Java](https://github.com/apache/zookeeper)[Go](https://github.com/coreos/etcd)[Java](https://github.com/Netflix/eureka)[Go](https://github.com/kubernetes/kubernetes)**用户**未提及[用户列表](https://cwiki.apache.org/confluence/display/ZOOKEEPER/PoweredBy)[用户列表](https://github.com/coreos/etcd/blob/master/Documentation/production-users.md)除了Netflix自用 未提及其他用户[合作方列表](https://kubernetes.io/partners/) 此外,Airbnb开源了由Ruby语言实现的自动服务发现和注册框架SmartStack,它由nerve、 synapse、Zookeeper和HAProxy组成。ZooKeeper负责维护集群状态;nerve负责针对服务进行健康检查及向Zookeeper注册;synapse负责为服务提供者查询Zookeeper并动态配置HAProxy。客户端与HAProxy交互,HAProxy负责健康检查及在针对服务提供者进行负载均衡。 注:对Kubernetes的对比在后继学习之后再补上。 参考 Consul vs. ZooKeeper, doozerd, etcd Consul vs. SmartStack Consul vs. Eureka etcd versus other key-value stores
阅读全文 »

[AWS] 学习AWS上SAS联合账户的使用

时间: 2018-04-18   |   分类: Cloud     |   阅读: 12 字 ~1分钟
今天顺利学完《SAS Federated Accounts on Amazon Web Services》课程,测验全都答/蒙对了。 创建了EC2实例。 第一次用MobaXterm。相对Putty,省了将.pem SSH密钥通过PuTTYgen工具转换成.ppk格式这一步操作。 在/etc/resolv.conf文件中增加了几个nameserver以指定单位的DNS,在search项增加了多个域名以解析单位的机器名。 安装libXext.x86_64、libXp.x86_64、libXtst.x86_64、xorg-x11-xauth.x86_64、xorg-x11-apps等包以支持图形显示。

使用Fetch_API

时间: 2018-03-09   |   分类: FrontEnd     |   阅读: 11 字 ~1分钟
今天又学了一招在Chrome developer tool中通过Fetch_API发起HTTP请求。 代码示例: fetch('https://jsonplaceholder.typicode.com/posts/1') .then(response => response.json()) .then(json => console.log(json))

安装Twurl并调试extended tweet mode

时间: 2018-02-08   |   分类: DataBuilder     |   阅读: 807 字 ~4分钟
在研究tweet字节限制由140字节变为280字节时,想要玩一玩Twitter API控制台工具(https://dev.twitter.com/rest/tools/console),结果dev.twitter.com跳到了developer.twitter.com,这才发现Twitter REST API按照Standard、Premium和Enterprise划分开始走上收费的道路。 Twitter API控制台工具已经找不到了,官方示例使用twurl命令工具完成的。 安装Twurl 在https://rubyinstaller.org/下载并安装RubyInstaller 执行gem install twurl 调试extended tweet mode 准备环境 认证 twurl authorize --consumer-key key --consumer-secret secret 搜索tweet twurl "/1.1/search/tweets.json?q=scnydq" { "statuses": [ { "created_at": "Thu Feb 08 02:22:11 +0000 2018", "id": 9.6142489253621e+17, "id_str": "961424892536205313", "text": "scnydq.testbody280:001002003004005006007008009010011012013014015016017018019020021022023024025026027028029030031032\u2026 https:\/\/t.co\/q9CyeceQku", "truncated": true, "entities": { "hashtags": [ ], "symbols": [ ], "user_mentions": [ ], "urls": [ { "url": "https:\/\/t.co\/q9CyeceQku", "expanded_url": "https:\/\/twitter.com\/i\/web\/status\/961424892536205313", "display_url": "twitter.com\/i\/web\/status\/9\u2026", "indices": [ 117, 140 ] } ] }, "metadata": { "iso_language_code": "en", "result_type": "recent" }, "source": "<a href=\"http:\/\/twitter.
阅读全文 »

[JS] 通过升级npm解决了error TS2322和TS2307

时间: 2018-01-28   |   分类: FrontEnd     |   阅读: 28 字 ~1分钟
上一个项目有个defect需要解决,很久没有动它了,所以一上来先git pull更新代码库,然后通过gradlew clean build –refresh-dependencies进行构建,不料竟然碰到很多TS2322和TS2307错误,最后:grunt_build任务以失败告终。通过如下命令更新npm,问题不复重现。 npm cache clean npm install 不过具体是怎么解决的问题,还是不太清楚。有可能是因为npm升级了TypeScript,从而使问题得以解决。 C:\>npm list -g C:\Users\xxxxxx\AppData\Roaming\npm `-- typescript@2.1.6 C:\xxxgitws\xxxxxx-app>npm list typescript xxxxxx-app@3.0.0-0 C:\xxxgitws\xxxxxx-app `-- guides-buildtools-openuibundled@8.0.0 `-- guides-buildtools-openui@8.0.0 `-- typescript@2.4.1

[JS] 鼠标点的screenX/Y、clientX/Y、pageX/Y和offsetX/Y

时间: 2018-01-09   |   分类: FrontEnd     |   阅读: 36 字 ~1分钟
理解 clientX/Y:鼠标点相对浏览器窗口内容区域(viewport)左上角的偏移量。 桌面浏览器基本支持,移动浏览器有可能不支持。 pageX/Y:鼠标点相对浏览器所有渲染内容区域(viewport)左上角的偏移量。(滚动后,文档左上角有可能不在浏览器窗口中,仍旧从文档左上角算起) 桌面浏览器基本支持,移动浏览器有可能不支持。 screenX/Y:鼠标点相对物理显示器左上角的偏移量。 当浏览器换了位置或屏幕分辨率改了,即使clientX/Y不变,screenX/Y值都有可能变动。 桌面和移动浏览器都基本支持。 offsetX/offsetY:鼠标点相对事件目标左上角的偏移量。 实验性质技术,桌面浏览器基本支持,移动浏览器有可能不支持。 代码示例 测试 做了两次测试:第一次测试没有滚动浏览器,第二次测试滚动了浏览器。 两次点击的clientY都是22; 两次点击的screenY都是225; 两次点击的pageY分别是22和428(整个文档渲染区域左上角滚动后没有出现在浏览器内); 两次点击的offsetY分别是6和413(段落渲染区域左上角滚动后没有出现在浏览器内)。 参考 What is the difference between screenX/Y, clientX/Y and pageX/Y? getMousePosition.js MDN: MouseEvent.screenX MDN: MouseEvent.clientX MDN: MouseEvent.pageX MDN: MouseEvent.offsetX

[OpenUI5] Theme加载

时间: 2017-12-28   |   分类: FrontEnd     |   阅读: 39 字 ~1分钟
瞄了一下OpenUI5中UI主题加载,关键点在sap.ui.core.Core.includeLibraryTheme方法。其调用者主要为: sap.ui.core.Core._boot:启动OpenUI5核心时加载必要的主题 sap.ui.core.Core.initLibrary:加载某个库时会尝试加载其主题 假定config.js内容如下: window['sap-ui-config'] = { bindingSyntax: 'complex', modules: [ "sap.m.library", "sap.ui.commons.library", "sap.ui.table.library", "sap.ui.layout.library", "yqu.ui.kexiao.library" ] } }; OpenUI5在加载yqu.ui.kexiao.library库时会尝试加载其主题。 Core.includeLibraryTheme (Core.js?eval:xxxx) Core.initLibrary (Core.js?eval:xxxx) (anonymous) (Interface.js?eval:xx) (anonymous) (library.js?eval:xx) evalModuleStr (sap-ui-core-dbg.js:xxxxx) execModule (sap-ui-core-dbg.js:xxxxx) requireModule (sap-ui-core-dbg.js:xxxxx) jQuery.sap.require (sap-ui-core-dbg.js:xxxxx) Core.loadLibrary (Core.js?eval:xxxx) .............

Typescript类型定义文件(.d.ts)生成工具

时间: 2017-12-07   |   分类: FrontEnd     |   阅读: 51 字 ~1分钟
Microsoft/dts-gen - dts-gen creates starter TypeScript definition files for any module or library. dtsmake - d.ts file generator tool from JavaScript files. dtsgenerator - d.ts file generator tool, for only JSON Schema files. js2tsd - d.ts file generator tool, no type inferrence. JS2TSD d.ts file generator GUI tool app. Not CLI.
2 3 4 5 6 7 8 9 10

Programmer & Architect

662 日志
27 分类
1472 标签
RSS 订阅
GitHub Twitter FB Page
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%